Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-31623

Course reset fails when the corresponding table for old modules doesn't exist

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.7, 2.2.4, 2.3.1, 2.4
    • Fix Version/s: 2.2.5, 2.3.2
    • Component/s: Course
    • Database:
      Any
    • Testing Instructions:
      Hide

      Simulate the module table not there :-

      alter table mdl_quiz rename to mdl_quiz_old;

      Run course/reset.php

      Show
      Simulate the module table not there :- alter table mdl_quiz rename to mdl_quiz_old; Run course/reset.php
    • Workaround:
      Hide

      Attached code change for 2.1.2

      Show
      Attached code change for 2.1.2
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Pull Master Branch:
      wip-mdl-31623

      Description

      Course reset fails when the corresponding table for old modules doesn't exist.

      Error reading from database Debug: ERROR: relation "mdl_tlecontribute" does not exist at character 24\nSELECT COUNT('x') FROM mdl_tlecontribute WHERE course = $1\n[array (\n 0 => 127,\n)]

      OR

      Field "course" does not exist in table "quiz"

      I believe this happens if the module doesn't remove the entry in the modules table when it is removed from the system.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              tlock Tim Lock added a comment -

              Patch cleanly applied to Moodle 2.0.7 from Moodle 2.1.2

              Show
              tlock Tim Lock added a comment - Patch cleanly applied to Moodle 2.0.7 from Moodle 2.1.2
              Hide
              salvetore Michael de Raadt added a comment - - edited

              Hi, Tim.

              Thanks for reporting that and providing a solution.

              Do you mean this is hapenning during a reset after a (contributed) module has been uninstalled?

              Show
              salvetore Michael de Raadt added a comment - - edited Hi, Tim. Thanks for reporting that and providing a solution. Do you mean this is hapenning during a reset after a (contributed) module has been uninstalled?
              Hide
              rajeshtaneja Rajesh Taneja added a comment - - edited

              Thanks for the spot-on patch Tim,

              Not sure how a user can get in this situation, but patch make sense. Hence, pushing it for peer review.

              Show
              rajeshtaneja Rajesh Taneja added a comment - - edited Thanks for the spot-on patch Tim, Not sure how a user can get in this situation, but patch make sense. Hence, pushing it for peer review.
              Hide
              fred Frédéric Massart added a comment -

              Hi Raj, as we discussed it I am pushing this for integration, but I would have personally checked if the table exist instead of the plugin file.

              And regarding the issue description, I don't understand how it is possible to miss the 'course' field in the 'quiz' table.

              Show
              fred Frédéric Massart added a comment - Hi Raj, as we discussed it I am pushing this for integration, but I would have personally checked if the table exist instead of the plugin file. And regarding the issue description, I don't understand how it is possible to miss the 'course' field in the 'quiz' table.
              Hide
              rajeshtaneja Rajesh Taneja added a comment -

              Thanks Fred,

              Main reason behind pushing this forward is to avoid db call if not required.
              If we check for table exists, then it's an extra db call for all installed modules, which is expensive.

              Show
              rajeshtaneja Rajesh Taneja added a comment - Thanks Fred, Main reason behind pushing this forward is to avoid db call if not required. If we check for table exists, then it's an extra db call for all installed modules, which is expensive.
              Hide
              stronk7 Eloy Lafuente (stronk7) added a comment -

              The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

              TIA and ciao

              Show
              stronk7 Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
              Hide
              nebgor Aparup Banerjee added a comment -

              Thanks guys, that's been integrated.

              ps: agreed about DB call saving

              Show
              nebgor Aparup Banerjee added a comment - Thanks guys, that's been integrated. ps: agreed about DB call saving
              Hide
              andyjdavis Andrew Davis added a comment -

              I was able to run a course reset without error which I assume is correct...

              Show
              andyjdavis Andrew Davis added a comment - I was able to run a course reset without error which I assume is correct...
              Hide
              stronk7 Eloy Lafuente (stronk7) added a comment -

              I'm so proud...of you, many thanks!

              http://youtu.be/n64CdfDRnZY

              Closing as fixed, ciao

              Show
              stronk7 Eloy Lafuente (stronk7) added a comment - I'm so proud...of you, many thanks! http://youtu.be/n64CdfDRnZY Closing as fixed, ciao

                People

                • Votes:
                  4 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    10/Sep/12