diff --git a/admin/tool/task/schedule_task.php b/admin/tool/task/schedule_task.php index 68b5ebd231a..aabd3de70ea 100644 --- a/admin/tool/task/schedule_task.php +++ b/admin/tool/task/schedule_task.php @@ -54,8 +54,12 @@ if (!$task) { throw new moodle_exception('cannotfindinfo', 'error', new moodle_url('/admin/tool/task/scheduledtasks.php'), $taskname); } -$canruntasks = \core\task\manager::is_runnable() && get_config('tool_task', 'enablerunnow'); -if (!$canruntasks || !$task->can_run()) { +if (!\core\task\manager::is_runnable()) { + $redirecturl = new \moodle_url('/admin/settings.php', ['section' => 'systempaths']); + throw new moodle_exception('cannotfindthepathtothecli', 'tool_task', $redirecturl->out()); +} + +if (!get_config('tool_task', 'enablerunnow') || !$task->can_run()) { throw new moodle_exception('nopermissions', 'error', new moodle_url('/admin/tool/task/scheduledtasks.php'), get_string('runnow', 'tool_task'), $task->get_name()); } diff --git a/lib/classes/task/manager.php b/lib/classes/task/manager.php index 48667b1f97a..636d4d0cc7b 100644 --- a/lib/classes/task/manager.php +++ b/lib/classes/task/manager.php @@ -1116,7 +1116,7 @@ class manager { if (!self::is_runnable()) { $redirecturl = new \moodle_url('/admin/settings.php', ['section' => 'systempaths']); - throw new \moodle_exception('cannotfindthepathtothecli', 'core_task', $redirecturl->out()); + throw new \moodle_exception('cannotfindthepathtothecli', 'tool_task', $redirecturl->out()); } else { // Shell-escaped path to the PHP binary. $phpbinary = escapeshellarg(self::find_php_cli_path());