MDL-40907 events: additional legacy logging for module update/add events"

This commit is contained in:
Marina Glancy 2014-02-25 17:26:34 +08:00
parent 957944dca8
commit 158379e173
5 changed files with 18 additions and 16 deletions

View File

@ -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);
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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);
}
/**

View File

@ -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);
}
/**