From 158379e173ee24ff9d8cdce071e7d1e67cd3f9c9 Mon Sep 17 00:00:00 2001 From: Marina Glancy Date: Tue, 25 Feb 2014 17:26:34 +0800 Subject: [PATCH] MDL-40907 events: additional legacy logging for module update/add events" --- course/dnduploadlib.php | 4 ---- course/modlib.php | 8 -------- course/tests/courselib_test.php | 10 ++++++++-- lib/classes/event/course_module_created.php | 6 +++++- lib/classes/event/course_module_updated.php | 6 +++++- 5 files changed, 18 insertions(+), 16 deletions(-) diff --git a/course/dnduploadlib.php b/course/dnduploadlib.php index 62054d9b070..5d146235ce6 100644 --- a/course/dnduploadlib.php +++ b/course/dnduploadlib.php @@ -660,10 +660,6 @@ class dndupload_ajax_processor { )); $event->trigger(); - add_to_log($this->course->id, $mod->modname, "add", - "view.php?id=$mod->id", - "$instanceid", $mod->id); - $this->send_response($mod); } diff --git a/course/modlib.php b/course/modlib.php index ced162c0549..454202e505f 100644 --- a/course/modlib.php +++ b/course/modlib.php @@ -160,10 +160,6 @@ function add_moduleinfo($moduleinfo, $course, $mform = null) { )); $event->trigger(); - add_to_log($course->id, $moduleinfo->modulename, "add", - "view.php?id=$moduleinfo->coursemodule", - "$moduleinfo->instance", $moduleinfo->coursemodule); - $moduleinfo = edit_module_post_actions($moduleinfo, $course); $transaction->allow_commit(); @@ -541,10 +537,6 @@ function update_moduleinfo($cm, $moduleinfo, $course, $mform = null) { )); $event->trigger(); - add_to_log($course->id, $moduleinfo->modulename, "update", - "view.php?id=$moduleinfo->coursemodule", - "$moduleinfo->instance", $moduleinfo->coursemodule); - $moduleinfo = edit_module_post_actions($moduleinfo, $course); return array($cm, $moduleinfo); diff --git a/course/tests/courselib_test.php b/course/tests/courselib_test.php index 2c07bb39c4b..79dd3ef1561 100644 --- a/course/tests/courselib_test.php +++ b/course/tests/courselib_test.php @@ -1943,7 +1943,10 @@ class core_course_courselib_testcase extends advanced_testcase { $eventdata->userid = $USER->id; $this->assertEventLegacyData($eventdata, $event); - $arr = array($cm->course, "course", "add mod", "../mod/assign/view.php?id=$cm->id", "assign $cm->instance"); + $arr = array( + array($cm->course, "course", "add mod", "../mod/assign/view.php?id=$cm->id", "assign $cm->instance"), + array($cm->course, "assign", "add", "view.php?id=$cm->id", $cm->instance, $cm->id) + ); $this->assertEventLegacyLogData($arr, $event); $this->assertEventContextNotUsed($event); @@ -2049,7 +2052,10 @@ class core_course_courselib_testcase extends advanced_testcase { $eventdata->userid = $USER->id; $this->assertEventLegacyData($eventdata, $event); - $arr = array($cm->course, "course", "update mod", "../mod/forum/view.php?id=$cm->id", "forum $cm->instance"); + $arr = array( + array($cm->course, "course", "update mod", "../mod/forum/view.php?id=$cm->id", "forum $cm->instance"), + array($cm->course, "forum", "update", "view.php?id=$cm->id", $cm->instance, $cm->id) + ); $this->assertEventLegacyLogData($arr, $event); $this->assertEventContextNotUsed($event); } diff --git a/lib/classes/event/course_module_created.php b/lib/classes/event/course_module_created.php index 474caee7c5d..c73f7113540 100644 --- a/lib/classes/event/course_module_created.php +++ b/lib/classes/event/course_module_created.php @@ -110,8 +110,12 @@ class course_module_created extends base { * @return array of parameters to be passed to legacy add_to_log() function. */ protected function get_legacy_logdata() { - return array ($this->courseid, "course", "add mod", "../mod/" . $this->other['modulename'] . "/view.php?id=" . + $log1 = array($this->courseid, "course", "add mod", "../mod/" . $this->other['modulename'] . "/view.php?id=" . $this->objectid, $this->other['modulename'] . " " . $this->other['instanceid']); + $log2 = array($this->courseid, $this->other['modulename'], "add", + "view.php?id={$this->objectid}", + "{$this->other['instanceid']}", $this->objectid); + return array($log1, $log2); } /** diff --git a/lib/classes/event/course_module_updated.php b/lib/classes/event/course_module_updated.php index 6ae6752c457..e1069d65c79 100644 --- a/lib/classes/event/course_module_updated.php +++ b/lib/classes/event/course_module_updated.php @@ -110,8 +110,12 @@ class course_module_updated extends base { * @return array of parameters to be passed to legacy add_to_log() function. */ protected function get_legacy_logdata() { - return array ($this->courseid, "course", "update mod", "../mod/" . $this->other['modulename'] . "/view.php?id=" . + $log1 = array($this->courseid, "course", "update mod", "../mod/" . $this->other['modulename'] . "/view.php?id=" . $this->objectid, $this->other['modulename'] . " " . $this->other['instanceid']); + $log2 = array($this->courseid, $this->other['modulename'], "update", + "view.php?id={$this->objectid}", + "{$this->other['instanceid']}", $this->objectid); + return array($log1, $log2); } /**