Merge branch 'MDL-74141-311' of https://github.com/sarjona/moodle into MOODLE_311_STABLE
This commit is contained in:
@@ -54,12 +54,16 @@ if (!$task) {
|
||||
throw new moodle_exception('cannotfindinfo', 'error', new moodle_url('/admin/tool/task/scheduledtasks.php'), $taskname);
|
||||
}
|
||||
|
||||
if (!\core\task\manager::is_runnable()) {
|
||||
$redirecturl = new \moodle_url('/admin/settings.php', ['section' => 'systempaths']);
|
||||
throw new moodle_exception('cannotfindthepathtothecli', 'tool_task', $redirecturl->out());
|
||||
}
|
||||
|
||||
$plugininfo = core_plugin_manager::instance()->get_plugin_info($task->get_component());
|
||||
$plugindisabled = $plugininfo && $plugininfo->is_enabled() === false &&
|
||||
!$task->get_run_if_component_disabled();
|
||||
|
||||
$canruntasks = \core\task\manager::is_runnable() && get_config('tool_task', 'enablerunnow');
|
||||
if (!$canruntasks || $plugindisabled) {
|
||||
if (!get_config('tool_task', 'enablerunnow') || $plugindisabled) {
|
||||
throw new moodle_exception('nopermissions', 'error', new moodle_url('/admin/tool/task/scheduledtasks.php'),
|
||||
get_string('runnow', 'tool_task'), $task->get_name());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user