MDL-52805 core: Remove legacy log calls

This commit is contained in:
Mathew May 2023-01-11 17:11:57 +08:00
parent fce2e17633
commit e5ca7766e7
296 changed files with 2 additions and 4382 deletions

View File

@ -36,10 +36,6 @@ class preset_deleted extends base {
return "User {$this->userid} has deleted the preset with id {$this->objectid}.";
}
public function get_legacy_logdata(): array {
return [$this->courseid, 'tool_admin_presets', 'delete', '', $this->objectid, $this->contextinstanceid];
}
protected function init(): void {
$this->data['crud'] = 'd';
$this->data['edulevel'] = self::LEVEL_OTHER;

View File

@ -41,10 +41,6 @@ class preset_exported extends base {
['action' => 'load', 'mode' => 'preview', 'id' => $this->objectid]);
}
public function get_legacy_logdata(): array {
return [$this->courseid, 'tool_admin_presets', 'export', '', $this->objectid, $this->contextinstanceid];
}
protected function init(): void {
$this->data['crud'] = 'c';
$this->data['edulevel'] = self::LEVEL_OTHER;

View File

@ -41,10 +41,6 @@ class preset_imported extends base {
['action' => 'load', 'mode' => 'preview', 'id' => $this->objectid]);
}
public function get_legacy_logdata(): array {
return [$this->courseid, 'tool_admin_presets', 'import', '', $this->objectid, $this->contextinstanceid];
}
protected function init(): void {
$this->data['crud'] = 'c';
$this->data['edulevel'] = self::LEVEL_OTHER;

View File

@ -41,10 +41,6 @@ class preset_loaded extends base {
['action' => 'load', 'mode' => 'preview', 'id' => $this->objectid]);
}
public function get_legacy_logdata(): array {
return [$this->courseid, 'tool_admin_presets', 'load', '', $this->objectid, $this->contextinstanceid];
}
protected function init(): void {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_OTHER;

View File

@ -36,10 +36,6 @@ class preset_reverted extends base {
return "User {$this->userid} has reverted the preset with id {$this->objectid}.";
}
public function get_legacy_logdata(): array {
return [$this->courseid, 'tool_admin_presets', 'rollback', '', $this->objectid, $this->contextinstanceid];
}
protected function init(): void {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_OTHER;

View File

@ -40,10 +40,6 @@ class presets_listed extends base {
return new \moodle_url('/admin/tool/admin_presets/index.php');
}
public function get_legacy_logdata(): array {
return [$this->courseid, 'tool_admin_presets', 'base', '', $this->objectid, $this->contextinstanceid];
}
protected function init(): void {
$this->data['crud'] = 'r';
$this->data['edulevel'] = self::LEVEL_OTHER;

View File

@ -55,7 +55,5 @@ class preset_deleted_test extends \advanced_testcase {
$this->assertInstanceOf('\tool_admin_presets\event\preset_deleted', $event);
$this->assertEquals(\context_system::instance(), $event->get_context());
$this->assertEquals($presetid, $event->objectid);
$expected = [0, 'tool_admin_presets', 'delete', '', $presetid, 0];
$this->assertEventLegacyLogData($expected, $event);
}
}

View File

@ -55,7 +55,5 @@ class preset_exported_test extends \advanced_testcase {
$this->assertInstanceOf('\tool_admin_presets\event\preset_exported', $event);
$this->assertEquals(\context_system::instance(), $event->get_context());
$this->assertEquals($presetid, $event->objectid);
$expected = [0, 'tool_admin_presets', 'export', '', $presetid, 0];
$this->assertEventLegacyLogData($expected, $event);
}
}

View File

@ -55,7 +55,5 @@ class preset_imported_test extends \advanced_testcase {
$this->assertInstanceOf('\tool_admin_presets\event\preset_imported', $event);
$this->assertEquals(\context_system::instance(), $event->get_context());
$this->assertEquals($presetid, $event->objectid);
$expected = [0, 'tool_admin_presets', 'import', '', $presetid, 0];
$this->assertEventLegacyLogData($expected, $event);
}
}

View File

@ -55,7 +55,5 @@ class preset_loaded_test extends \advanced_testcase {
$this->assertInstanceOf('\tool_admin_presets\event\preset_loaded', $event);
$this->assertEquals(\context_system::instance(), $event->get_context());
$this->assertEquals($presetid, $event->objectid);
$expected = [0, 'tool_admin_presets', 'load', '', $presetid, 0];
$this->assertEventLegacyLogData($expected, $event);
}
}

View File

@ -55,7 +55,5 @@ class preset_reverted_test extends \advanced_testcase {
$this->assertInstanceOf('\tool_admin_presets\event\preset_reverted', $event);
$this->assertEquals(\context_system::instance(), $event->get_context());
$this->assertEquals($presetid, $event->objectid);
$expected = [0, 'tool_admin_presets', 'rollback', '', $presetid, 0];
$this->assertEventLegacyLogData($expected, $event);
}
}

View File

@ -55,7 +55,5 @@ class presets_listed_test extends \advanced_testcase {
$this->assertInstanceOf('\tool_admin_presets\event\presets_listed', $event);
$this->assertEquals(\context_system::instance(), $event->get_context());
$this->assertEquals($presetid, $event->objectid);
$expected = [0, 'tool_admin_presets', 'base', '', $presetid, 0];
$this->assertEventLegacyLogData($expected, $event);
}
}

View File

