Errors while converting ancient db from 143 to 425

More
2 weeks 1 day ago #195822 by martin_49
Hey guys,

so I have taken on the challenge to finally upgrade an ancient LimeSurvey installation from version 1.90+ Build 9118 to the most recent one (v4.1.13). This means a db upgrade from 143 to 425.

As I feared not everything went by smoothly.

First problems encountered:
mymachine:/srv/www/htdocs # php application/commands/console.php updatedb
Update mysql:host=localhost;port=3306;dbname=limesurvey; with prefix :lime_ from 143 to 425
Error: Call to undefined function dbExecuteAssoc() in /srv/www/htdocs/application/helpers/update/updatedb_helper.php:4427
Stack trace:
#0 /srv/www/htdocs/application/helpers/update/updatedb_helper.php(364): upgradeSurveys145()
#1 /srv/www/htdocs/application/commands/UpdateDbCommand.php(44): db_upgrade_all(143)
#2 /srv/www/htdocs/framework/console/CConsoleCommandRunner.php(71): UpdateDBCommand->run(Array)
#3 /srv/www/htdocs/framework/console/CConsoleApplication.php(92): CConsoleCommandRunner->run(Array)
#4 /srv/www/htdocs/framework/base/CApplication.php(185): CConsoleApplication->processRequest()
#5 /srv/www/htdocs/application/commands/console.php(64): CApplication->run()

I could solve this by fixing a few SQL queries in the source file:
vim /srv/www/htdocs/application/helpers/update/updatedb_helper.php


There were a few occurences of dbExecuteAssoc() which seem to have been replaced everywhere else by something along the lines of: Yii::app()->getDb()->createCommand($sSurveyQuery)->queryAll();

So I have replaced a few occurences in the source with things like that:
$oSurveyResult = Yii::app()->getDb()->createCommand($sSurveyQuery)->queryAll();
    //$oSurveyResult = dbExecuteAssoc($sSurveyQuery);
    foreach ( $oSurveyResult as $aSurveyRow )

See affected functions:
upgradeSurveys145(), upgradeQuestionAttributes148()
which may have to be fixed. Or just search the code for occurences of "dbExecuteAssoc".


Alright, with that fixed I reset the db to the old backup and restarted again:
mymachine:/srv/www/htdocs # php application/commands/console.php updatedb
Update mysql:host=localhost;port=3306;dbname=limesurvey; with prefix :lime_ from 143 to 425
PHP Error[2]: include(LimeExpressionManager.php): failed to open stream: No such file or directory
    in file /srv/www/htdocs/framework/YiiBase.php at line 463
#0 /srv/www/htdocs/framework/YiiBase.php(463): include()
#1 unknown(0): autoload()
#2 /srv/www/htdocs/application/helpers/update/updatedb_helper.php(948): spl_autoload_call()
#3 /srv/www/htdocs/application/commands/UpdateDbCommand.php(44): db_upgrade_all()
#4 /srv/www/htdocs/framework/console/CConsoleCommandRunner.php(71): UpdateDBCommand->run()
#5 /srv/www/htdocs/framework/console/CConsoleApplication.php(92): CConsoleCommandRunner->run()
#6 /srv/www/htdocs/framework/base/CApplication.php(185): ConsoleApplication->processRequest()
#7 /srv/www/htdocs/application/commands/console.php(64): ConsoleApplication->run()

Taking a closer look:

vim /srv/www/htdocs/application/helpers/update/updatedb_helper.php

Around line 948:
if ($iOldDBVersion < 158)
        {
            $oTransaction = $oDB->beginTransaction();
            LimeExpressionManager::UpgradeConditionsToRelevance();
            $oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>158),"stg_name='DBVersion'");
            $oTransaction->commit();
        }


This is where it seems to break apart:

It seems to invoke LimeExpressionManager.php, which I can not find anywhere...

That's as far as I have come. Can you guys help out in any way?

Thank you very much in advance!

Best regards
Martin

Please Log in or Create an account to join the conversation.

LimeSurvey Partners
More
2 weeks 1 day ago #195836 by holch
There have been too many versions in between for this to work smoothly, I guess.

What I would do is to upgrade from 1.9 to 2.x then 3.x and then stay there for now. I personally would not use LS 4.x for productive use yet, only for testing.

Maybe someone of the developers has a better idea, but I doubt that anyone has tested an upgrade over 3 major releases.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds
The following user(s) said Thank You: martin_49

Please Log in or Create an account to join the conversation.

More
2 weeks 17 hours ago #195847 by martin_49
Thank you so much for your reply!

I have followed up on your advice and tried to go from 1.9 to version 3.22.10+200323 -- it has worked perfectly on the first attempt!

So is it the best approach to leave it at LTS 3.22.10 for the time being instead of heading directly to 4.1.13? When would you propose a migration? As soon as 4.x is considered LTS?

Please Log in or Create an account to join the conversation.

More
2 weeks 12 hours ago #195860 by holch

I have followed up on your advice and tried to go from 1.9 to version 3.22.10+200323 -- it has worked perfectly on the first attempt!

Great, easier than I thought then.

So is it the best approach to leave it at LTS 3.22.10 for the time being instead of heading directly to 4.1.13? When would you propose a migration? As soon as 4.x is considered LTS?

At the moment I personally see too many bugs poping up for 4.x being usable in production yet. Unfortunately there are not enough people testing 4.x to eliminate the bugs. So please, stay at 3.x LTS for your productive environment, but have 4.x installed for testing and bug reporting. You can help the community to find and eliminate the existing bugs, which will help to improve 4.x quickly.
You will not need to wait until 4.x becomes LTS, because this will probably mean that LS 5.x has been released. But give it a couple of weeks / months before you use it in production. This is just my personal opinion. I am not part of the development team, just a voluntary helping out in the forum.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!