This commit is contained in:
Ilya Tregubov 2024-02-01 10:26:14 +08:00
commit 29e492c22e
2 changed files with 11 additions and 2 deletions

View File

@ -80,6 +80,9 @@ $string['runnow'] = 'Run now';
$string['runagain'] = 'Run again';
$string['runadhoc_confirm'] = 'Tasks will run on the web server and may take some time to complete.';
$string['runadhoc'] = 'Run ad hoc tasks now?';
$string['runadhoctask'] = 'Run \'{$a->task}\' task ID {$a->taskid}';
$string['runadhoctasks'] = 'Run all \'{$a}\' tasks';
$string['runadhoctasksfailed'] = 'Run failed \'{$a}\' tasks';
$string['runnow_confirm'] = 'Are you sure you want to run this task \'{$a}\' now? The task will run on the web server and may take some time to complete.';
$string['runclassname'] = 'Run all';
$string['runclassnamefailedonly'] = 'Run all failed';

View File

@ -54,13 +54,19 @@ if ($taskid) {
throw new \moodle_exception('invalidtaskid');
}
$classname = $record->classname;
$heading = "Run $classname task Id $taskid";
$heading = get_string('runadhoctask', 'tool_task', ['task' => $classname, 'taskid' => $taskid]);
$tasks = [core\task\manager::adhoc_task_from_record($record)];
} else {
if (!$classname) {
throw new \moodle_exception('noclassname', 'tool_task');
}
$heading = "Run " . s($classname) . " " . ($failedonly ? "failed" : "all")." tasks";
$heading = get_string(
$failedonly ? 'runadhoctasksfailed' : 'runadhoctasks',
'tool_task',
s($classname),
);
$now = time();
$tasks = array_filter(
core\task\manager::get_adhoc_tasks($classname, $failedonly, true),