@ -62,15 +62,6 @@ class report_viewed extends \core\event\base {
return "The user with id '$this->userid' viewed the capability overview report.";
}
/**
* Return the legacy event log data.
*
* @return array
*/
protected function get_legacy_logdata() {
return array(SITEID, 'admin', 'tool capability', 'tool/capability/index.php');
}
/**
* Returns relevant URL.
*

View File

@ -55,8 +55,6 @@ class events_test extends \advanced_testcase {
$this->assertInstanceOf('\tool_capability\event\report_viewed', $event);
$this->assertEquals(\context_system::instance(), $event->get_context());
$expected = array(SITEID, "admin", "tool capability", "tool/capability/index.php");
$this->assertEventLegacyLogData($expected, $event);
$this->assertEventContextNotUsed($event);
$url = new \moodle_url('/admin/tool/capability/index.php');
$this->assertEquals($url, $event->get_url());

View File

@ -44,21 +44,4 @@ class unittest_executed extends \core\event\base {
public function get_url() {
return new \moodle_url('/somepath/somefile.php', array('id' => $this->data['other']['sample']));
}
public static function get_legacy_eventname() {
return 'test_legacy';
}
protected function get_legacy_eventdata() {
return array($this->data['courseid'], $this->data['other']['sample']);
}
protected function get_legacy_logdata() {
$cmid = 0;
if ($this->contextlevel == CONTEXT_MODULE) {
$cmid = $this->contextinstanceid;
}
return array($this->data['courseid'], 'core_unittest', 'view',
'unittest.php?id=' . $this->data['other']['sample'], 'bbb', $cmid);
}
}

View File

@ -379,9 +379,6 @@ class plugin_test extends \advanced_testcase {
$this->assertEquals('user', $event->objecttable);
$this->assertEquals('2', $event->objectid);
$this->assertEquals(\context_system::instance()->id, $event->contextid);
$expectedlog = array(SITEID, 'user', 'login', 'view.php?id=' . $USER->id . '&course=' . SITEID, $user->id,
0, $user->id);
$this->assertEventLegacyLogData($expectedlog, $event);
}
/**
@ -508,10 +505,7 @@ class plugin_test extends \advanced_testcase {
$event = array_pop($events);
$this->assertInstanceOf('\core\event\user_created', $event);
$this->assertEquals($user['id'], $event->objectid);
$this->assertEquals('user_created', $event->get_legacy_eventname());
$this->assertEquals(\context_user::instance($user['id']), $event->get_context());
$expectedlogdata = array(SITEID, 'user', 'add', '/view.php?id='.$event->objectid, fullname($dbuser));
$this->assertEventLegacyLogData($expectedlogdata, $event);
// First event is user_password_updated.
$event = array_pop($events);

View File

@ -137,10 +137,6 @@ class events_test extends \advanced_testcase {
$this->assertEquals($USER->id, $event->userid);
$this->assertEquals($this->userid, $event->relateduserid);
$this->assertEquals("post", $event->objecttable);
$arr = array(SITEID, 'blog', 'add', 'index.php?userid=' . $this->userid . '&entryid=' . $blog->id, $blog->subject);
$this->assertEventLegacyLogData($arr, $event);
$this->assertEquals("blog_entry_added", $event->get_legacy_eventname());
$this->assertEventLegacyData($blog, $event);
$this->assertEventContextNotUsed($event);
}
@ -172,10 +168,6 @@ class events_test extends \advanced_testcase {
$this->assertEquals($USER->id, $event->userid);
$this->assertEquals($this->userid, $event->relateduserid);
$this->assertEquals("post", $event->objecttable);
$this->assertEquals("blog_entry_edited", $event->get_legacy_eventname());
$this->assertEventLegacyData($blog, $event);
$arr = array (SITEID, 'blog', 'update', 'index.php?userid=' . $this->userid . '&entryid=' . $blog->id, $blog->subject);
$this->assertEventLegacyLogData($arr, $event);
$this->assertEventContextNotUsed($event);
}
@ -207,11 +199,6 @@ class events_test extends \advanced_testcase {
$this->assertEquals($this->userid, $event->relateduserid);
$this->assertEquals("post", $event->objecttable);
$this->assertEquals($record, $event->get_record_snapshot("post", $blog->id));
$this->assertSame('blog_entry_deleted', $event->get_legacy_eventname());
$arr = array(SITEID, 'blog', 'delete', 'index.php?userid=' . $blog->userid, 'deleted blog entry with entry id# ' .
$blog->id);
$this->assertEventLegacyLogData($arr, $event);
$this->assertEventLegacyData($blog, $event);
$this->assertEventContextNotUsed($event);
}
@ -292,9 +279,6 @@ class events_test extends \advanced_testcase {
$this->assertEquals($USER->id, $event->userid);
$this->assertEquals($this->userid, $event->relateduserid);
$this->assertEquals('blog_association', $event->objecttable);
$arr = array(SITEID, 'blog', 'add association', 'index.php?userid=' . $this->userid . '&entryid=' . $blog->id,
$blog->subject, 0, $this->userid);
$this->assertEventLegacyLogData($arr, $event);
// Add blog associations with a module.
$blog = new \blog_entry($this->postid);
@ -308,9 +292,6 @@ class events_test extends \advanced_testcase {
$this->assertEquals($blog->id, $event->other['blogid']);
$this->assertEquals($this->cmid, $event->other['associateid']);
$this->assertEquals('coursemodule', $event->other['associatetype']);
$arr = array(SITEID, 'blog', 'add association', 'index.php?userid=' . $this->userid . '&entryid=' . $blog->id,
$blog->subject, $this->cmid, $this->userid);
$this->assertEventLegacyLogData($arr, $event);
$this->assertEventContextNotUsed($event);
}
@ -393,10 +374,7 @@ class events_test extends \advanced_testcase {
// Validate event data.
$url = new \moodle_url('/blog/index.php', $other);
$url2 = new \moodle_url('index.php', $other);
$this->assertEquals($url, $event->get_url());
$arr = array(SITEID, 'blog', 'view', $url2->out(), 'view blog entry');
$this->assertEventLegacyLogData($arr, $event);
$this->assertEventContextNotUsed($event);
}

View File

@ -87,10 +87,8 @@ class events_test extends \advanced_testcase {
$this->assertEquals('event', $event->objecttable);
$this->assertEquals(0, $event->courseid);
$this->assertEquals($calevent->context, $event->get_context());
$expectedlog = array(0, 'calendar', 'add', 'event.php?action=edit&id=' . $calevent->id , $calevent->name);
$other = array('repeatid' => 0, 'timestart' => $time, 'name' => 'event');
$this->assertEquals($other, $event->other);
$this->assertEventLegacyLogData($expectedlog, $event);
$this->assertEventContextNotUsed($event);
// Now we create a repeated course event.
@ -194,8 +192,6 @@ class events_test extends \advanced_testcase {
$this->assertEquals('event', $event->objecttable);
$this->assertEquals(0, $event->courseid);
$this->assertEquals($calevent->context, $event->get_context());
$expectedlog = array(0, 'calendar', 'edit', 'event.php?action=edit&id=' . $calevent->id , $calevent->name);
$this->assertEventLegacyLogData($expectedlog, $event);
$other = array('repeatid' => 0, 'timestart' => $time, 'name' => 'new event');
$this->assertEquals($other, $event->other);
$this->assertEventContextNotUsed($event);
@ -249,8 +245,6 @@ class events_test extends \advanced_testcase {
$this->assertEquals('event', $event->objecttable);
$this->assertEquals($siteid, $event->courseid);
$this->assertEquals($calevent->context, $event->get_context());
$expectedlog = [$siteid, 'calendar', 'edit', 'event.php?action=edit&id=' . $calevent->id , $calevent->name];
$this->assertEventLegacyLogData($expectedlog, $event);
$other = array('repeatid' => 0, 'timestart' => $time, 'name' => 'Some wickedly awesome event yo!');
$this->assertEquals($other, $event->other);
$this->assertEventContextNotUsed($event);

View File

@ -102,7 +102,6 @@ class lib_test extends \advanced_testcase {
$url = new \moodle_url('/cohort/index.php', array('contextid' => $event->contextid));
$this->assertEquals($url, $event->get_url());
$this->assertEquals($cohort, $event->get_record_snapshot('cohort', $id));
$this->assertEventLegacyData($cohort, $event);
$this->assertEventContextNotUsed($event);
}
@ -179,7 +178,6 @@ class lib_test extends \advanced_testcase {
$url = new \moodle_url('/cohort/edit.php', array('id' => $event->objectid));
$this->assertEquals($url, $event->get_url());
$this->assertEquals($cohort, $event->get_record_snapshot('cohort', $id));
$this->assertEventLegacyData($cohort, $event);
$this->assertEventContextNotUsed($event);
}
@ -219,7 +217,6 @@ class lib_test extends \advanced_testcase {
$url = new \moodle_url('/cohort/index.php', array('contextid' => $event->contextid));
$this->assertEquals($url, $event->get_url());
$this->assertEquals($cohort, $event->get_record_snapshot('cohort', $cohort->id));
$this->assertEventLegacyData($cohort, $event);
$this->assertEventContextNotUsed($event);
}
@ -279,7 +276,6 @@ class lib_test extends \advanced_testcase {
$this->assertEquals($USER->id, $event->userid);
$url = new \moodle_url('/cohort/assign.php', array('id' => $event->objectid));
$this->assertEquals($url, $event->get_url());
$this->assertEventLegacyData((object) array('cohortid' => $cohort->id, 'userid' => $user->id), $event);
$this->assertEventContextNotUsed($event);
}
@ -325,7 +321,6 @@ class lib_test extends \advanced_testcase {
$this->assertEquals($USER->id, $event->userid);
$url = new \moodle_url('/cohort/assign.php', array('id' => $event->objectid));
$this->assertEquals($url, $event->get_url());
$this->assertEventLegacyData((object) array('cohortid' => $cohort->id, 'userid' => $user->id), $event);
$this->assertEventContextNotUsed($event);
}

View File

@ -2179,8 +2179,6 @@ class core_course_category implements renderable, cacheable_object, IteratorAggr
'objectid' => $childcat->id,
'context' => $childcat->get_context()
));
$event->set_legacy_logdata(array(SITEID, 'category', 'move', 'editcategory.php?id=' . $childcat->id,
$childcat->id));
$event->trigger();
}
fix_course_sortorder();
@ -2371,7 +2369,6 @@ class core_course_category implements renderable, cacheable_object, IteratorAggr
'objectid' => $this->id,
'context' => $this->get_context()
));
$event->set_legacy_logdata(array(SITEID, 'category', 'move', 'editcategory.php?id=' . $this->id, $this->id));
$event->trigger();
}
}
@ -2443,7 +2440,6 @@ class core_course_category implements renderable, cacheable_object, IteratorAggr
'objectid' => $this->id,
'context' => $this->get_context()
));
$event->set_legacy_logdata(array(SITEID, 'category', 'hide', 'editcategory.php?id=' . $this->id, $this->id));
$event->trigger();
}
}
@ -2502,7 +2498,6 @@ class core_course_category implements renderable, cacheable_object, IteratorAggr
'objectid' => $this->id,
'context' => $this->get_context()
));
$event->set_legacy_logdata(array(SITEID, 'category', 'show', 'editcategory.php?id=' . $this->id, $this->id));
$event->trigger();
}
}
@ -3066,8 +3061,6 @@ class core_course_category implements renderable, cacheable_object, IteratorAggr
'objectid' => $this->id,
'context' => $this->get_context()
));
$event->set_legacy_logdata(array(SITEID, 'category', 'move', 'management.php?categoryid=' . $this->id,
$this->id));
$event->trigger();
// Finally reorder courses.

View File

@ -2024,7 +2024,6 @@ function move_courses($courseids, $categoryid) {
'fullname' => $dbcourse->fullname,
'updatedfields' => array('category' => $category->id))
));
$event->set_legacy_logdata(array($course->id, 'course', 'move', 'edit.php?id=' . $course->id, $course->id));
$event->trigger();
}
fix_course_sortorder();
@ -2490,7 +2489,6 @@ function update_course($data, $editoroptions = NULL) {
'updatedfields' => $updatedfields)
));
$event->set_legacy_logdata(array($course->id, 'course', 'update', 'edit.php?id=' . $course->id, $course->id));
$event->trigger();
if ($oldcourse->format !== $course->format) {

View File

@ -51,7 +51,6 @@ foreach ($allmodules as $key=>$module) {
// Triger view event.
$event = \core\event\course_resources_list_viewed::create(array('context' => context_course::instance($course->id)));
$event->set_legacy_logdata($availableresources);
$event->add_record_snapshot('course', $course);
$event->trigger();

View File

@ -1867,10 +1867,6 @@ class courselib_test extends advanced_testcase {
$this->assertEquals($course->id, $event->objectid);
$this->assertEquals(context_course::instance($course->id), $event->get_context());
$this->assertEquals($course, $event->get_record_snapshot('course', $course->id));
$this->assertEquals('course_created', $event->get_legacy_eventname());
$this->assertEventLegacyData($course, $event);
$expectedlog = array(SITEID, 'course', 'new', 'view.php?id=' . $course->id, $course->fullname . ' (ID ' . $course->id . ')');
$this->assertEventLegacyLogData($expectedlog, $event);
// Now we want to trigger creating a course via the imsenterprise.
// Delete the course we created earlier, as we want the imsenterprise plugin to create this.
@ -1941,10 +1937,6 @@ class courselib_test extends advanced_testcase {
$url = new moodle_url('/course/edit.php', array('id' => $event->objectid));
$this->assertEquals($url, $event->get_url());
$this->assertEquals($updatedcourse, $event->get_record_snapshot('course', $event->objectid));
$this->assertEquals('course_updated', $event->get_legacy_eventname());
$this->assertEventLegacyData($updatedcourse, $event);
$expectedlog = array($updatedcourse->id, 'course', 'update', 'edit.php?id=' . $course->id, $course->id);
$this->assertEventLegacyLogData($expectedlog, $event);
// Move course and catch course_updated event.
$sink = $this->redirectEvents();
@ -1961,10 +1953,6 @@ class courselib_test extends advanced_testcase {
$this->assertEquals($movedcourse->id, $event->objectid);
$this->assertEquals(context_course::instance($course->id), $event->get_context());
$this->assertEquals($movedcourse, $event->get_record_snapshot('course', $movedcourse->id));
$this->assertEquals('course_updated', $event->get_legacy_eventname());
$this->assertEventLegacyData($movedcourse, $event);
$expectedlog = array($movedcourse->id, 'course', 'move', 'edit.php?id=' . $movedcourse->id, $movedcourse->id);
$this->assertEventLegacyLogData($expectedlog, $event);
// Move course to hidden category and catch course_updated event.
$sink = $this->redirectEvents();
@ -1981,10 +1969,6 @@ class courselib_test extends advanced_testcase {
$this->assertEquals($movedcoursehidden->id, $event->objectid);
$this->assertEquals(context_course::instance($course->id), $event->get_context());
$this->assertEquals($movedcoursehidden, $event->get_record_snapshot('course', $movedcoursehidden->id));
$this->assertEquals('course_updated', $event->get_legacy_eventname());
$this->assertEventLegacyData($movedcoursehidden, $event);
$expectedlog = array($movedcoursehidden->id, 'course', 'move', 'edit.php?id=' . $movedcoursehidden->id, $movedcoursehidden->id);
$this->assertEventLegacyLogData($expectedlog, $event);
$this->assertEventContextNotUsed($event);
}
@ -2054,21 +2038,11 @@ class courselib_test extends advanced_testcase {
$this->assertEquals($course->id, $event->objectid);
$this->assertEquals($coursecontext->id, $event->contextid);
$this->assertEquals($course, $event->get_record_snapshot('course', $course->id));
$this->assertEquals('course_deleted', $event->get_legacy_eventname());
$eventdata = $event->get_data();
$this->assertSame($course->idnumber, $eventdata['other']['idnumber']);
$this->assertSame($course->fullname, $eventdata['other']['fullname']);
$this->assertSame($course->shortname, $eventdata['other']['shortname']);
// The legacy data also passed the context in the course object and substitutes timemodified with the current date.
$expectedlegacy = clone($course);
$expectedlegacy->context = $coursecontext;
$expectedlegacy->timemodified = $event->timecreated;
$this->assertEventLegacyData($expectedlegacy, $event);
// Validate legacy log data.
$expectedlog = array(SITEID, 'course', 'delete', 'view.php?id=' . $course->id, $course->fullname . '(ID ' . $course->id . ')');
$this->assertEventLegacyLogData($expectedlog, $event);
$this->assertEventContextNotUsed($event);
}
@ -2106,11 +2080,6 @@ class courselib_test extends advanced_testcase {
$this->assertEquals($course->id, $event->objectid);
$this->assertEquals($coursecontext->id, $event->contextid);
$this->assertEquals($course, $event->get_record_snapshot('course', $course->id));
$this->assertEquals('course_content_removed', $event->get_legacy_eventname());
// The legacy data also passed the context and options in the course object.
$course->context = $coursecontext;
$course->options = array();
$this->assertEventLegacyData($course, $event);
$this->assertEventContextNotUsed($event);
}
@ -2147,11 +2116,7 @@ class courselib_test extends advanced_testcase {
'name' => $category->name,
], $event->other);
$this->assertEquals($categoryrecord, $event->get_record_snapshot($event->objecttable, $event->objectid));
$this->assertEquals('course_category_deleted', $event->get_legacy_eventname());
$this->assertEquals(null, $event->get_url());
$this->assertEventLegacyData($category, $event);
$expectedlog = array(SITEID, 'category', 'delete', 'index.php', $category->name . '(ID ' . $category->id . ')');
$this->assertEventLegacyLogData($expectedlog, $event);
// Create two categories.
$category = $this->getDataGenerator()->create_category();
@ -2182,10 +2147,6 @@ class courselib_test extends advanced_testcase {
'contentmovedcategoryid' => $category->id,
], $event->other);
$this->assertEquals($category2record, $event->get_record_snapshot($event->objecttable, $event->objectid));
$this->assertEquals('course_category_deleted', $event->get_legacy_eventname());
$this->assertEventLegacyData($category2, $event);
$expectedlog = array(SITEID, 'category', 'delete', 'index.php', $category2->name . '(ID ' . $category2->id . ')');
$this->assertEventLegacyLogData($expectedlog, $event);
$this->assertEventContextNotUsed($event);
}
@ -2286,19 +2247,6 @@ class courselib_test extends advanced_testcase {
$this->assertEquals('course', $event->objecttable);
$this->assertEquals($rc->get_courseid(), $event->objectid);
$this->assertEquals(context_course::instance($rc->get_courseid())->id, $event->contextid);
$this->assertEquals('course_restored', $event->get_legacy_eventname());
$legacydata = (object) array(
'courseid' => $rc->get_courseid(),
'userid' => $rc->get_userid(),
'type' => $rc->get_type(),
'target' => $rc->get_target(),
'mode' => $rc->get_mode(),
'operation' => $rc->get_operation(),
'samesite' => $rc->is_samesite()
);
$url = new moodle_url('/course/view.php', array('id' => $event->objectid));
$this->assertEquals($url, $event->get_url());
$this->assertEventLegacyData($legacydata, $event);
$this->assertEventContextNotUsed($event);
// Destroy the resource controller since we are done using it.
@ -2357,8 +2305,6 @@ class courselib_test extends advanced_testcase {
$this->assertEquals($section, $event->get_record_snapshot('course_sections', $event->objectid));
$id = $section->id;
$sectionnum = $section->section;
$expectedlegacydata = array($course->id, "course", "editsection", 'editsection.php?id=' . $id, $sectionnum);
$this->assertEventLegacyLogData($expectedlegacydata, $event);
$this->assertEventContextNotUsed($event);
}
@ -2392,11 +2338,6 @@ class courselib_test extends advanced_testcase {
$this->assertEquals($expecteddesc, $event->get_description());
$this->assertEquals($section, $event->get_record_snapshot('course_sections', $event->objectid));
$this->assertNull($event->get_url());
// Test legacy data.
$sectionnum = $section->section;
$expectedlegacydata = array($course->id, "course", "delete section", 'view.php?id=' . $course->id, $sectionnum);
$this->assertEventLegacyLogData($expectedlegacydata, $event);
$this->assertEventContextNotUsed($event);
}
@ -2546,22 +2487,6 @@ class courselib_test extends advanced_testcase {
$this->assertEquals('course_modules', $event->objecttable);
$url = new moodle_url('/mod/assign/view.php', array('id' => $module->cmid));
$this->assertEquals($url, $event->get_url());
// Test legacy data.
$this->assertSame('mod_created', $event->get_legacy_eventname());
$eventdata = new stdClass();
$eventdata->modulename = 'assign';
$eventdata->name = $module->name;
$eventdata->cmid = $module->cmid;
$eventdata->courseid = $module->course;
$eventdata->userid = $USER->id;
$this->assertEventLegacyData($eventdata, $event);
$arr = array(
array($module->course, "course", "add mod", "../mod/assign/view.php?id=$module->cmid", "assign $module->id"),
array($module->course, "assign", "add", "view.php?id=$module->cmid", $module->id, $module->cmid)
);
$this->assertEventLegacyLogData($arr, $event);
$this->assertEventContextNotUsed($event);
}
}
@ -2686,22 +2611,6 @@ class courselib_test extends advanced_testcase {
$this->assertEquals('course_modules', $event->objecttable);
$url = new moodle_url('/mod/forum/view.php', array('id' => $cm->id));
$this->assertEquals($url, $event->get_url());
// Test legacy data.
$this->assertSame('mod_updated', $event->get_legacy_eventname());
$eventdata = new stdClass();
$eventdata->modulename = 'forum';
$eventdata->name = $mod->name;
$eventdata->cmid = $cm->id;
$eventdata->courseid = $cm->course;
$eventdata->userid = $USER->id;
$this->assertEventLegacyData($eventdata, $event);
$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);
}
}
@ -2746,12 +2655,6 @@ class courselib_test extends advanced_testcase {
$this->assertEquals($cm->instance, $event2->other['instanceid']);
$this->assertEquals($cm->name, $event2->other['name']);
$this->assertEventContextNotUsed($event2);
$this->assertSame('mod_updated', $event2->get_legacy_eventname());
$arr = array(
array($cm->course, "course", "update mod", "../mod/assign/view.php?id=$cm->id", "assign $cm->instance"),
array($cm->course, "assign", "update", "view.php?id=$cm->id", $cm->instance, $cm->id)
);
$this->assertEventLegacyLogData($arr, $event);
}
/**
@ -2842,19 +2745,6 @@ class courselib_test extends advanced_testcase {
$this->assertEquals('course_modules', $event->objecttable);
$this->assertEquals(null, $event->get_url());
$this->assertEquals($cm, $event->get_record_snapshot('course_modules', $cm->id));
// Test legacy data.
$this->assertSame('mod_deleted', $event->get_legacy_eventname());
$eventdata = new stdClass();
$eventdata->modulename = 'forum';
$eventdata->cmid = $cm->id;
$eventdata->courseid = $cm->course;
$eventdata->userid = $USER->id;
$this->assertEventLegacyData($eventdata, $event);
$arr = array($cm->course, 'course', "delete mod", "view.php?id=$cm->course", "forum $cm->instance", $cm->id);
$this->assertEventLegacyLogData($arr, $event);
}
/**
@ -3068,7 +2958,6 @@ class courselib_test extends advanced_testcase {
$coursecontext = context_course::instance($course->id);
$event = \core\event\course_resources_list_viewed::create(array('context' => context_course::instance($course->id)));
$event->set_legacy_logdata(array('book', 'page', 'resource'));
$sink = $this->redirectEvents();
$event->trigger();
$events = $sink->get_events();
@ -3081,12 +2970,6 @@ class courselib_test extends advanced_testcase {
$this->assertEquals(null, $event->objectid);
$this->assertEquals($course->id, $event->courseid);
$this->assertEquals($coursecontext->id, $event->contextid);
$expectedlegacydata = array(
array($course->id, "book", "view all", 'index.php?id=' . $course->id, ''),
array($course->id, "page", "view all", 'index.php?id=' . $course->id, ''),
array($course->id, "resource", "view all", 'index.php?id=' . $course->id, ''),
);
$this->assertEventLegacyLogData($expectedlegacydata, $event);
$this->assertEventContextNotUsed($event);
}

View File

@ -623,11 +623,6 @@ class plugin_test extends \advanced_testcase {
$dbuserenrolled = $DB->get_record('user_enrolments', array('userid' => $user1->id));
$this->assertInstanceOf('\core\event\user_enrolment_created', $event);
$this->assertEquals($dbuserenrolled->id, $event->objectid);
$this->assertEquals('user_enrolled', $event->get_legacy_eventname());
$expectedlegacyeventdata = $dbuserenrolled;
$expectedlegacyeventdata->enrol = 'meta';
$expectedlegacyeventdata->courseid = $course2->id;
$this->assertEventLegacyData($expectedlegacyeventdata, $event);
$this->assertEventContextNotUsed($event);
}
@ -661,7 +656,6 @@ class plugin_test extends \advanced_testcase {
$this->assertEquals(0, $DB->count_records('user_enrolments'));
$this->assertInstanceOf('\core\event\user_enrolment_deleted', $event);
$this->assertEquals('user_unenrolled', $event->get_legacy_eventname());
$this->assertEventContextNotUsed($event);
}
@ -697,13 +691,6 @@ class plugin_test extends \advanced_testcase {
$dbuserenrolled = $DB->get_record('user_enrolments', array('userid' => $user1->id));
$this->assertInstanceOf('\core\event\user_enrolment_updated', $event);
$this->assertEquals($dbuserenrolled->id, $event->objectid);
$this->assertEquals('user_enrol_modified', $event->get_legacy_eventname());
$expectedlegacyeventdata = $dbuserenrolled;
$expectedlegacyeventdata->enrol = 'meta';
$expectedlegacyeventdata->courseid = $course2->id;
$url = new \moodle_url('/enrol/editenrolment.php', array('ue' => $event->objectid));
$this->assertEquals($url, $event->get_url());
$this->assertEventLegacyData($expectedlegacyeventdata, $event);
$this->assertEventContextNotUsed($event);
}

View File

@ -656,13 +656,6 @@ class enrollib_test extends advanced_testcase {
$this->assertInstanceOf('\core\event\user_enrolment_created', $event);
$this->assertEquals($dbuserenrolled->id, $event->objectid);
$this->assertEquals(context_course::instance($course1->id), $event->get_context());
$this->assertEquals('user_enrolled', $event->get_legacy_eventname());
$expectedlegacyeventdata = $dbuserenrolled;
$expectedlegacyeventdata->enrol = $manual->get_name();
$expectedlegacyeventdata->courseid = $course1->id;
$this->assertEventLegacyData($expectedlegacyeventdata, $event);
$expected = array($course1->id, 'course', 'enrol', '../enrol/users.php?id=' . $course1->id, $course1->id);
$this->assertEventLegacyLogData($expected, $event);
$this->assertEventContextNotUsed($event);
}
@ -697,14 +690,6 @@ class enrollib_test extends advanced_testcase {
// Validate the event.
$this->assertInstanceOf('\core\event\user_enrolment_deleted', $event);
$this->assertEquals(context_course::instance($course->id), $event->get_context());
$this->assertEquals('user_unenrolled', $event->get_legacy_eventname());
$expectedlegacyeventdata = $dbuserenrolled;
$expectedlegacyeventdata->enrol = $manualplugin->get_name();
$expectedlegacyeventdata->courseid = $course->id;
$expectedlegacyeventdata->lastenrol = true;
$this->assertEventLegacyData($expectedlegacyeventdata, $event);
$expected = array($course->id, 'course', 'unenrol', '../enrol/users.php?id=' . $course->id, $course->id);
$this->assertEventLegacyLogData($expected, $event);
$this->assertEventContextNotUsed($event);
}

View File

@ -52,13 +52,6 @@ class lib_test extends \advanced_testcase {
$this->assertCount(1, $events);
$event = reset($events);
$expected = new \stdClass();
$expected->groupid = $group->id;
$expected->userid = $user->id;
$expected->component = 'mod_workshop';
$expected->itemid = '123';
$this->assertEventLegacyData($expected, $event);
$this->assertSame('groups_member_added', $event->get_legacy_eventname());
$this->assertInstanceOf('\core\event\group_member_added', $event);
$this->assertEquals($user->id, $event->relateduserid);
$this->assertEquals(\context_course::instance($course->id), $event->get_context());
@ -83,11 +76,6 @@ class lib_test extends \advanced_testcase {
$this->assertCount(1, $events);
$event = reset($events);
$expected = new \stdClass();
$expected->groupid = $group->id;
$expected->userid = $user->id;
$this->assertEventLegacyData($expected, $event);
$this->assertSame('groups_member_removed', $event->get_legacy_eventname());
$this->assertInstanceOf('\core\event\group_member_removed', $event);
$this->assertEquals($user->id, $event->relateduserid);
$this->assertEquals(\context_course::instance($course->id), $event->get_context());
@ -109,8 +97,6 @@ class lib_test extends \advanced_testcase {
$event = reset($events);
$this->assertInstanceOf('\core\event\group_created', $event);
$this->assertEventLegacyData($group, $event);
$this->assertSame('groups_group_created', $event->get_legacy_eventname());
$this->assertEquals(\context_course::instance($course->id), $event->get_context());
$this->assertEquals($group->id, $event->objectid);
$url = new \moodle_url('/group/index.php', array('id' => $event->courseid));
@ -131,9 +117,6 @@ class lib_test extends \advanced_testcase {
$this->assertInstanceOf('\core\event\grouping_created', $event);
$this->assertEventLegacyData($group, $event);
$this->assertSame('groups_grouping_created', $event->get_legacy_eventname());
$this->assertEquals(\context_course::instance($course->id), $event->get_context());
$this->assertEquals($group->id, $event->objectid);
$url = new \moodle_url('/group/groupings.php', array('id' => $event->courseid));
@ -163,8 +146,6 @@ class lib_test extends \advanced_testcase {
$this->assertInstanceOf('\core\event\group_updated', $event);
$group->name = $data->name;
$this->assertEventLegacyData($group, $event);
$this->assertSame('groups_group_updated', $event->get_legacy_eventname());
$this->assertEquals(\context_course::instance($course->id), $event->get_context());
$this->assertEquals($group->id, $event->objectid);
$url = new \moodle_url('/group/group.php', array('id' => $event->objectid));
@ -192,8 +173,6 @@ class lib_test extends \advanced_testcase {
$this->assertTimeCurrent($group->timemodified);
$this->assertInstanceOf('\core\event\group_updated', $event);
$this->assertEventLegacyData($group, $event);
$this->assertSame('groups_group_updated', $event->get_legacy_eventname());
$this->assertEquals(\context_course::instance($course->id), $event->get_context());
$this->assertEquals($group->id, $event->objectid);
$url = new \moodle_url('/group/group.php', array('id' => $event->objectid));
@ -224,15 +203,6 @@ class lib_test extends \advanced_testcase {
// Get the timemodified from DB for comparison with snapshot.
$data->timemodified = $DB->get_field('groupings', 'timemodified', array('id'=>$grouping->id));
$this->assertTimeCurrent($data->timemodified);
// Following fields were not updated so the snapshot should have them the same as in original group.
$data->description = $grouping->description;
$data->descriptionformat = $grouping->descriptionformat;
$data->configdata = $grouping->configdata;
$data->idnumber = $grouping->idnumber;
$data->timecreated = $grouping->timecreated;
// Assert legacy event data.
$this->assertEventLegacyData($data, $event);
$this->assertSame('groups_grouping_updated', $event->get_legacy_eventname());
$this->assertEquals(\context_course::instance($course->id), $event->get_context());
$this->assertEquals($grouping->id, $event->objectid);
@ -270,9 +240,6 @@ class lib_test extends \advanced_testcase {
$data->idnumber = $grouping->idnumber;
$data->name = $grouping->name;
$data->timecreated = $grouping->timecreated;
// Assert legacy event data.
$this->assertEventLegacyData($data, $event);
$this->assertSame('groups_grouping_updated', $event->get_legacy_eventname());
$this->assertEquals(\context_course::instance($course->id), $event->get_context());
$this->assertEquals($grouping->id, $event->objectid);
@ -292,9 +259,6 @@ class lib_test extends \advanced_testcase {
$this->assertCount(1, $events);
$event = reset($events);
$this->assertInstanceOf('\core\event\group_deleted', $event);
$this->assertEventLegacyData($group, $event);
$this->assertSame('groups_group_deleted', $event->get_legacy_eventname());
$this->assertEquals(\context_course::instance($course->id), $event->get_context());
$this->assertEquals($group->id, $event->objectid);
$url = new \moodle_url('/group/index.php', array('id' => $event->courseid));
@ -314,8 +278,6 @@ class lib_test extends \advanced_testcase {
$event = reset($events);
$this->assertInstanceOf('\core\event\grouping_deleted', $event);
$this->assertEventLegacyData($group, $event);
$this->assertSame('groups_grouping_deleted', $event->get_legacy_eventname());
$this->assertEquals(\context_course::instance($course->id), $event->get_context());
$this->assertEquals($group->id, $event->objectid);
$url = new \moodle_url('/group/groupings.php', array('id' => $event->courseid));

View File

@ -85,13 +85,4 @@ class h5p_deleted extends \core\event\base {
// There is no url since the previous event already has the url where the h5p content has been displayed.
return null;
}
/**
* Return the legacy event name.
*
* @return string
*/
public static function get_legacy_eventname() {
return 'core_h5p_deleted';
}
}
}

