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

Detecting restore in notify changed in grade no longer works

    XMLWordPrintable

    Details

    • Affected Branches:
      MOODLE_26_STABLE

      Description

      In grade_grade::notify_changed there is a bit of code to prevent it from being executed during restore. This check no longer works as I think the restore_ui (or similar) class was refactored.

      Not entirely sure how the old code worked before, but moving forward, the solution should not depend on restore_ui class since one can easily restore a course in the code by using the restore_controller and therefore, never use restore_ui or create a $restore global.

      A suggested solution would be to create a class that is capable of being auto-loaded. Have a static property on the class to keep track if restore is running. Toggle that flag on/off in the restore_controller::execute_plan(). Check that property in the grade_grade::notify_changed() to prevent notification during restores. The reason for the autoloading is to reduce the overhead of having to include something like backup/util/includes/restore_includes.php to safely check against the restore_controller directly. We need reduced overhead since this will constantly be checked whenever a grade has changed.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                bushido Mark Nielsen
                Participants:
                Component watchers:
                Adrian Greeve, Mihail Geshoski, Peter Dias, Jake Dallimore, Jun Pataleta, Ryan Wyllie
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: