Skip to content

Commit

Permalink
MDL-54771 restore: Add deletesource to course object
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cameorn1730 committed Jul 6, 2016
1 parent ac8d6cf commit 1706352
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions backup/util/ui/restore_ui.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,11 @@ public function execute() {
* 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);
}
}

Expand Down

0 comments on commit 1706352

Please sign in to comment.