Skip to content

Commit

Permalink
Merge branch 'MDL-74141-master' of https://github.com/sarjona/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Mar 15, 2022
2 parents 984669a + 730bc87 commit 337e740
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions admin/tool/task/schedule_task.php
Expand Up @@ -54,8 +54,12 @@ function tool_task_mtrace_wrapper($message, $eol) {
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());
}
Expand Down
2 changes: 1 addition & 1 deletion lib/classes/task/manager.php
Expand Up @@ -1116,7 +1116,7 @@ public static function run_from_cli(\core\task\task_base $task):bool {

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());
Expand Down

0 comments on commit 337e740

Please sign in to comment.