View File

@ -85,13 +85,4 @@ class h5p_viewed extends \core\event\base {
// There is no url since the previous event already has the url where the h5p content has been displayed.
return null;
}
/**
* Return the legacy event name.
*
* @return string
*/
public static function get_legacy_eventname() {
return 'core_h5p_viewed';
}
}
}

View File

@ -705,39 +705,6 @@ abstract class base implements \IteratorAggregate {
return $this->logextra;
}
/**
* Does this event replace legacy event?
*
* Note: do not use directly!
*
* @return null|string legacy event name
*/
public static function get_legacy_eventname() {
return null;
}
/**
* Legacy event data if get_legacy_eventname() is not empty.
*
* Note: do not use directly!
*
* @return mixed
*/
protected function get_legacy_eventdata() {
return null;
}
/**
* Doest this event replace add_to_log() statement?
*
* Note: do not use directly!
*
* @return null|array of parameters to be passed to legacy add_to_log() function.
*/
protected function get_legacy_logdata() {
return null;
}
/**
* Validate all properties right before triggering the event.
*
@ -818,22 +785,6 @@ abstract class base implements \IteratorAggregate {
$this->triggered = true;
if (isset($CFG->loglifetime) and $CFG->loglifetime != -1) {
if ($data = $this->get_legacy_logdata()) {
$manager = get_log_manager();
if (method_exists($manager, 'legacy_add_to_log')) {
if (is_array($data[0])) {
// Some events require several entries in 'log' table.
foreach ($data as $d) {
call_user_func_array(array($manager, 'legacy_add_to_log'), $d);
}
} else {
call_user_func_array(array($manager, 'legacy_add_to_log'), $data);
}
}
}
}
if (PHPUNIT_TEST and \phpunit_util::is_redirecting_events()) {
$this->dispatched = true;
\phpunit_util::event_triggered($this);

View File

@ -80,21 +80,6 @@ class blog_association_created extends base {
return new \moodle_url('/blog/index.php', array('entryid' => $this->other['blogid']));
}
/**
* replace add_to_log() statement.
*
* @return array of parameters to be passed to legacy add_to_log() function.
*/
protected function get_legacy_logdata() {
if ($this->other['associatetype'] === 'course') {
return array (SITEID, 'blog', 'add association', 'index.php?userid=' . $this->relateduserid. '&entryid=' .
$this->other['blogid'], $this->other['subject'], 0, $this->relateduserid);
}
return array (SITEID, 'blog', 'add association', 'index.php?userid=' . $this->relateduserid. '&entryid=' .
$this->other['blogid'], $this->other['subject'], $this->other['associateid'], $this->relateduserid);
}
/**
* Custom validations.
*

View File

@ -91,22 +91,6 @@ class blog_entries_viewed extends base {
return new \moodle_url('/blog/index.php', $params);
}
/**
* replace add_to_log() statement.
*
* @return array of parameters to be passed to legacy add_to_log() function.
*/
protected function get_legacy_logdata() {
$params = array();
foreach ($this->validparams as $param) {
if (!empty($this->other[$param])) {
$params[$param] = $this->other[$param];
}
}
$url = new \moodle_url('index.php', $params);
return array (SITEID, 'blog', 'view', $url->out(), 'view blog entry');
}
public static function get_other_mapping() {
$othermapped = array();
$othermapped['entryid'] = array('db' => 'post', 'restore' => base::NOT_MAPPED);

View File

@ -99,34 +99,6 @@ class blog_entry_created extends base {
return new \moodle_url('/blog/index.php', array('entryid' => $this->objectid));
}
/**
* Does this event replace legacy event?
*
* @return string legacy event name
*/
public static function get_legacy_eventname() {
return 'blog_entry_added';
}
/**
* Legacy event data if get_legacy_eventname() is not empty.
*
* @return \blog_entry
*/
protected function get_legacy_eventdata() {
return $this->blogentry;
}
/**
* Replace add_to_log() statement.
*
* @return array of parameters to be passed to legacy add_to_log() function.
*/
protected function get_legacy_logdata() {
return array (SITEID, 'blog', 'add', 'index.php?userid=' . $this->relateduserid . '&entryid=' . $this->objectid,
$this->blogentry->subject);
}
/**
* Custom validations.
*

View File

@ -90,34 +90,6 @@ class blog_entry_deleted extends base {
return "The user with id '$this->userid' deleted the blog entry with id '$this->objectid'.";
}
/**
* Does this event replace legacy event?
*
* @return string legacy event name
*/
public static function get_legacy_eventname() {
return 'blog_entry_deleted';
}
/**
* Legacy event data if get_legacy_eventname() is not empty.
*
* @return \blog_entry
*/
protected function get_legacy_eventdata() {
return $this->blogentry;
}
/**
* replace add_to_log() statement.
*
* @return array of parameters to be passed to legacy add_to_log() function.
*/
protected function get_legacy_logdata() {
return array (SITEID, 'blog', 'delete', 'index.php?userid=' . $this->relateduserid, 'deleted blog entry with entry id# '.
$this->objectid);
}
/**
* Custom validations.
*

View File

@ -97,34 +97,6 @@ class blog_entry_updated extends base {
return new \moodle_url('/blog/index.php', array('entryid' => $this->objectid));
}
/**
* Legacy event data if get_legacy_eventname() is not empty.
*
* @return \blog_entry
*/
protected function get_legacy_eventdata() {
return $this->blogentry;
}
/**
* Legacy event name.
*
* @return string legacy event name
*/
public static function get_legacy_eventname() {
return 'blog_entry_edited';
}
/**
* Replace legacy add_to_log() statement.
*
* @return array of parameters to be passed to legacy add_to_log() function.
*/
protected function get_legacy_logdata() {
return array(SITEID, 'blog', 'update', 'index.php?userid=' . $this->relateduserid . '&entryid=' . $this->objectid,
$this->blogentry->subject);
}
/**
* Custom validations.
*

View File

@ -84,15 +84,6 @@ class calendar_event_created extends base {
'event_' . $this->objectid);
}
/**
* Replace legacy add_to_log() statement.
*
* @return array of parameters to be passed to legacy add_to_log() function.
*/
protected function get_legacy_logdata() {
return array($this->courseid, 'calendar', 'add', 'event.php?action=edit&id=' . $this->objectid , $this->other['name']);
}
/**
* Custom validation.
*

View File

@ -83,15 +83,6 @@ class calendar_event_updated extends base {
return new \moodle_url('/calendar/event.php', array('action' => 'edit', 'id' => $this->objectid));
}
/**
* Replace legacy add_to_log() statement.
*
* @return array of parameters to be passed to legacy add_to_log() function.
*/
protected function get_legacy_logdata() {
return array($this->courseid, 'calendar', 'edit', 'event.php?action=edit&id=' . $this->objectid, $this->other['name']);
}
/**
* Custom validation.
*

View File

@ -73,24 +73,6 @@ class cohort_created extends base {
return new \moodle_url('/cohort/index.php', array('contextid' => $this->contextid));
}
/**
* Return legacy event name.
*
* @return string legacy event name
*/
public static function get_legacy_eventname() {
return 'cohort_added';
}
/**
* Return legacy event data.
*
* @return \stdClass
*/
protected function get_legacy_eventdata() {
return $this->get_record_snapshot('cohort', $this->objectid);
}
public static function get_objectid_mapping() {
// Cohorts are not included in backups, so no mapping is needed for restore.
return array('db' => 'cohort', 'restore' => base::NOT_MAPPED);

View File

@ -73,24 +73,6 @@ class cohort_deleted extends base {
return new \moodle_url('/cohort/index.php', array('contextid' => $this->contextid));
}
/**
* Return legacy event name.
*
* @return null|string legacy event name
*/
public static function get_legacy_eventname() {
return 'cohort_deleted';
}
/**
* Return legacy event data.
*
* @return \stdClass
*/
protected function get_legacy_eventdata() {
return $this->get_record_snapshot('cohort', $this->objectid);
}
public static function get_objectid_mapping() {
// Cohorts are not included in backups, so no mapping is needed for restore.
return array('db' => 'cohort', 'restore' => base::NOT_MAPPED);

View File

@ -74,27 +74,6 @@ class cohort_member_added extends base {
return new \moodle_url('/cohort/assign.php', array('id' => $this->objectid));
}
/**
* Return legacy event name.
*
* @return string legacy event name.
*/
public static function get_legacy_eventname() {
return 'cohort_member_added';
}
/**
* Return legacy event data.
*
* @return \stdClass
*/
protected function get_legacy_eventdata() {
$data = new \stdClass();
$data->cohortid = $this->objectid;
$data->userid = $this->relateduserid;
return $data;
}
/**
* Custom validations.
*

View File

@ -75,27 +75,6 @@ class cohort_member_removed extends base {
return new \moodle_url('/cohort/assign.php', array('id' => $this->objectid));
}
/**
* Return legacy event name.
*
* @return string legacy event name.
*/
public static function get_legacy_eventname() {
return 'cohort_member_removed';
}
/**
* Return legacy event data.
*
* @return \stdClass
*/
protected function get_legacy_eventdata() {
$data = new \stdClass();
$data->cohortid = $this->objectid;
$data->userid = $this->relateduserid;
return $data;
}
/**
* Custom validations.
*

View File

@ -73,24 +73,6 @@ class cohort_updated extends base {
return new \moodle_url('/cohort/edit.php', array('id' => $this->objectid));
}
/**
* Return legacy event name.
*
* @return string legacy event name.
*/
public static function get_legacy_eventname() {
return 'cohort_updated';
}
/**
* Return legacy event data.
*
* @return \stdClass
*/
protected function get_legacy_eventdata() {
return $this->get_record_snapshot('cohort', $this->objectid);
}
public static function get_objectid_mapping() {
// Cohorts are not included in backups, so no mapping is needed for restore.
return array('db' => 'cohort', 'restore' => base::NOT_MAPPED);

View File

@ -95,24 +95,6 @@ abstract class content_viewed extends base {
return "The user with id '$this->userid' viewed content.";
}
/**
* Set legacy logdata.
*
* @param array $legacydata legacy logdata.
*/
public function set_legacy_logdata(array $legacydata) {
$this->legacylogdata = $legacydata;
}
/**
* Get legacy logdata.
*
* @return null|array legacy log data.
*/
protected function get_legacy_logdata() {
return $this->legacylogdata;
}
/**
* Custom validation.
*

View File

@ -72,15 +72,6 @@ class course_category_created extends base {
return "The user with id '$this->userid' created the course category with id '$this->objectid'.";
}
/**
* Return legacy data for add_to_log().
*
* @return array
*/
protected function get_legacy_logdata() {
return array(SITEID, 'category', 'add', 'editcategory.php?id=' . $this->objectid, $this->objectid);
}
public static function get_objectid_mapping() {
// Categories are not backed up, so no need to map them on restore.
return array('db' => 'course_categories', 'restore' => base::NOT_MAPPED);

View File

@ -79,24 +79,6 @@ class course_category_deleted extends base {
return $descr;
}
/**
* Returns the name of the legacy event.
*
* @return string legacy event name
*/
public static function get_legacy_eventname() {
return 'course_category_deleted';
}
/**
* Returns the legacy event data.
*
* @return \core_course_category the category that was deleted
*/
protected function get_legacy_eventdata() {
return $this->coursecat;
}
/**
* Set custom data of the event - deleted coursecat.
*
@ -119,15 +101,6 @@ class course_category_deleted extends base {
return $this->coursecat;
}
/**
* Return legacy data for add_to_log().
*
* @return array
*/
protected function get_legacy_logdata() {
return array(SITEID, 'category', 'delete', 'index.php', $this->other['name'] . '(ID ' . $this->objectid . ')');
}
/**
* Custom validation.
*

View File

@ -75,28 +75,6 @@ class course_category_updated extends base {
return "The user with id '$this->userid' updated the course category with id '$this->objectid'.";
}
/**
* Set the legacy data used for add_to_log().
*
* @param array $logdata
*/
public function set_legacy_logdata($logdata) {
$this->legacylogdata = $logdata;
}
/**
* Return legacy data for add_to_log().
*
* @return array
*/
protected function get_legacy_logdata() {
if (!empty($this->legacylogdata)) {
return $this->legacylogdata;
}
return array(SITEID, 'category', 'update', 'editcategory.php?id=' . $this->objectid, $this->objectid);
}
public static function get_objectid_mapping() {
// Categories are not backed up, so no need to map them on restore.
return array('db' => 'course_categories', 'restore' => base::NOT_MAPPED);

View File

@ -97,24 +97,6 @@ class course_completed extends base {
return new \moodle_url('/report/completion/index.php', array('course' => $this->courseid));
}
/**
* Return name of the legacy event, which is replaced by this event.
*
* @return string legacy event name
*/
public static function get_legacy_eventname() {
return 'course_completed';
}
/**
* Return course_completed legacy event data.
*
* @return \stdClass completion data.
*/
protected function get_legacy_eventdata() {
return $this->get_record_snapshot('course_completions', $this->objectid);
}
/**
* Custom validation.
*

View File

@ -70,13 +70,4 @@ class course_completion_updated extends base {
public function get_url() {
return new \moodle_url('/course/completion.php', array('id' => $this->courseid));
}
/**
* Return legacy add_to_log() data.
*
* @return array of parameters to be passed to legacy add_to_log() function.
*/
protected function get_legacy_logdata() {
return array($this->courseid, 'course', 'completion updated', 'completion.php?id=' . $this->courseid);
}
}

View File

@ -69,28 +69,6 @@ class course_content_deleted extends base {
return "The user with id '$this->userid' deleted content from course with id '$this->courseid'.";
}
/**
* Returns the name of the legacy event.
*
* @return string legacy event name
*/
public static function get_legacy_eventname() {
return 'course_content_removed';
}
/**
* Returns the legacy event data.
*
* @return \stdClass the course the content was deleted from
*/
protected function get_legacy_eventdata() {
$course = $this->get_record_snapshot('course', $this->objectid);
$course->context = $this->context;
$course->options = $this->other['options'];
return $course;
}
/**
* Custom validation.
*

View File

@ -79,33 +79,6 @@ class course_created extends base {
return new \moodle_url('/course/view.php', array('id' => $this->objectid));
}
/**
* Returns the name of the legacy event.
*
* @return string legacy event name
*/
public static function get_legacy_eventname() {
return 'course_created';
}
/**
* Returns the legacy event data.
*
* @return \stdClass the course that was created
*/
protected function get_legacy_eventdata() {
return $this->get_record_snapshot('course', $this->objectid);
}
/**
* Return legacy data for add_to_log().
*
* @return array
*/
protected function get_legacy_logdata() {
return array(SITEID, 'course', 'new', 'view.php?id=' . $this->objectid, $this->other['fullname'] . ' (ID ' . $this->objectid . ')');
}
/**
* Custom validation.
*

View File

@ -71,36 +71,6 @@ class course_deleted extends base {
return "The user with id '$this->userid' deleted the course with id '$this->courseid'.";
}
/**
* Returns the name of the legacy event.
*
* @return string legacy event name
*/
public static function get_legacy_eventname() {
return 'course_deleted';
}
/**
* Returns the legacy event data.
*
* @return \stdClass the course that was deleted
*/
protected function get_legacy_eventdata() {
$course = $this->get_record_snapshot('course', $this->objectid);
$course->context = $this->context;
$course->timemodified = $this->data['timecreated'];
return $course;
}
/**
* Return legacy data for add_to_log().
*
* @return array
*/
protected function get_legacy_logdata() {
return array(SITEID, 'course', 'delete', 'view.php?id=' . $this->objectid, $this->other['fullname'] . '(ID ' . $this->objectid . ')');
}
/**
* Custom validation.
*

View File

@ -84,24 +84,6 @@ class course_module_completion_updated extends base {
return new \moodle_url('/report/progress/index.php', array('course' => $this->courseid));
}
/**
* Return name of the legacy event, which is replaced by this event.
*
* @return string legacy event name
*/
public static function get_legacy_eventname() {
return 'activity_completion_changed';
}
/**
* Return course module completion legacy event data.
*
* @return \stdClass completion data.
*/
protected function get_legacy_eventdata() {
return $this->get_record_snapshot('course_modules_completion', $this->objectid);
}
/**
* Custom validation.
*

View File

@ -110,44 +110,6 @@ class course_module_created extends base {
return new \moodle_url('/mod/' . $this->other['modulename'] . '/view.php', array('id' => $this->objectid));
}
/**
* Legacy event name.
*
* @return string legacy event name
*/
public static function get_legacy_eventname() {
return 'mod_created';
}
/**
* Legacy event data.
*
* @return \stdClass
*/
protected function get_legacy_eventdata() {
$eventdata = new \stdClass();
$eventdata->modulename = $this->other['modulename'];
$eventdata->name = $this->other['name'];
$eventdata->cmid = $this->objectid;
$eventdata->courseid = $this->courseid;
$eventdata->userid = $this->userid;
return $eventdata;
}
/**
* replace add_to_log() statement.
*
* @return array of parameters to be passed to legacy add_to_log() function.
*/
protected function get_legacy_logdata() {
$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);
}
/**
* Custom validation.
*

View File

@ -72,39 +72,6 @@ class course_module_deleted extends base {
"course module id '$this->contextinstanceid'.";
}
/**
* Legacy event name.
*
* @return string legacy event name
*/
public static function get_legacy_eventname() {
return 'mod_deleted';
}
/**
* Legacy event data.
*
* @return \stdClass
*/
protected function get_legacy_eventdata() {
$eventdata = new \stdClass();
$eventdata->modulename = $this->other['modulename'];
$eventdata->cmid = $this->objectid;
$eventdata->courseid = $this->courseid;
$eventdata->userid = $this->userid;
return $eventdata;
}
/**
* replace add_to_log() statement.
*
* @return array of parameters to be passed to legacy add_to_log() function.
*/
protected function get_legacy_logdata() {
return array ($this->courseid, "course", "delete mod", "view.php?id=$this->courseid",
$this->other['modulename'] . " " . $this->other['instanceid'], $this->objectid);
}
/**
* custom validations
*

View File

@ -90,16 +90,6 @@ abstract class course_module_instance_list_viewed extends base{
return new \moodle_url("/mod/$this->modname/index.php", array('id' => $this->courseid));
}
/**
* Return the legacy event log data.
*
* @return array|null
*/
protected function get_legacy_logdata() {
return array($this->courseid, $this->modname, 'view all', 'index.php?id=' . $this->courseid, '');
}
/**
* Custom validation.
*

View File

@ -81,44 +81,6 @@ class course_module_updated extends base {
return new \moodle_url('/mod/' . $this->other['modulename'] . '/view.php', array('id' => $this->objectid));
}
/**
* Legacy event name.
*
* @return string legacy event name
*/
public static function get_legacy_eventname() {
return 'mod_updated';
}
/**
* Legacy event data.
*
* @return \stdClass
*/
protected function get_legacy_eventdata() {
$eventdata = new \stdClass();
$eventdata->modulename = $this->other['modulename'];
$eventdata->name = $this->other['name'];
$eventdata->cmid = $this->objectid;
$eventdata->courseid = $this->courseid;
$eventdata->userid = $this->userid;
return $eventdata;
}
/**
* replace add_to_log() statement.
*
* @return array of parameters to be passed to legacy add_to_log() function.
*/
protected function get_legacy_logdata() {
$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);
}
/**
* custom validations
*

View File

@ -77,16 +77,6 @@ abstract class course_module_viewed extends base {
return new \moodle_url("/mod/$this->objecttable/view.php", array('id' => $this->contextinstanceid));
}
/**
* Return the legacy event log data.
*
* @return array|null
*/
protected function get_legacy_logdata() {
return array($this->courseid, $this->objecttable, 'view', 'view.php?id=' . $this->contextinstanceid, $this->objectid,
$this->contextinstanceid);
}
/**
* Custom validation.
*

View File

@ -75,35 +75,6 @@ class course_resources_list_viewed extends base {
return new \moodle_url("/course/resources.php", array('id' => $this->courseid));
}
/**
* List of resource types enabled in the system. This is used for legacy logging to log one record for each resource type.
*
* There is no public getter for this data because it does not depend on the
* course. It always includes the list of all resource types in the system
* even when some of them are not present in the course.
*
* @param array $data
*/
public function set_legacy_logdata($data) {
$this->resourceslist = $data;
}
/**
* Return the legacy event log data.
*
* @return array|null
*/
protected function get_legacy_logdata() {
if (empty($this->resourceslist)) {
return null;
}
$logs = array();
foreach ($this->resourceslist as $resourcename) {
$logs[] = array($this->courseid, $resourcename, 'view all', 'index.php?id=' . $this->courseid, '');
}
return $logs;
}
/**
* Custom validation.
*

View File

@ -91,32 +91,6 @@ class course_restored extends base {
return new \moodle_url('/course/view.php', array('id' => $this->objectid));
}
/**
* Returns the name of the legacy event.
*
* @return string legacy event name
*/
public static function get_legacy_eventname() {
return 'course_restored';
}
/**
* Returns the legacy event data.
*
* @return \stdClass the legacy event data
*/
protected function get_legacy_eventdata() {
return (object) array(
'courseid' => $this->objectid,
'userid' => $this->userid,
'type' => $this->other['type'],
'target' => $this->other['target'],
'mode' => $this->other['mode'],
'operation' => $this->other['operation'],
'samesite' => $this->other['samesite'],
);
}
/**
* Custom validation.
*

View File

@ -73,15 +73,6 @@ class course_section_deleted extends base {
"(section name '{$this->other['sectionname']}') for the course with id '$this->courseid'";
}
/**
* Return legacy data for add_to_log().
*
* @return array
*/
protected function get_legacy_logdata() {
return array($this->courseid, 'course', 'delete section', 'view.php?id=' . $this->courseid, $this->other['sectionnum']);
}
/**
* Custom validation.
*

View File

@ -81,16 +81,6 @@ class course_section_updated extends base {
return new \moodle_url('/course/editsection.php', array('id' => $this->objectid));
}
/**
* Return legacy data for add_to_log().
*
* @return array
*/
protected function get_legacy_logdata() {
$sectiondata = $this->get_record_snapshot('course_sections', $this->objectid);
return array($this->courseid, 'course', 'editsection', 'editsection.php?id=' . $this->objectid, $sectiondata->section);
}
/**
* Custom validation.
*

View File

@ -83,42 +83,6 @@ class course_updated extends base {
return new \moodle_url('/course/edit.php', array('id' => $this->objectid));
}
/**
* Returns the name of the legacy event.
*
* @return string legacy event name
*/
public static function get_legacy_eventname() {
return 'course_updated';
}
/**
* Returns the legacy event data.
*
* @return \stdClass the course that was updated
*/
protected function get_legacy_eventdata() {
return $this->get_record_snapshot('course', $this->objectid);
}
/**
* Set the legacy data used for add_to_log().
*
* @param array $logdata
*/
public function set_legacy_logdata($logdata) {
$this->legacylogdata = $logdata;
}
/**
* Return legacy data for add_to_log().
*
* @return array
*/
protected function get_legacy_logdata() {
return $this->legacylogdata;
}
public static function get_objectid_mapping() {
return array('db' => 'course', 'restore' => 'course');
}

View File

@ -82,16 +82,6 @@ class course_user_report_viewed extends base {
'mode' => $this->other['mode']));
}
/**
* Return the legacy event log data.
*
* @return array|null
*/
protected function get_legacy_logdata() {
return array($this->courseid, 'course', 'user report', 'user.php?id=' . $this->courseid . '&user='
. $this->relateduserid . '&mode=' . $this->other['mode'], $this->relateduserid);
}
/**
* Custom validation.
*

View File

@ -104,30 +104,6 @@ class course_viewed extends base {
}
}
/**
* Return the legacy event log data.
*
* @return array|null
*/
protected function get_legacy_logdata() {
if ($this->courseid == SITEID and !isloggedin()) {
// We did not log frontpage access in older Moodle versions.
return null;
}
// We keep compatibility with 2.7 and 2.8 other['coursesectionid'].
if (isset($this->other['coursesectionnumber']) || isset($this->other['coursesectionid'])) {
if (isset($this->other['coursesectionnumber'])) {
$sectionnumber = $this->other['coursesectionnumber'];
} else {
$sectionnumber = $this->other['coursesectionid'];
}
return array($this->courseid, 'course', 'view section', 'view.php?id=' . $this->courseid . '&section='
. $sectionnumber, $sectionnumber);
}
return array($this->courseid, 'course', 'view', 'view.php?id=' . $this->courseid, $this->courseid);
}
/**
* Custom validation.
*

View File

@ -72,15 +72,6 @@ class email_failed extends base {
due to the following error: \"{$this->other['errorinfo']}\".";
}
/**
* Return legacy data for add_to_log().
*
* @return array
*/
protected function get_legacy_logdata() {
return array(SITEID, 'library', 'mailer', qualified_me(), 'ERROR: ' . $this->other['errorinfo']);
}
/**
* Custom validation.
*

View File

@ -44,24 +44,6 @@ class group_created extends base {
return "The user with id '$this->userid' created the group with id '$this->objectid'.";
}
/**
* Legacy event data if get_legacy_eventname() is not empty.
*
* @return \stdClass
*/
protected function get_legacy_eventdata() {
return $this->get_record_snapshot('groups', $this->objectid);
}
/**
* Return the legacy event name.
*
* @return string
*/
public static function get_legacy_eventname() {
return 'groups_group_created';
}
/**
* Return localised event name.
*

View File

@ -44,24 +44,6 @@ class group_deleted extends base {
return "The user with id '$this->userid' deleted the group with id '$this->objectid'.";
}
/**
* Legacy event data if get_legacy_eventname() is not empty.
*
* @return \stdClass
*/
protected function get_legacy_eventdata() {
return $this->get_record_snapshot('groups', $this->objectid);
}
/**
* Return the legacy event name.
*
* @return string
*/
public static function get_legacy_eventname() {
return 'groups_group_deleted';
}
/**
* Return localised event name.
*

View File

@ -52,29 +52,6 @@ class group_member_added extends base {
"id '$this->objectid'.";
}
/**
* Legacy event data if get_legacy_eventname() is not empty.
*
* @return \stdClass
*/
protected function get_legacy_eventdata() {
$eventdata = new \stdClass();
$eventdata->groupid = $this->objectid;
$eventdata->userid = $this->relateduserid;
$eventdata->component = $this->other['component'];
$eventdata->itemid = $this->other['itemid'];
return $eventdata;
}
/**
* Return the legacy event name.
*
* @return string
*/
public static function get_legacy_eventname() {
return 'groups_member_added';
}
/**
* Return localised event name.
*

View File

@ -45,27 +45,6 @@ class group_member_removed extends base {
"id '$this->objectid'.";
}
/**
* Legacy event data if get_legacy_eventname() is not empty.
*
* @return \stdClass
*/
protected function get_legacy_eventdata() {
$eventdata = new \stdClass();
$eventdata->groupid = $this->objectid;
$eventdata->userid = $this->relateduserid;
return $eventdata;
}
/**
* Return the legacy event name.
*
* @return string
*/
public static function get_legacy_eventname() {
return 'groups_member_removed';
}
/**
* Return localised event name.
*

View File

@ -44,24 +44,6 @@ class group_updated extends base {
return "The user with id '$this->userid' updated the group with id '$this->objectid'.";
}
/**
* Legacy event data if get_legacy_eventname() is not empty.
*
* @return \stdClass
*/
protected function get_legacy_eventdata() {
return $this->get_record_snapshot('groups', $this->objectid);
}
/**
* Return the legacy event name.
*
* @return string
*/
public static function get_legacy_eventname() {
return 'groups_group_updated';
}
/**
* Return localised event name.
*

View File

@ -44,24 +44,6 @@ class grouping_created extends base {
return "The user with id '$this->userid' created the grouping with id '$this->objectid'.";
}
/**
* Legacy event data if get_legacy_eventname() is not empty.
*
* @return \stdClass
*/
protected function get_legacy_eventdata() {
return $this->get_record_snapshot('groupings', $this->objectid);
}
/**
* Return the legacy event name.
*
* @return string
*/
public static function get_legacy_eventname() {
return 'groups_grouping_created';
}
/**
* Return localised event name.
*

View File

@ -51,24 +51,6 @@ class grouping_deleted extends base {
return "The user with id '$this->userid' deleted the grouping with id '$this->objectid'.";
}
/**
* Legacy event data if get_legacy_eventname() is not empty.
*
* @return \stdClass
*/
protected function get_legacy_eventdata() {
return $this->get_record_snapshot('groupings', $this->objectid);
}
/**
* Return the legacy event name.
*
* @return string
*/
public static function get_legacy_eventname() {
return 'groups_grouping_deleted';
}
/**
* Return localised event name.
*

View File

@ -44,24 +44,6 @@ class grouping_updated extends base {
return "The user with id '$this->userid' updated the grouping with id '$this->objectid'.";
}
/**
* Legacy event data if get_legacy_eventname() is not empty.
*
* @return \stdClass
*/
protected function get_legacy_eventdata() {
return $this->get_record_snapshot('groupings', $this->objectid);
}
/**
* Return the legacy event name.
*
* @return string
*/
public static function get_legacy_eventname() {
return 'groups_grouping_updated';
}
/**
* Return localised event name.
*

View File

@ -72,16 +72,6 @@ class message_contact_added extends base {
return "The user with id '$this->userid' added the user with id '$this->relateduserid' to their contact list.";
}
/**
* Return legacy data for add_to_log().
*
* @return array
*/
protected function get_legacy_logdata() {
return array(SITEID, 'message', 'add contact', 'index.php?user1=' . $this->relateduserid .
'&user2=' . $this->userid, $this->relateduserid);
}
/**
* Custom validation.
*

View File

@ -72,16 +72,6 @@ class message_contact_removed extends base {
return "The user with id '$this->userid' removed the user with id '$this->relateduserid' from their contact list.";
}
/**
* Return legacy data for add_to_log().
*
* @return array
*/
protected function get_legacy_logdata() {
return array(SITEID, 'message', 'remove contact', 'index.php?user1=' . $this->relateduserid . '&user2=' .
$this->userid, $this->relateduserid);
}
/**
* Custom validation.
*

View File

@ -111,23 +111,6 @@ class message_sent extends base {
return "A message was sent by the system to the user with id '$this->relateduserid'.";
}
/**
* Return legacy data for add_to_log().
*
* @return array
*/
protected function get_legacy_logdata() {
// The add_to_log function was only ever called when we sent a message from one user to another. We do not want
// to return the legacy log data if we are sending a system message, so check that the userid is valid.
if (\core_user::is_real_user($this->userid)) {
$messageid = $this->other['messageid'] ?? $this->objectid; // For BC we may have 'messageid' in other.
return array(SITEID, 'message', 'write', 'index.php?user=' . $this->userid . '&id=' . $this->relateduserid .
'&history=1#m' . $messageid, $this->userid);
}
return null;
}
/**
* Custom validation.
*

View File

@ -82,16 +82,6 @@ class mnet_access_control_created extends base {
"belonging to mnet host '{$this->other['hostname']}'.";
}
/**
* Return legacy data for add_to_log().
*
* @return array
*/
protected function get_legacy_logdata() {
return array(SITEID, 'admin/mnet', 'add', 'admin/mnet/access_control.php', 'SSO ACL: ' . $this->other['accessctrl'] .
' user \'' . $this->other['username'] . '\' from ' . $this->other['hostname']);
}
/**
* Custom validation.
*

View File

@ -82,16 +82,6 @@ class mnet_access_control_updated extends base {
"belonging to mnet host '{$this->other['hostname']}'.";
}
/**
* Return legacy data for add_to_log().
*
* @return array
*/
protected function get_legacy_logdata() {
return array(SITEID, 'admin/mnet', 'update', 'admin/mnet/access_control.php', 'SSO ACL: ' . $this->other['accessctrl'] .
' user \'' . $this->other['username'] . '\' from ' . $this->other['hostname']);
}
/**
* Custom validation.
*

View File

@ -82,17 +82,6 @@ class note_created extends base {
return $logurl;
}
/**
* replace add_to_log() statement.
*
* @return array of parameters to be passed to legacy add_to_log() function.
*/
protected function get_legacy_logdata() {
$logurl = new \moodle_url('index.php', array('course' => $this->courseid, 'user' => $this->relateduserid));
$logurl->set_anchor('note-' . $this->objectid);
return array($this->courseid, 'notes', 'add', $logurl, 'add note');
}
/**
* Custom validation.
*

View File

@ -72,17 +72,6 @@ class note_deleted extends base {
"'$this->relateduserid'";
}
/**
* replace add_to_log() statement.
*
* @return array of parameters to be passed to legacy add_to_log() function.
*/
protected function get_legacy_logdata() {
$logurl = new \moodle_url('index.php', array('course' => $this->courseid, 'user' => $this->relateduserid));
$logurl->set_anchor('note-' . $this->objectid);
return array($this->courseid, 'notes', 'delete', $logurl, 'delete note');
}
/**
* Custom validation.
*

View File

@ -82,17 +82,6 @@ class note_updated extends base {
return $logurl;
}
/**
* Replace add_to_log() statement.
*
* @return array of parameters to be passed to legacy add_to_log() function.
*/
protected function get_legacy_logdata() {
$logurl = new \moodle_url('index.php', array('course' => $this->courseid, 'user' => $this->relateduserid));
$logurl->set_anchor('note-' . $this->objectid);
return array($this->courseid, 'notes', 'update', $logurl, 'update note');
}
/**
* Custom validation.
*

View File

@ -76,14 +76,4 @@ class notes_viewed extends base {
public function get_url() {
return new \moodle_url('/notes/index.php', array('course' => $this->courseid, 'user' => $this->relateduserid));
}
/**
* replace add_to_log() statement.
*
* @return array of parameters to be passed to legacy add_to_log() function.
*/
protected function get_legacy_logdata() {
return array($this->courseid, 'notes', 'view', 'index.php?course=' . $this->courseid.'&user=' . $this->relateduserid,
'view notes');
}
}

