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

Quiz Offline Attempts Makes Backup/Import Features to Crash

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 3.5.5
    • Fix Version/s: None
    • Component/s: Backup, Course, Quiz
    • Labels:
      None
    • Affected Branches:
      MOODLE_35_STABLE

      Description

      Hey guys,

       I'm having this critical issue on Moodle 3.5.5+(Build: 20190328).  After allowing Offline Attempts on Quizzes (a parameter of the Quiz Plugin in this version), it makes the attempts to Backup/Import courses that has some quiz type activity to fail. This parameter serves to allow users to download quizzes to mobile devices through Moodle Mobile and Moodle Desktop apps.

       

      My setup is: Linux Alpine 3.8.4, Apache 2.4.39, PHP 7.2.15, Moodle 3.5.5+(Build: 20190328), Postgresql 9.4.18. I'm using containers (docker + docker-compose), one for apache/moodle and another one for Postgresql.

       

      The error message with the debug mode enabled when you try to create a course backup or to import a course content to an empty course is this one:

       

      Table "quizaccess_offlineattempts" doesn't exist.

      Debug info:
      Error code: ddltablenotexist

      Stack trace:

      • line 665 of /lib/dml/moodle_database.php: dml_exception thrown
      • line 1241 of /lib/dml/moodle_database.php: call to moodle_database->where_clause()
      • line 53 of /backup/util/dbops/backup_structure_dbops.class.php: call to moodle_database->get_recordset()
      • line 359 of /backup/util/structure/backup_nested_element.class.php: call to backup_structure_dbops::get_iterator()
      • line 77 of /backup/util/structure/backup_nested_element.class.php: call to backup_nested_element->get_iterator()
      • line 107 of /backup/util/structure/backup_nested_element.class.php: call to backup_nested_element->process()
      • line 79 of /backup/util/structure/backup_optigroup.class.php: call to backup_nested_element->process()
      • line 107 of /backup/util/structure/backup_nested_element.class.php: call to backup_optigroup->process()
      • line 107 of /backup/util/structure/backup_nested_element.class.php: call to backup_nested_element->process()
      • line 97 of /backup/util/plan/backup_structure_step.class.php: call to backup_nested_element->process()
      • line 181 of /backup/util/plan/base_task.class.php: call to backup_structure_step->execute()
      • line 222 of /backup/moodle2/backup_activity_task.class.php: call to base_task->execute()
      • line 178 of /backup/util/plan/base_plan.class.php: call to backup_activity_task->execute()
      • line 119 of /backup/util/plan/backup_plan.class.php: call to base_plan->execute()
      • line 322 of /backup/controller/backup_controller.class.php: call to backup_plan->execute()
      • line 136 of /backup/util/ui/backup_ui.class.php: call to backup_controller->execute_plan()
      • line 146 of /backup/backup.php: call to backup_ui->execute()

       

      In the database log (postgresql) you find this:

       

      postgresql-2019-05-14_172306.log:ERROR: relation "mdl_quizaccess_offlineattempts" does not exist at character 61
      postgresql-2019-05-14_172306.log:STATEMENT: DECLARE crs139 NO SCROLL CURSOR WITH HOLD FOR SELECT * FROM mdl_quizaccess_offlineattempts WHERE quizid = $1
      postgresql-2019-05-14_172306.log:ERROR: relation "mdl_quizaccess_offlineattempts" does not exist at character 61
      postgresql-2019-05-14_172306.log:STATEMENT: DECLARE crs293 NO SCROLL CURSOR WITH HOLD FOR SELECT * FROM mdl_quizaccess_offlineattempts WHERE quizid = $1

      Inspecting the moodle database indeed there is no table mdl_quizaccess_offlineattemps.

       

      My workaround was to comment all methods inside the following two files:

       

      mod/quiz/accessrule/offlineattempts/backup/moodle2/backup_quizaccess_offlineattempts_subplugin.class.php

      mod/quiz/accessrule/offlineattempts/backup/moodle2/restore_quizaccess_offlineattempts_subplugin.class.php

       

      By doing that, I could create course backups and import course contents again. Of course I think this is just a workaround.  As far as I could tell, everything was still working after restoring the backup (quiz offline attempts was still active), however a permanent fix  is required otherwise users won't be able to use quiz offline attemps with this moodle version.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jtyska Jonata Tyska
              Participants:
              Component watchers:
              Adrian Greeve, Mihail Geshoski, Peter Dias, Amaia Anabitarte, Bas Brands, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón, Tim Hunt, Andrew Nicols, Mathew May, Michael Hawkins, Shamim Rezaie, Simey Lameze
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: