Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 35... Línea 35...
35
$tasksurl = '/admin/tool/task/adhoctasks.php';
35
$tasksurl = '/admin/tool/task/adhoctasks.php';
Línea 36... Línea 36...
36
 
36
 
37
// Allow execution of single task. This requires login and has different rules.
37
// Allow execution of single task. This requires login and has different rules.
38
$classname = optional_param('classname', null, PARAM_RAW);
38
$classname = optional_param('classname', null, PARAM_RAW);
-
 
39
$failedonly = optional_param('failedonly', false, PARAM_BOOL);
39
$failedonly = optional_param('failedonly', false, PARAM_BOOL);
40
$dueonly = optional_param('dueonly', false, PARAM_BOOL);
40
$taskid = optional_param('id', null, PARAM_INT);
41
$taskid = optional_param('id', null, PARAM_INT);
Línea 41... Línea 42...
41
$confirmed = optional_param('confirm', 0, PARAM_INT);
42
$confirmed = optional_param('confirm', 0, PARAM_INT);
42
 
43
 
43
if (!\core\task\manager::is_runnable()) {
44
if (!\core\task\manager::is_runnable()) {
44
    $redirecturl = new \moodle_url('/admin/settings.php', ['section' => 'systempaths']);
45
    $redirecturl = new \moodle_url('/admin/settings.php', ['section' => 'systempaths']);
Línea 45... Línea 46...
45
    throw new moodle_exception('cannotfindthepathtothecli', 'tool_task', $redirecturl->out());
46
    throw new moodle_exception('cannotfindthepathtothecli', 'tool_task', $redirecturl->out());
Línea 46... Línea 47...
46
}
47
}
47
 
48
 
48
$params = ['classname' => $classname, 'failedonly' => $failedonly, 'id' => $taskid];
49
$params = ['classname' => $classname, 'failedonly' => $failedonly, 'dueonly' => $dueonly, 'id' => $taskid];
49
 
50
 
Línea 67... Línea 68...
67
        s($classname),
68
        s($classname),
68
    );
69
    );
Línea 69... Línea 70...
69
 
70
 
70
    $now = time();
71
    $now = time();
71
    $tasks = array_filter(
72
    $tasks = array_filter(
72
        core\task\manager::get_adhoc_tasks($classname, $failedonly, true),
73
        core\task\manager::get_adhoc_tasks($classname, $failedonly, $dueonly, true),
73
        function ($t) use ($now) {
74
        function ($t) use ($now) {
74
            return $t->get_fail_delay() || $t->get_next_run_time() <= $now;
75
            return $t->get_fail_delay() || $t->get_next_run_time() <= $now;
75
        }
76
        }
76
    );
77
    );
Línea 128... Línea 129...
128
 
129
 
129
    echo html_writer::start_tag('pre', ['class' => 'task-output']);
130
    echo html_writer::start_tag('pre', ['class' => 'task-output']);
130
    \core\task\manager::run_adhoc_from_cli($taskid);
131
    \core\task\manager::run_adhoc_from_cli($taskid);
131
    echo html_writer::end_tag('pre');
132
    echo html_writer::end_tag('pre');
132
} else {
133
} else {
Línea 133... Línea 134...
133
    $repeat = core\task\manager::get_adhoc_tasks($classname, $failedonly, true);
134
    $repeat = core\task\manager::get_adhoc_tasks($classname, $failedonly, $dueonly, true);
134
 
135
 
-
 
136
    // Run failed first (if any). We have to run them separately anyway,
135
    // Run failed first (if any). We have to run them separately anyway,
137
    // because faildelay is observed if failed flag is not true.
136
    // because faildelay is observed if failed flag is not true.
138
    if (!$dueonly) {
137
    echo html_writer::tag('p', get_string('runningfailedtasks', 'tool_task'), ['class' => 'lead']);
139
        echo html_writer::tag('p', get_string('runningfailedtasks', 'tool_task'), ['class' => 'lead']);
138
    echo html_writer::start_tag('pre', ['class' => 'task-output']);
140
        echo html_writer::start_tag('pre', ['class' => 'task-output']);
-
 
141
        \core\task\manager::run_all_adhoc_from_cli(true, $classname);
Línea 139... Línea 142...
139
    \core\task\manager::run_all_adhoc_from_cli(true, $classname);
142
        echo html_writer::end_tag('pre');
140
    echo html_writer::end_tag('pre');
143
    }
141
 
144
 
142
    if (!$failedonly) {
145
    if (!$failedonly) {