View File

@ -61,19 +61,4 @@ class question_category_created extends question_category_base {
public function get_description() {
return "The user with id '$this->userid' created the question category with id '$this->objectid'.";
}
/**
* Return the legacy event log data.
*
* @return array|null
*/
protected function get_legacy_logdata() {
if ($this->contextlevel == CONTEXT_MODULE) {
return array($this->courseid, 'quiz', 'addcategory', 'view.php?id=' . $this->contextinstanceid,
$this->objectid, $this->contextinstanceid);
}
// This is not related to individual quiz at all.
return null;
}
}

View File

@ -64,15 +64,6 @@ class recent_activity_viewed extends base {
return "The user with id '$this->userid' viewed the recent activity report in the course with id '$this->courseid'.";
}
/**
* Return the legacy event log data.
*
* @return array
*/
protected function get_legacy_logdata() {
return array($this->courseid, "course", "recent", "recent.php?id=$this->courseid", $this->courseid);
}
/**
* Returns relevant URL.
*

View File

@ -73,13 +73,4 @@ class role_allow_assign_updated extends base {
public function get_url() {
return new \moodle_url('/admin/roles/allow.php', array('mode' => 'assign'));
}
/**
* Returns array of parameters to be passed to legacy add_to_log() function.
*
* @return array
*/
protected function get_legacy_logdata() {
return array(SITEID, 'role', 'edit allow assign', 'admin/roles/allow.php?mode=assign');
}
}

