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

Restoring (or importing) blocks with Global Search enabled can lead to fatal error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • 3.4.3
    • 3.4.2, 3.5
    • Backup, Global search
    • MOODLE_34_STABLE, MOODLE_35_STABLE
    • MOODLE_34_STABLE
    • MDL-61913-master
    • Hide
      1. Make sure Global Search is enabled
      2. Create a course, 1
      3. Add the Participants block to course 1
      4. Create a course, 2
      5. Make sure course 2 doesn't have a Participants block in it
      6. In course 2, select import.
      7. Import from course 1, and make sure that you have Include blocks enabled
      8. When the restore completes, confirm course 2 has the Participants block
      9. Again, in course 2, select import
      10. Import from course 1, and make sure that you have Include blocks enabled
      11. Confirm the import complete without error
      12. Confirm there is still only one participants block in course 2.
      Show
      Make sure Global Search is enabled Create a course, 1 Add the Participants block to course 1 Create a course, 2 Make sure course 2 doesn't have a Participants block in it In course 2, select import. Import from course 1, and make sure that you have Include blocks enabled When the restore completes, confirm course 2 has the Participants block Again, in course 2, select import Import from course 1, and make sure that you have Include blocks enabled Confirm the import complete without error Confirm there is still only one participants block in course 2.

      The basic prerequisite is that you have global search configured and enabled.

      If you backup and restore, or import, from a course with blocks, and there are any duplicate blocks that will be skipped, then you will get a fatal error:

      Debug info: SELECT id,parentcontextid FROM {block_instances} WHERE id = ?
      [array (
      0 => 0,
      )]
      Error code: invalidrecord
      ×Stack trace:
      line 1546 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown
      line 1522 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
      line 6920 of /lib/accesslib.php: call to moodle_database->get_record()
      line 5595 of /backup/moodle2/restore_stepslib.php: call to context_block::instance()
      line 34 of /backup/util/plan/restore_execution_step.class.php: call to restore_block_search_index->define_execution()
      line 181 of /backup/util/plan/base_task.class.php: call to restore_execution_step->execute()
      line 178 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
      line 167 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
      line 339 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
      line 224 of /backup/util/ui/restore_ui.class.php: call to restore_controller->execute_plan()
      line 135 of /backup/restore.php: call to restore_ui->execute()
      

      You can recreate this simply by have two courses, 1 and 2. In 1 add the Activities block.
      Now import from 1 to 2 - should work normally.
      Now import from 1 to 2 again, you will get a fatal error like above.

            emerrill Eric Merrill
            emerrill Eric Merrill
            Tim Hunt Tim Hunt
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Mark Nelson Mark Nelson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

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