mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
Merge branch 'wip-mdl-42557' of https://github.com/rajeshtaneja/moodle
This commit is contained in:
commit
7d3cdcc90d
@ -1534,6 +1534,10 @@ class core_course_courselib_testcase extends advanced_testcase {
|
||||
$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.
|
||||
$course->context = $coursecontext;
|
||||
$this->assertEventLegacyData($course, $event);
|
||||
|
@ -71,7 +71,7 @@ class course_deleted extends base {
|
||||
protected function get_legacy_eventdata() {
|
||||
$course = $this->get_record_snapshot('course', $this->objectid);
|
||||
$course->context = $this->context;
|
||||
|
||||
$course->timemodified = $this->data['timecreated'];
|
||||
return $course;
|
||||
}
|
||||
|
||||
|
@ -4852,10 +4852,6 @@ function delete_course($courseorid, $showfeedback = true) {
|
||||
// Delete the course and related context instance.
|
||||
context_helper::delete_instance(CONTEXT_COURSE, $courseid);
|
||||
|
||||
// We will update the course's timemodified, as it will be passed to the course_deleted event,
|
||||
// which should know about this updated property, as this event is meant to pass the full course record.
|
||||
$course->timemodified = time();
|
||||
|
||||
$DB->delete_records("course", array("id" => $courseid));
|
||||
$DB->delete_records("course_format_options", array("courseid" => $courseid));
|
||||
|
||||
@ -4863,8 +4859,11 @@ function delete_course($courseorid, $showfeedback = true) {
|
||||
$event = \core\event\course_deleted::create(array(
|
||||
'objectid' => $course->id,
|
||||
'context' => $context,
|
||||
'other' => array('shortname' => $course->shortname,
|
||||
'fullname' => $course->fullname)
|
||||
'other' => array(
|
||||
'shortname' => $course->shortname,
|
||||
'fullname' => $course->fullname,
|
||||
'idnumber' => $course->idnumber
|
||||
)
|
||||
));
|
||||
$event->add_record_snapshot('course', $course);
|
||||
$event->trigger();
|
||||
|
Loading…
x
Reference in New Issue
Block a user