View File

@ -73,13 +73,4 @@ class role_allow_override_updated extends base {
public function get_url() {
return new \moodle_url('/admin/roles/allow.php', array('mode' => 'override'));
}
/**
* Returns array of parameters to be passed to legacy add_to_log() function.
*
* @return array
*/
protected function get_legacy_logdata() {
return array(SITEID, 'role', 'edit allow override', 'admin/roles/allow.php?mode=override');
}
}

View File

@ -73,13 +73,4 @@ class role_allow_switch_updated extends base {
public function get_url() {
return new \moodle_url('/admin/roles/allow.php', array('mode' => 'switch'));
}
/**
* Returns array of parameters to be passed to legacy add_to_log() function.
*
* @return array
*/
protected function get_legacy_logdata() {
return array(SITEID, 'role', 'edit allow switch', 'admin/roles/allow.php?mode=switch');
}
}

View File

@ -73,13 +73,4 @@ class role_allow_view_updated extends base {
public function get_url() {
return new \moodle_url('/admin/roles/allow.php', array('mode' => 'view'));
}
/**
* Returns array of parameters to be passed to legacy add_to_log() function.
*
* @return array
*/
protected function get_legacy_logdata() {
return array(SITEID, 'role', 'edit allow view', 'admin/roles/allow.php?mode=view');
}
}

View File

@ -80,37 +80,6 @@ class role_assigned extends base {
return new \moodle_url('/admin/roles/assign.php', array('contextid' => $this->contextid, 'roleid' => $this->objectid));
}
/**
* Does this event replace legacy event?
*
* @return null|string legacy event name
*/
public static function get_legacy_eventname() {
return 'role_assigned';
}
/**
* Legacy event data if get_legacy_eventname() is not empty.
*
* @return mixed
*/
protected function get_legacy_eventdata() {
return $this->get_record_snapshot('role_assignments', $this->other['id']);
}
/**
* Returns array of parameters to be passed to legacy add_to_log() function.
*
* @return array
*/
protected function get_legacy_logdata() {
$roles = get_all_roles();
$neededrole = array($this->objectid => $roles[$this->objectid]);
$rolenames = role_fix_names($neededrole, $this->get_context(), ROLENAME_ORIGINAL, true);
return array($this->courseid, 'role', 'assign', 'admin/roles/assign.php?contextid='.$this->contextid.'&roleid='.$this->objectid,
$rolenames[$this->objectid], '', $this->userid);
}
/**
* Custom validation.
*

View File

@ -83,25 +83,6 @@ class role_capabilities_updated extends base {
}
}
/**
* Sets legacy log data.
*
* @param array $legacylogdata
* @return void
*/
public function set_legacy_logdata($legacylogdata) {
$this->legacylogdata = $legacylogdata;
}
/**
* Returns array of parameters to be passed to legacy add_to_log() function.
*
* @return null|array
*/
protected function get_legacy_logdata() {
return $this->legacylogdata;
}
public static function get_objectid_mapping() {
return array('db' => 'role', 'restore' => 'role');
}

