mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
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:
parent
ac8d6cff54
commit
1706352d01
@ -231,9 +231,11 @@ class restore_ui extends base_ui {
|
|||||||
* Delete course which is created by restore process
|
* Delete course which is created by restore process
|
||||||
*/
|
*/
|
||||||
public function cleanup() {
|
public function cleanup() {
|
||||||
|
global $DB;
|
||||||
$courseid = $this->controller->get_courseid();
|
$courseid = $this->controller->get_courseid();
|
||||||
if ($this->is_temporary_course_created($courseid)) {
|
if ($this->is_temporary_course_created($courseid) && $course = $DB->get_record('course', array('id' => $courseid))) {
|
||||||
delete_course($courseid, false);
|
$course->deletesource = 'restore';
|
||||||
|
delete_course($course, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user