Moodle
  1. Moodle
  2. MDL-27636

Add after_restore() to restore_plugin class

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.3
    • Fix Version/s: 2.0.4
    • Component/s: Backup
    • Labels:
      None
    • Testing Instructions:
      Hide
      • Level: Complex, require hacking.
      • Enable debug developer.
      • TEST (20_STABLE enough): Backup and restore one course having quizzes and questions (well known plugin). Both operations must end without problems.
      • Hack question/type/xxxx/backup/moodle2/restore_qtype_xxxx_plugin.class.phpm by adding this method to it:

      public function after_restore_question() {
      print_object('after restore for xxxx called ok');
      }

      (where xxxx is any qtype, no matter if you backup contains questions of that type or no).

      • TEST: Restore the backup file, in the last page, once the file has been restored, you should see, on top this message: "after restore for xxxx called ok". And it should appear only once.
      Show
      Level: Complex, require hacking. Enable debug developer. TEST (20_STABLE enough): Backup and restore one course having quizzes and questions (well known plugin). Both operations must end without problems. Hack question/type/xxxx/backup/moodle2/restore_qtype_xxxx_plugin.class.phpm by adding this method to it: public function after_restore_question() { print_object('after restore for xxxx called ok'); } (where xxxx is any qtype, no matter if you backup contains questions of that type or no). TEST: Restore the backup file, in the last page, once the file has been restored, you should see, on top this message: "after restore for xxxx called ok". And it should appear only once.
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-27636_master
    • Rank:
      17313

      Description

      Gives restore_plugin classes the opportunity to define an after_restore_XXX() method that gets executed after everything has been restored. Patch has been attached and has been tested with a format plugin.

        Activity

        Hide
        Eloy Lafuente (stronk7) added a comment -

        Many thanks Mark!

        If you can imagine some other way to test this, plz, share.

        Ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Many thanks Mark! If you can imagine some other way to test this, plz, share. Ciao
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Note this improvement left out from the after_restore() mechanism both to restore steps and to restore subplugins. Only restore plugins have it for now, and that is on purpose. Rationale:

        • Steps don't seem to need that. Modules are already able to do that using the after_execute() thingy available in the task.
        • Subplugins use to be dependent of some plugin, so they are not likely to need to execute anything at that global scope. after_execute() support should be enough for them.

        Ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Note this improvement left out from the after_restore() mechanism both to restore steps and to restore subplugins. Only restore plugins have it for now, and that is on purpose. Rationale: Steps don't seem to need that. Modules are already able to do that using the after_execute() thingy available in the task. Subplugins use to be dependent of some plugin, so they are not likely to need to execute anything at that global scope. after_execute() support should be enough for them. Ciao
        Hide
        Sam Hemelryk added a comment -

        Thanks Eloy this has been integrated now

        Show
        Sam Hemelryk added a comment - Thanks Eloy this has been integrated now
        Hide
        Michael de Raadt added a comment -

        All good!

        Show
        Michael de Raadt added a comment - All good!
        Hide
        Eloy Lafuente (stronk7) added a comment -

        This is now part of upstream. Many thanks!

        Show
        Eloy Lafuente (stronk7) added a comment - This is now part of upstream. Many thanks!

          People

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

            Dates

            • Created:
              Updated:
              Resolved: