MDL-58777 core: Use component_callback in refresh events task
Previously we did not require the lib.php files for each module in this ad-hoc task, which meant that the *_refresh_events functions would only be called if some lucky sequence of events led to the lib.php file for the module being required. Instead we should use the component_callback function which can handle that stuff automagically.
This commit is contained in:
@@ -59,10 +59,9 @@ class refresh_mod_calendar_events_task extends adhoc_task {
|
||||
continue;
|
||||
}
|
||||
// Check if the plugin implements *_refresh_events() and call it when it does.
|
||||
$refresheventsfunction = $plugin->name . '_refresh_events';
|
||||
if (function_exists($refresheventsfunction)) {
|
||||
mtrace('Calling ' . $refresheventsfunction);
|
||||
call_user_func($refresheventsfunction);
|
||||
if (component_callback_exists('mod_' . $plugin->name, 'refresh_events')) {
|
||||
mtrace('Refreshing events for ' . $plugin->name);
|
||||
component_callback('mod_' . $plugin->name, 'refresh_events');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user