MDL-54771 restore: Add deletesource to course object
Since deleting a course now triggers the pre_course_delete hook it may be useful for hook implementations to know whether it was a "true" course deletion, or one originating from a temporary course created during a restore.
This commit is contained in:
@@ -231,9 +231,11 @@ class restore_ui extends base_ui {
|
||||
* Delete course which is created by restore process
|
||||
*/
|
||||
public function cleanup() {
|
||||
global $DB;
|
||||
$courseid = $this->controller->get_courseid();
|
||||
if ($this->is_temporary_course_created($courseid)) {
|
||||
delete_course($courseid, false);
|
||||
if ($this->is_temporary_course_created($courseid) && $course = $DB->get_record('course', array('id' => $courseid))) {
|
||||
$course->deletesource = 'restore';
|
||||
delete_course($course, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user