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

Backup (and restore) without blocks leading to coding error detected

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      1. Go to backup for any course (e.g. the 'XS' test course).
      2. On the first screen, turn off blocks.
      3. Leave other options default and continue through backup.

      EXPECTED: Backup completes successfully.

      4. Log in as an admin.
      5. Browse to a course with several sections and activities in each (does not need to be a monster-course).
      6. Start to produce a back, when you get to the step where you can select what sections/activities to include unselect all but one section and its activities.
      7. Attempt to complete the backup.

      EXPECTED: Backup completes successfully.

      8. To reproduce on restore:
      9. Backup the course above with all default (will complete fine)
      10. Start to restore merging into an existing course.
      11. On the screen where you can select what sections/activities to restore unselect all but one section and its activities.
      12. Complete the restore.

      EXPECTED: Restore completes successfully.

      Show
      1. Go to backup for any course (e.g. the 'XS' test course). 2. On the first screen, turn off blocks. 3. Leave other options default and continue through backup. EXPECTED: Backup completes successfully. 4. Log in as an admin. 5. Browse to a course with several sections and activities in each (does not need to be a monster-course). 6. Start to produce a back, when you get to the step where you can select what sections/activities to include unselect all but one section and its activities. 7. Attempt to complete the backup. EXPECTED: Backup completes successfully. 8. To reproduce on restore: 9. Backup the course above with all default (will complete fine) 10. Start to restore merging into an existing course. 11. On the screen where you can select what sections/activities to restore unselect all but one section and its activities. 12. Complete the restore. EXPECTED: Restore completes successfully.
    • Workaround:
      Hide

      never disable blocks in backup & restore.

      Show
      never disable blocks in backup & restore.
    • Affected Branches:
      MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE
    • Pull Master Branch:
      MDL-41817-master

      Description

      This is a regression introduced by MDL-38190.

      When backup (or restore) controller is instantiated, its overall plan, aka, the list of tasks that will be part of it, is created (see backup_plan_builder::build_plan()).

      Each block in the course/activity being included in that backup has its own, unconditional task.

      Later, the "blocks" setting decides if those tasks are built or no, aka, if steps are added to them or no.

      The newly introduced progress bar assumes that all tasks must have at least 1 step and that's not true for block tasks when the "blocks" setting is disabled.

      To reproduce:

      • Backup any course or activity with the "blocks" setting disabled. No matter it is an interactive backup or no, the process fails with:

      Coding error detected, it must be fixed by a programmer: start_progress() max value cannot be zero or negative
       
      More information about this error
       
      Debug info: 
      Error code: codingerror
      Stack trace:
      line 91 of /backup/util/progress/core_backup_progress.class.php: coding_exception thrown
      line 176 of /backup/util/plan/base_task.class.php: call to core_backup_progress->start_progress()
      line 173 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
      line 120 of /backup/util/plan/backup_plan.class.php: call to base_plan->execute()
      line 349 of /backup/controller/backup_controller.class.php: call to backup_plan->execute()
      line 111 of /backup/util/ui/backup_ui.class.php: call to backup_controller->execute_plan()
      line 108 of /backup/backup.php: call to backup_ui->execute()
      

      That's it. Or we disable that coding check, or delete the "empty" tasks, or make an exception for block ones.

      Ciao

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  18/Nov/13