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

Cannot restore Moodle 2.02 backups containing gradebook categories

XMLWordPrintable

    • PostgreSQL
    • MOODLE_20_STABLE
    • MOODLE_20_STABLE
    • Hide

      Under MOODLE_20_STABLE:

      0) Enable debugging
      1) Restore the attached course backup-moodle2-course-test-20110505-1313-nu.mbz
      2) TEST: The process ends without error (especially the "found more than one record! one).
      3) TEST: Go to the gradebook and check that the "test" and "cat" categories are there, with the "cat" enclosing 1 assignment, and the test enclosing all 3 assignments and course total.

      Show
      Under MOODLE_20_STABLE: 0) Enable debugging 1) Restore the attached course backup-moodle2-course-test-20110505-1313-nu.mbz 2) TEST: The process ends without error (especially the "found more than one record! one). 3) TEST: Go to the gradebook and check that the "test" and "cat" categories are there, with the "cat" enclosing 1 assignment, and the test enclosing all 3 assignments and course total.

      2.0.2+ (Build 20110427)
      PHP 5.2.17.0
      postgres 8.4.5

      Clean system--no sites on it: developer debugging messages turned on.

      1. Create a course site.
      2. Add two assignments.
      3. Add one gradebook category and move one of the assignments into the category.
      4. Back up the course without user data (include activities, blocks, filters). (See the file attached)
      5. Restore the course site

      Two error messages.

      Error: mdb->get_record() found more than one record!
      line 1277 of /lib/dml/moodle_database.php: call to debugging()
      line 1237 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
      line 1217 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
      line 240 of /backup/moodle2/restore_stepslib.php: call to moodle_database->get_record()
      line 131 of /backup/util/plan/restore_structure_step.class.php: call to restore_gradebook_structure_step->process_grade_category()
      line 103 of /backup/util/helper/restore_structure_parser_processor.class.php: call to restore_structure_step->process()
      line 106 of /backup/util/xml/parser/processors/grouped_parser_processor.class.php: call to restore_structure_parser_processor->dispatch_chunk()
      line 91 of /backup/util/helper/restore_structure_parser_processor.class.php: call to grouped_parser_processor->postprocess_chunk()
      line 132 of /backup/util/xml/parser/processors/simplified_parser_processor.class.php: call to restore_structure_parser_processor->postprocess_chunk()
      line 92 of /backup/util/xml/parser/processors/progressive_parser_processor.class.php: call to simplified_parser_processor->process_chunk()
      line 169 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser_processor->receive_chunk()
      line 253 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->publish()
      line ? of unknownfile: call to progressive_parser->end_tag()
      line 158 of /backup/util/xml/parser/progressive_parser.class.php: call to xml_parse()
      line 137 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->parse()
      line 105 of /backup/util/plan/restore_structure_step.class.php: call to progressive_parser->process()
      line 153 of /backup/util/plan/base_task.class.php: call to restore_structure_step->execute()
      line 148 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
      line 157 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
      line 299 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
      line 144 of /backup/util/ui/restore_ui.class.php: call to restore_controller->execute_plan()
      line 39 of /backup/restore.php: call to restore_ui->execute()
      Error: mdb->get_record() found more than one record!
      line 1277 of /lib/dml/moodle_database.php: call to debugging()
      line 1237 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
      line 1217 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
      line 178 of /backup/moodle2/restore_stepslib.php: call to moodle_database->get_record()
      line 131 of /backup/util/plan/restore_structure_step.class.php: call to restore_gradebook_structure_step->process_grade_item()
      line 103 of /backup/util/helper/restore_structure_parser_processor.class.php: call to restore_structure_step->process()
      line 106 of /backup/util/xml/parser/processors/grouped_parser_processor.class.php: call to restore_structure_parser_processor->dispatch_chunk()
      line 91 of /backup/util/helper/restore_structure_parser_processor.class.php: call to grouped_parser_processor->postprocess_chunk()
      line 132 of /backup/util/xml/parser/processors/simplified_parser_processor.class.php: call to restore_structure_parser_processor->postprocess_chunk()
      line 92 of /backup/util/xml/parser/processors/progressive_parser_processor.class.php: call to simplified_parser_processor->process_chunk()
      line 169 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser_processor->receive_chunk()
      line 253 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->publish()
      line ? of unknownfile: call to progressive_parser->end_tag()
      line 158 of /backup/util/xml/parser/progressive_parser.class.php: call to xml_parse()
      line 137 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->parse()
      line 105 of /backup/util/plan/restore_structure_step.class.php: call to progressive_parser->process()
      line 153 of /backup/util/plan/base_task.class.php: call to restore_structure_step->execute()
      line 148 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
      line 157 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
      line 299 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
      line 144 of /backup/util/ui/restore_ui.class.php: call to restore_controller->execute_plan()
      line 39 of /backup/restore.php: call to restore_ui->execute()

      Plus a generic error

      Found more than one record in fetch() !

      Where the problem lives: the gradebook.xml file in the backup that causes this problem has the course entry appear as the second item in the grade_categories node. The corresponding entry in the grade_items also appears in the second position.
      And this sequencing of entries seems to be where the error comes from. The child categories are being read and processed before the parent categories-and as part of the process the as-yet-unread parent categories are generated only to draw the "mdb>get_record() found more than one record!" entry when they are finally parsed from the gradebook.xml file.

      If the gradebook.xml file is manually rewritten to move the parent grade_category and grade_item entries to a position above the child categories that reference them, then the backup file restores without errors. See the "fixed" file, below.

      The scope of this problem is huge: it affects every course site in which a gradebook has a category. And the result of the error message is serious: course sites that draw this error message on restore/import processes can no longer be reset, cannot be deleted, and cannot have their gradebooks seen or altered.

      The original backup file and manually fixed backup file are attached.

            stronk7 Eloy Lafuente (stronk7)
            pfriesen Peter Friesen
            Sam Hemelryk Sam Hemelryk
            David Mudrák (@mudrd8mz) David Mudrák (@mudrd8mz)
            Votes:
            30 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.