MDL-83479 backup: Add hooks to restore process.
- A hook to enable plugins to add extra settings to the restore task. This would be placed inside restore_root_task::define_settings() - A hook to enable plugins to add extra fields to the copy course form. This would be done inside the copy_form class. - An adjustment to add the restore plan settings to the course restored event data. This would be done inside restore_plan::execute(). - A hook to enable extra work inside the asynchronous copy task. To be placed inside asynchronous_copy_task::execute().
This commit is contained in:
@@ -25,8 +25,11 @@
|
||||
|
||||
namespace core\task;
|
||||
|
||||
use core\di;
|
||||
use async_helper;
|
||||
use cache_helper;
|
||||
use core\hook\manager;
|
||||
use core_backup\hook\before_copy_course_execute;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
@@ -125,6 +128,10 @@ class asynchronous_copy_task extends adhoc_task {
|
||||
$shortname = $plan->get_setting('course_shortname');
|
||||
$shortname->set_value($copyinfo->shortname);
|
||||
|
||||
// Create and dispatch a hook to allow interaction with the task immediately prior to execution.
|
||||
$hook = new before_copy_course_execute($plan, $copyinfo);
|
||||
di::get(manager::class)->dispatch($hook);
|
||||
|
||||
// Do some preflight checks on the restore.
|
||||
$rc->execute_precheck();
|
||||
$status = $rc->get_status();
|
||||
|
||||
Reference in New Issue
Block a user