MDL-53297 core_course: Final deprecation of xxx_delete_course callback

This commit is contained in:
cescobedo 2018-07-24 23:09:47 +02:00
parent 0180369b27
commit 605354de50
4 changed files with 9 additions and 23 deletions

View File

@ -8,6 +8,8 @@ Overview of this plugin type at http://docs.moodle.org/dev/Course_formats
Note that validate_format_options() is now always called when somebody creates or edits course or section and also
during restore and course upload. Default implementation validates against the definition of the form elements for
format options.
* The final deprecation of xxx_delete_course callback means that this function will no longer be called.
Please use the observer for event \core\event\course_content_deleted instead.
=== 3.5 ===
* Course formats should overwrite get_config_for_external function to return the course format settings viewable by the

View File

@ -4996,7 +4996,6 @@ function remove_course_contents($courseid, $showfeedback = true, array $options
include_once("$moddir/lib.php"); // Shows php warning only if plugin defective.
$moddelete = $modname .'_delete_instance'; // Delete everything connected to an instance.
$moddeletecourse = $modname .'_delete_course'; // Delete other stray stuff (uncommon).
if ($instances) {
foreach ($instances as $cm) {
@ -5022,12 +5021,6 @@ function remove_course_contents($courseid, $showfeedback = true, array $options
}
}
}
if (function_exists($moddeletecourse)) {
// Execute optional course cleanup callback. Deprecated since Moodle 3.2. TODO MDL-53297 remove in 3.6.
debugging("Callback delete_course is deprecated. Function $moddeletecourse should be converted " .
'to observer of event \core\event\course_content_deleted', DEBUG_DEVELOPER);
$moddeletecourse($course, $showfeedback);
}
if ($instances and $showfeedback) {
echo $OUTPUT->notification($strdeleted.get_string('pluginname', $modname), 'notifysuccess');
}
@ -5067,22 +5060,6 @@ function remove_course_contents($courseid, $showfeedback = true, array $options
echo $OUTPUT->notification($strdeleted.get_string('type_mod_plural', 'plugin'), 'notifysuccess');
}
// Cleanup the rest of plugins. Deprecated since Moodle 3.2. TODO MDL-53297 remove in 3.6.
$cleanuplugintypes = array('report', 'coursereport', 'format');
$callbacks = get_plugins_with_function('delete_course', 'lib.php');
foreach ($cleanuplugintypes as $type) {
if (!empty($callbacks[$type])) {
foreach ($callbacks[$type] as $pluginfunction) {
debugging("Callback delete_course is deprecated. Function $pluginfunction should be converted " .
'to observer of event \core\event\course_content_deleted', DEBUG_DEVELOPER);
$pluginfunction($course->id, $showfeedback);
}
if ($showfeedback) {
echo $OUTPUT->notification($strdeleted.get_string('type_'.$type.'_plural', 'plugin'), 'notifysuccess');
}
}
}
// Delete questions and question categories.
question_delete_course($course, $showfeedback);
if ($showfeedback) {

View File

@ -6,6 +6,8 @@ information provided here is intended especially for developers.
* The final deprecation of xxx_get_types() callback means that this function will no longer be called.
Please use get_shortcuts() instead.
* lti_get_shortcuts has been deprecated. Please use get_shortcuts() instead to add items to the activity chooser.
* The final deprecation of xxx_delete_course callback means that this function will no longer be called.
Please use the observer for event \core\event\course_content_deleted instead.
=== 3.5 ===

View File

@ -1,6 +1,11 @@
This files describes API changes in /report/* - plugins,
information provided here is intended especially for developers.
=== 3.6 ===
* The final deprecation of xxx_delete_course callback means that this function will no longer be called.
Please use the observer for event \core\event\course_content_deleted instead.
=== 3.2 ===
* Callback delete_course is deprecated and should be replaced with observer for event \core\event\course_content_deleted
* The report_log_print_graph signature and behaviour has changed to generate charts using