mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
MDL-50645 cache: get_plugins_with_function for more than one plugintype
This commit is contained in:
parent
9effa14810
commit
592ea4b975
2 changed files with 9 additions and 7 deletions
|
@ -4841,10 +4841,12 @@ function remove_course_contents($courseid, $showfeedback = true, array $options
|
||||||
|
|
||||||
// Cleanup the rest of plugins.
|
// Cleanup the rest of plugins.
|
||||||
$cleanuplugintypes = array('report', 'coursereport', 'format');
|
$cleanuplugintypes = array('report', 'coursereport', 'format');
|
||||||
|
$callbacks = get_plugins_with_function('delete_course', 'lib.php');
|
||||||
foreach ($cleanuplugintypes as $type) {
|
foreach ($cleanuplugintypes as $type) {
|
||||||
$plugins = get_plugin_list_with_function($type, 'delete_course', 'lib.php');
|
if (!empty($callbacks[$type])) {
|
||||||
foreach ($plugins as $plugin => $pluginfunction) {
|
foreach ($callbacks[$type] as $pluginfunction) {
|
||||||
$pluginfunction($course->id, $showfeedback);
|
$pluginfunction($course->id, $showfeedback);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($showfeedback) {
|
if ($showfeedback) {
|
||||||
echo $OUTPUT->notification($strdeleted.get_string('type_'.$type.'_plural', 'plugin'), 'notifysuccess');
|
echo $OUTPUT->notification($strdeleted.get_string('type_'.$type.'_plural', 'plugin'), 'notifysuccess');
|
||||||
|
|
|
@ -69,13 +69,13 @@ class manager {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Plugins.
|
// Plugins.
|
||||||
$types = \core_component::get_plugin_types();
|
$pluginswithfunction = get_plugins_with_function('myprofile_navigation', 'lib.php');
|
||||||
foreach ($types as $type => $dir) {
|
foreach ($pluginswithfunction as $plugins) {
|
||||||
$pluginlist = get_plugin_list_with_function($type, "myprofile_navigation", "lib.php");
|
foreach ($plugins as $function) {
|
||||||
foreach ($pluginlist as $function) {
|
|
||||||
$function($tree, $user, $iscurrentuser, $course);
|
$function($tree, $user, $iscurrentuser, $course);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$tree->sort_categories();
|
$tree->sort_categories();
|
||||||
return $tree;
|
return $tree;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue