Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Errors while converting ancient db from 143 to 425

  • martin_49
  • martin_49's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 3 days 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:
Code:
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:
Code:
$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:
Code:
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:
Code:
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
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 3 days 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 answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The following user(s) said Thank You: martin_49
The topic has been locked.
  • martin_49
  • martin_49's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 3 days 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?
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 2 days 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 answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose