View Issue Details

This bug affects 1 person(s).
 8
IDProjectCategoryView StatusLast Update
15843Bug reportsInstallationpublic2020-04-14 12:53
Reporterreinhards Assigned Toc_schmitz  
PrioritynormalSeveritypartial_block 
Status closedResolutionfixed 
Product Version4.1.2 
Fixed in Version4.1.17 
Summary15843: unable to run db migration via command line
Description

probably Bug 13744 re-appeared

I was upgrading vom Version 2.72 to Version 4.1.2 and ran into this:

php application/commands/console.php updatedb
Update mysql:host=127.0.0.1;port=3306;dbname=survey; with prefix :lime_ from 263 to 425
Error: Call to undefined function getGlobalSetting() in /export/htdocs/limesurvey-4.1.2/application/helpers/update/updatedb_helper.php:2842
Stack trace:
#0 /export/htdocs/limesurvey-4.1.2/application/commands/UpdateDbCommand.php(44): db_upgrade_all(263)
#1 /export/htdocs/limesurvey-4.1.2/framework/console/CConsoleCommandRunner.php(71): UpdateDBCommand->run(Array)
#2 /export/htdocs/limesurvey-4.1.2/framework/console/CConsoleApplication.php(92): CConsoleCommandRunner->run(Array)
#3 /export/htdocs/limesurvey-4.1.2/framework/base/CApplication.php(185): CConsoleApplication->processRequest()
#4 /export/htdocs/limesurvey-4.1.2/application/commands/console.php(64): CApplication->run()
#5 {main}[root@survey survey]#

Additional Information

fixed it by adding the patch from Bug 13744 to the file UpdateDbCommand.php

https://bugs.limesurvey.org/view.php?id=13744

TagsNo tags attached.
Bug heat8
Complete LimeSurvey version number (& build)4.1.2+200210
I will donate to the project if issue is resolvedNo
Browser
Database type & versionmariadb-5.5.64-1.el7
Server OS (if known)CentOS 7.7
Webserver software & version (if known)
PHP Version7.1.33

Users monitoring this issue

Keisial

Activities

Keisial

Keisial

2020-03-07 01:02

reporter   ~56358

I was about to report the same thing. Updating from 3.22 branch to 4.1.8

Just replacing the files doesn't work (complains about missing columns, etc.)

Following the instructions https://manual.limesurvey.org/Upgrading_from_a_previous_version
I find about console.php updatedb command, and thus enter the 'proper' invocation:

$ php application/commands/console.php updatedb
Update mysql:host=REDACTED with prefix :lime_ from 359 to 425
CException: Please fix this error in your database and try again in /var/www/html/application/commands/UpdateDbCommand.php:48
Stack trace:
#0 /var/www/html/framework/console/CConsoleCommandRunner.php(71): UpdateDBCommand->run(Array)
#1 /var/www/html/framework/console/CConsoleApplication.php(92): CConsoleCommandRunner->run(Array)
#2 /var/www/html/framework/base/CApplication.php(185): CConsoleApplication->processRequest()
#3 /var/www/html/application/commands/console.php(64): CApplication->run()
#4 {main}

I need to actually look at ./application/commands/UpdateDbCommand.php

        $result = db_upgrade_all($currentDbVersion);
        if ($result) {
            echo "Database has been successfully upgraded to version $newDbVersion \n";
        } else {
            throw new CException("Please fix this error in your database and try again");

which is completely unhelpful.

I need to go into (./application/helpers/update/updatedb_helper.php (and add a few debug prints in order to find out that my current version is previous to the critical database version update 400.

Looking at the code of db_upgrade_all, it seems that on error at the update it is expected to show the error message via Yii::app()->user->setFlash. My guess is that it is not doing anything when run from console.

A second issue would be why it wasn't updated (a misconfiguration in my environment, perhaps) and why it ended up in an inconsistent state, with the old DBVersion but post-400 tables (I suspect that due to mysql forcing a commit after a DDL statement, and thus the final rollback actually not being helpful), but that's likely to be 15806.

c_schmitz

c_schmitz

2020-04-08 13:14

administrator   ~57030

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=29818

lime_release_bot

lime_release_bot

2020-04-14 12:53

administrator   ~57117

Fixed in Release 4.1.17+200414

Related Changesets

LimeSurvey: master 6998921b

2020-04-08 13:14:23

c_schmitz

Details Diff
Fixed issue 15843: Unable to run db migration via command line Affected Issues
15843
mod - application/helpers/update/updatedb_helper.php Diff File

Issue History

Date Modified Username Field Change
2020-02-11 13:57 reinhards New Issue
2020-03-07 01:01 Keisial Issue Monitored: Keisial
2020-03-07 01:02 Keisial Note Added: 56358
2020-03-18 12:55 cdorin Assigned To => cdorin
2020-03-18 12:55 cdorin Status new => confirmed
2020-03-18 12:55 cdorin Priority none => normal
2020-04-08 13:14 c_schmitz Changeset attached => LimeSurvey master 6998921b
2020-04-08 13:14 c_schmitz Note Added: 57030
2020-04-08 13:14 c_schmitz Assigned To cdorin => c_schmitz
2020-04-08 13:14 c_schmitz Resolution open => fixed
2020-04-08 13:15 c_schmitz Status confirmed => resolved
2020-04-08 13:15 c_schmitz Fixed in Version => 4.1.17
2020-04-14 12:53 lime_release_bot Note Added: 57117
2020-04-14 12:53 lime_release_bot Status resolved => closed
2021-08-02 17:18 guest Bug heat 6 => 8