From dfff77eedd71e8d8394a0c767b4ce19dcf4f71fa Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Tue, 27 Dec 2011 16:10:14 +0100 Subject: [PATCH] MDL-30928 include course and user deletion time in event Credit goes to Luis Gustavo Mueller de Alcantara. --- lib/moodlelib.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index ed054b03583..b18725c7c7d 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -3794,6 +3794,10 @@ function delete_user($user) { $updateuser->timemodified = time(); $DB->update_record('user', $updateuser); + + // We will update the user's timemodified, as it will be passed to the user_deleted event, which + // should know about this updated property persisted to the user's table. + $user->timemodified = $updateuser->timemodified; // notify auth plugin - do not block the delete even when plugin fails $authplugin = get_auth_plugin($user->auth); @@ -4277,6 +4281,11 @@ function delete_course($courseorid, $showfeedback = true) { // delete the course and related context instance delete_context(CONTEXT_COURSE, $courseid); + + // We will update the course's timemodified, as it will be passed to the course_deleted event, + // which should know about this updated property, as this event is meant to pass the full course record + $course->timemodified = time(); + $DB->delete_records("course", array("id"=>$courseid)); //trigger events