View File

@ -79,16 +79,6 @@ class role_deleted extends base {
return new \moodle_url('/admin/roles/manage.php');
}
/**
* Returns array of parameters to be passed to legacy add_to_log() function.
*
* @return array
*/
protected function get_legacy_logdata() {
return array(SITEID, 'role', 'delete', 'admin/roles/manage.php?action=delete&roleid=' . $this->objectid,
$this->other['shortname'], '');
}
/**
* Custom validation.
*

View File

@ -77,36 +77,6 @@ class role_unassigned extends base {
return new \moodle_url('/admin/roles/assign.php', array('contextid' => $this->contextid, 'roleid' => $this->objectid));
}
/**
* Does this event replace legacy event?
*
* @return null|string legacy event name
*/
public static function get_legacy_eventname() {
return 'role_unassigned';
}
/**
* Legacy event data if get_legacy_eventname() is not empty.
*
* @return mixed
*/
protected function get_legacy_eventdata() {
return $this->get_record_snapshot('role_assignments', $this->other['id']);
}
/**
* Returns array of parameters to be passed to legacy add_to_log() function.
*
* @return array
*/
protected function get_legacy_logdata() {
$roles = get_all_roles();
$rolenames = role_fix_names($roles, $this->get_context(), ROLENAME_ORIGINAL, true);
return array($this->courseid, 'role', 'unassign', 'admin/roles/assign.php?contextid='.$this->contextid.'&roleid='.$this->objectid,
$rolenames[$this->objectid], '', $this->userid);
}
/**
* Custom validation.
*

View File

@ -71,16 +71,6 @@ class role_updated extends base {
return new \moodle_url('/admin/roles/define.php', ['action' => 'edit', 'roleid' => $this->objectid]);
}
/**
* Returns array of parameters to be passed to legacy add_to_log() function.
*
* @return array
*/
protected function get_legacy_logdata() {
return [SITEID, 'role', 'update', 'admin/roles/manage.php?action=edit&roleid=' . $this->objectid,
$this->other['shortname'], ''];
}
/**
* Custom validation.
*

View File

@ -102,20 +102,6 @@ class tag_added extends base {
return $event;
}
/**
* Return legacy data for add_to_log().
*
* @return array
*/
protected function get_legacy_logdata() {
if ($this->other['itemtype'] === 'course') {
$url = 'tag/search.php?query=' . urlencode($this->other['tagrawname']);
return array($this->courseid, 'coursetags', 'add', $url, 'Course tagged');
}
return null;
}
/**
* Custom validation.
*

View File

@ -70,15 +70,6 @@ class tag_flagged extends base {
return "The user with id '$this->userid' flagged the tag with id '$this->objectid'.";
}
/**
* Return legacy data for add_to_log().
*
* @return array
*/
protected function get_legacy_logdata() {
return array(SITEID, 'tag', 'flag', 'index.php?id='. $this->objectid, $this->objectid, '', $this->userid);
}
/**
* Custom validation.
*

View File

@ -73,28 +73,6 @@ class tag_updated extends base {
return "The user with id '$this->userid' updated the tag with id '$this->objectid'.";
}
/**
* Set the legacy data used for add_to_log().
*
* @param array $logdata
*/
public function set_legacy_logdata($logdata) {
$this->legacylogdata = $logdata;
}
/**
* Return legacy data for add_to_log().
*
* @return array
*/
protected function get_legacy_logdata() {
if (isset($this->legacylogdata)) {
return $this->legacylogdata;
}
return array($this->courseid, 'tag', 'update', 'index.php?id='. $this->objectid, $this->other['name']);
}
/**
* Custom validation.
*

View File

@ -77,33 +77,6 @@ class user_created extends base {
return new \moodle_url('/user/view.php', array('id' => $this->objectid));
}
/**
* Return name of the legacy event, which is replaced by this event.
*
* @return string legacy event name
*/
public static function get_legacy_eventname() {
return 'user_created';
}
/**
* Return user_created legacy event data.
*
* @return \stdClass user data.
*/
protected function get_legacy_eventdata() {
return $this->get_record_snapshot('user', $this->objectid);
}
/**
* Returns array of parameters to be passed to legacy add_to_log() function.
*
* @return array
*/
protected function get_legacy_logdata() {
return array(SITEID, 'user', 'add', '/view.php?id='.$this->objectid, fullname($this->get_legacy_eventdata()));
}
/**
* Custom validation.
*

View File

@ -72,41 +72,6 @@ class user_deleted extends base {
return "The user with id '$this->userid' deleted the user with id '$this->objectid'.";
}
/**
* Return name of the legacy event, which is replaced by this event.
*
* @return string legacy event name
*/
public static function get_legacy_eventname() {
return 'user_deleted';
}
/**
* Return user_deleted legacy event data.
*
* @return \stdClass user data.
*/
protected function get_legacy_eventdata() {
$user = $this->get_record_snapshot('user', $this->objectid);
$user->deleted = 0;
$user->username = $this->other['username'];
$user->email = $this->other['email'];
$user->idnumber = $this->other['idnumber'];
$user->picture = $this->other['picture'];
return $user;
}
/**
* Returns array of parameters to be passed to legacy add_to_log() function.
*
* @return array
*/
protected function get_legacy_logdata() {
$user = $this->get_record_snapshot('user', $this->objectid);
return array(SITEID, 'user', 'delete', 'view.php?id=' . $user->id, $user->firstname . ' ' . $user->lastname);
}
/**
* Custom validation.
*

View File

@ -78,36 +78,6 @@ class user_enrolment_created extends base {
return new \moodle_url('/user/index.php', array('id' => $this->courseid));
}
/**
* Return name of the legacy event, which is replaced by this event.
*
* @return string legacy event name
*/
public static function get_legacy_eventname() {
return 'user_enrolled';
}
/**
* Return user_enrolled legacy event data.
*
* @return \stdClass
*/
protected function get_legacy_eventdata() {
$legacyeventdata = $this->get_record_snapshot('user_enrolments', $this->objectid);
$legacyeventdata->enrol = $this->other['enrol'];
$legacyeventdata->courseid = $this->courseid;
return $legacyeventdata;
}
/**
* Return legacy data for add_to_log().
*
* @return array
*/
protected function get_legacy_logdata() {
return array($this->courseid, 'course', 'enrol', '../enrol/users.php?id=' . $this->courseid, $this->courseid);
}
/**
* Custom validation.
*

View File

@ -79,33 +79,6 @@ class user_enrolment_deleted extends base {
return new \moodle_url('/user/index.php', array('id' => $this->courseid));
}
/**
* Return name of the legacy event, which is replaced by this event.
*
* @return string legacy event name
*/
public static function get_legacy_eventname() {
return 'user_unenrolled';
}
/**
* Return user_unenrolled legacy event data.
*
* @return \stdClass
*/
protected function get_legacy_eventdata() {
return (object)$this->other['userenrolment'];
}
/**
* Return legacy data for add_to_log().
*
* @return array
*/
protected function get_legacy_logdata() {
return array($this->courseid, 'course', 'unenrol', '../enrol/users.php?id=' . $this->courseid, $this->courseid);
}
/**
* Custom validation.
*

View File

@ -78,27 +78,6 @@ class user_enrolment_updated extends base {
return new \moodle_url('/enrol/editenrolment.php', array('ue' => $this->objectid));
}
/**
* Return name of the legacy event, which is replaced by this event.
*
* @return string legacy event name
*/
public static function get_legacy_eventname() {
return 'user_enrol_modified';
}
/**
* Return user_enrol_modified legacy event data.
*
* @return \stdClass
*/
protected function get_legacy_eventdata() {
$legacyeventdata = $this->get_record_snapshot('user_enrolments', $this->objectid);
$legacyeventdata->enrol = $this->other['enrol'];
$legacyeventdata->courseid = $this->courseid;
return $legacyeventdata;
}
/**
* Custom validation.
*

Some files were not shown because too many files have changed in this diff Show More