Moodle
  1. Moodle
  2. MDL-28055

Missing library includes in quiz upgrade from 1.9 to 2.1

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.1
    • Component/s: Quiz
    • Labels:
    • Testing Instructions:
      Hide

      This is actually really hard to test, unless you do have a very old Moodle around. Anyway, this is the correct testing procedure. I must admin that I could not be bothered to do it myself:

      1. Install Moodle 1.4.
      2. Create a quiz, attempt it as a student. Perhaps complete one attempt, and leave another one in mid-attempt.
      3. Upgrade to 1.9, which probably involves going via 1.6 and Unicode upgrade.
      – Keep a backup of this Moodle site in this state, so we can repeat the test if necessary.
      4. Upgrade to 2.1. Verify no errors occur. Verify that when you review the quiz attempts, it all looks OK.

      If there are any problems, go back to the 1.9 backup, and see if the problem was in the upgrade 1.9 -> 2.1 or earlier than that. If it was earlier than that, it will be deeply depressing.

      Alternatively, we could just hope that Henning Bostelmann (who reported the bug) is able to test these changes for us.

      Show
      This is actually really hard to test, unless you do have a very old Moodle around. Anyway, this is the correct testing procedure. I must admin that I could not be bothered to do it myself: 1. Install Moodle 1.4. 2. Create a quiz, attempt it as a student. Perhaps complete one attempt, and leave another one in mid-attempt. 3. Upgrade to 1.9, which probably involves going via 1.6 and Unicode upgrade. – Keep a backup of this Moodle site in this state, so we can repeat the test if necessary. 4. Upgrade to 2.1. Verify no errors occur. Verify that when you review the quiz attempts, it all looks OK. If there are any problems, go back to the 1.9 backup, and see if the problem was in the upgrade 1.9 -> 2.1 or earlier than that. If it was earlier than that, it will be deeply depressing. Alternatively, we could just hope that Henning Bostelmann (who reported the bug) is able to test these changes for us.
    • Affected Branches:
      MOODLE_21_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE
    • Pull from Repository:
    • Pull Master Branch:
    • Rank:
      18037

      Description

      While upgrading a Moodle 1.9 database to Moodle 2.1(beta), during the mod/quiz upgrade, the following error is encountered.

      Fatal error: Call to undefined function quiz_upgrade_very_old_question_sessions() in /home/bostelm/apps/git/mathsmoodle.git/mod/quiz/db/upgrade.php on line 574

      It appears that the script doesn't include upgradelib.php in the same directory. (However, I tried to include this library and this only leads to a different "undefined function" error.)

        Issue Links

          Activity

          Hide
          Henning Bostelmann added a comment -

          Hi Tim,

          I'm currently starting development work on our "local upgrade" from Moodle 1.9 to 2.1, and I'm happy to do the testing using a copy of our live data.

          We're currently running Moodle 1.9, but the Moodle installation is very old and the database has undergone several migration steps before - from 1.6 previously, I'm not sure about the steps before that.

          Show
          Henning Bostelmann added a comment - Hi Tim, I'm currently starting development work on our "local upgrade" from Moodle 1.9 to 2.1, and I'm happy to do the testing using a copy of our live data. We're currently running Moodle 1.9, but the Moodle installation is very old and the database has undergone several migration steps before - from 1.6 previously, I'm not sure about the steps before that.
          Hide
          Tim Hunt added a comment -

          Great. Are you able to get the code changes from https://github.com/timhunt/moodle/compare/master...MDL-28055 and try an upgrade of a copy of your site using those? Thanks.

          Show
          Tim Hunt added a comment - Great. Are you able to get the code changes from https://github.com/timhunt/moodle/compare/master...MDL-28055 and try an upgrade of a copy of your site using those? Thanks.
          Hide
          Henning Bostelmann added a comment -

          I applied the changes, and ran the update routine on my data. The upgrade of the quiz module and of the questions runs now, but produces a lot of error / warning messages. I have copied samples below. Each of these appears in hundreds of copies. (I have left out some messages that are related to a custom question type which I haven't migrated yet.)

          It may be that these messages refer to inconsistencies in our data - posting them here just to be sure.

          Messages seen during "Upgrading very old quiz attempts":


          Notice: Undefined variable: layout in /home/bostelm/apps/git/mathsmoodle.git/mod/quiz/db/upgradelib.php on line 62


          Messages seen during "Upgrading quiz attempts":


          Notice: Undefined variable: question in /home/bostelm/apps/git/mathsmoodle.git/question/engine/upgrade/upgradelib.php on line 213
          Notice: Trying to get property of non-object in /home/bostelm/apps/git/mathsmoodle.git/question/engine/upgrade/upgradelib.php on line 361
          Notice: Trying to get property of non-object in /home/bostelm/apps/git/mathsmoodle.git/question/engine/upgrade/upgradelib.php on line 344
          Notice: Trying to get property of non-object in /home/bostelm/apps/git/mathsmoodle.git/question/engine/upgrade/upgradelib.php on line 346
          Notice: Trying to get property of non-object in /home/bostelm/apps/git/mathsmoodle.git/question/engine/upgrade/behaviourconverters.php on line 266
          Notice: Trying to get property of non-object in /home/bostelm/apps/git/mathsmoodle.git/question/engine/upgrade/behaviourconverters.php on line 268
          Coding error detected, it must be fixed by a programmer: Question type is missing important code (the file /home/bostelm/apps/git/mathsmoodle.git/question/type//db/upgradelib.php) required to run the upgrade to the new question engine.


          Question sessions for questions 36, 37, 79, 80, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 59, 56, 57, 58, 55, 60, 61, 63, 64, 65, 67, 68, 66, 81, 70, 71, 78, 62, 69, 72, 73, 74, 75, 76, 77 were missing when upgrading question usage 15.


          Notice: Uninitialized string offset: 1 in /home/bostelm/apps/git/mathsmoodle.git/question/type/calculated/db/upgradelib.php on line 115 Notice: Uninitialized string offset: 0 in /home/bostelm/apps/git/mathsmoodle.git/question/type/calculated/db/upgradelib.php on line 115

          Show
          Henning Bostelmann added a comment - I applied the changes, and ran the update routine on my data. The upgrade of the quiz module and of the questions runs now, but produces a lot of error / warning messages. I have copied samples below. Each of these appears in hundreds of copies. (I have left out some messages that are related to a custom question type which I haven't migrated yet.) It may be that these messages refer to inconsistencies in our data - posting them here just to be sure. Messages seen during "Upgrading very old quiz attempts": Notice: Undefined variable: layout in /home/bostelm/apps/git/mathsmoodle.git/mod/quiz/db/upgradelib.php on line 62 Messages seen during "Upgrading quiz attempts": Notice: Undefined variable: question in /home/bostelm/apps/git/mathsmoodle.git/question/engine/upgrade/upgradelib.php on line 213 Notice: Trying to get property of non-object in /home/bostelm/apps/git/mathsmoodle.git/question/engine/upgrade/upgradelib.php on line 361 Notice: Trying to get property of non-object in /home/bostelm/apps/git/mathsmoodle.git/question/engine/upgrade/upgradelib.php on line 344 Notice: Trying to get property of non-object in /home/bostelm/apps/git/mathsmoodle.git/question/engine/upgrade/upgradelib.php on line 346 Notice: Trying to get property of non-object in /home/bostelm/apps/git/mathsmoodle.git/question/engine/upgrade/behaviourconverters.php on line 266 Notice: Trying to get property of non-object in /home/bostelm/apps/git/mathsmoodle.git/question/engine/upgrade/behaviourconverters.php on line 268 Coding error detected, it must be fixed by a programmer: Question type is missing important code (the file /home/bostelm/apps/git/mathsmoodle.git/question/type//db/upgradelib.php) required to run the upgrade to the new question engine. Question sessions for questions 36, 37, 79, 80, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 59, 56, 57, 58, 55, 60, 61, 63, 64, 65, 67, 68, 66, 81, 70, 71, 78, 62, 69, 72, 73, 74, 75, 76, 77 were missing when upgrading question usage 15. Notice: Uninitialized string offset: 1 in /home/bostelm/apps/git/mathsmoodle.git/question/type/calculated/db/upgradelib.php on line 115 Notice: Uninitialized string offset: 0 in /home/bostelm/apps/git/mathsmoodle.git/question/type/calculated/db/upgradelib.php on line 115
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Integrated, thanks!

          Surely we must end this by requiring 2.2 to upgrade from 2.1 only or so.

          Show
          Eloy Lafuente (stronk7) added a comment - Integrated, thanks! Surely we must end this by requiring 2.2 to upgrade from 2.1 only or so.
          Hide
          Brent Lee added a comment -

          Eloy: Yes! Require 2.1 for 2.2.

          Show
          Brent Lee added a comment - Eloy: Yes! Require 2.1 for 2.2.
          Hide
          Anthony Borrow added a comment -

          This is a really remote scenario dealing with an upgrade from Moodle 1.4. Due to the rarity of the issue, I will leave any significant testing of this to Henning. Hopefully folks will be upgrading from one major version of Moodle to the next. If Henning runs into any problems he can certainly comment here and let us know but I doubt many others will be affected by this. Peace - Anthony

          Show
          Anthony Borrow added a comment - This is a really remote scenario dealing with an upgrade from Moodle 1.4. Due to the rarity of the issue, I will leave any significant testing of this to Henning. Hopefully folks will be upgrading from one major version of Moodle to the next. If Henning runs into any problems he can certainly comment here and let us know but I doubt many others will be affected by this. Peace - Anthony
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Super!

          Show
          Eloy Lafuente (stronk7) added a comment - Super!

            People

            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: