MDL-56251 backup: trigger course_section_created/updated events

This commit is contained in:
Mark Nelson 2017-05-02 13:26:39 +08:00
parent 7aa3925c9a
commit b0f0200e4f

View File

@ -1593,6 +1593,10 @@ class restore_section_structure_step extends restore_structure_step {
}
}
$newitemid = $DB->insert_record('course_sections', $section);
$section->id = $newitemid;
core\event\course_section_created::create_from_section($section)->trigger();
$restorefiles = true;
// Section exists, update non-empty information
@ -1612,6 +1616,17 @@ class restore_section_structure_step extends restore_structure_step {
$DB->update_record('course_sections', $section);
$newitemid = $secrec->id;
// Trigger an event for course section update.
$event = \core\event\course_section_updated::create(
array(
'objectid' => $section->id,
'courseid' => $section->course,
'context' => context_course::instance($section->course),
'other' => array('sectionnum' => $section->section)
)
);
$event->trigger();
}
// Annotate the section mapping, with restorefiles option if needed