MDL-59287 course_module: switching to new function.

Instead of using *_refresh_events directly
course_module_update_calendar_events is called so
that all types of calendar events can be updated.
This commit is contained in:
Adrian Greeve
2017-07-10 09:41:21 +08:00
parent abbc76c9e5
commit 73d2d21d4c
2 changed files with 5 additions and 13 deletions
+3 -8
View File
@@ -1109,10 +1109,7 @@ function set_coursemodule_name($id, $name) {
grade_update_mod_grades($grademodule);
// Update calendar events with the new name.
$refresheventsfunction = $cm->modname . '_refresh_events';
if (function_exists($refresheventsfunction)) {
call_user_func($refresheventsfunction, $cm->course);
}
course_module_update_calendar_events($cm->modname, $grademodule, $cm);
return true;
}
@@ -3490,10 +3487,8 @@ function duplicate_module($course, $cm) {
moveto_module($cm, $section, $newcm);
// Update calendar events with the duplicated module.
$refresheventsfunction = $newcm->modname . '_refresh_events';
if (function_exists($refresheventsfunction)) {
call_user_func($refresheventsfunction, $newcm->course);
}
// The following line is to be removed in MDL-58906.
course_module_update_calendar_events($newcm->modname, null, $newcm);
// Trigger course module created event. We can trigger the event only if we know the newcmid.
$event = \core\event\course_module_created::create_from_cm($newcm);
+2 -5
View File
@@ -5175,11 +5175,6 @@ function shift_course_mod_dates($modname, $fields, $timeshift, $courseid, $modid
$return = $DB->execute($updatesql, $params) && $return;
}
$refreshfunction = $modname.'_refresh_events';
if (function_exists($refreshfunction)) {
$refreshfunction($courseid);
}
return $return;
}
@@ -5435,6 +5430,8 @@ function reset_course_userdata($data) {
} else {
debugging('Missing lib.php in '.$modname.' module!');
}
// Update calendar events for all modules.
course_module_bulk_update_calendar_events($modname, $data->courseid);
}
}