2 namespace TYPO3\CMS\Scheduler\Controller;
48 $this->cli->cli_options = array();
49 $this->cli->cli_options[] = array(
'-h',
'Show this output');
50 $this->cli->cli_options[] = array(
'--help',
'Same as -h');
51 $this->cli->cli_options[] = array(
'-s',
'Stop the task which is passed with -i option');
52 $this->cli->cli_options[] = array(
'-i',
'UID of an task');
53 $this->cli->cli_options[] = array(
'-f',
'Force execution of the task which is passed with -i option');
56 $this->cli->cli_help[
'name'] =
'scheduler -- Start the TYPO3 Scheduler from the command line';
57 $this->cli->cli_help[
'synopsis'] =
'###OPTIONS###';
58 $this->cli->cli_help[
'description'] =
'This command line starts any task';
59 $this->cli->cli_help[
'examples'] =
'typo3/cli_dispatch.phpsh scheduler';
60 unset($this->cli->cli_help[
'author']);
70 return ($this->cli->cli_isArg(
'--help') && $this->cli->cli_isArg(
'--help') > 0)
71 || ($this->cli->cli_isArg(
'-h') && $this->cli->cli_isArg(
'-h') > 0);
81 $this->cli->cli_help();
85 if ($this->cli->cli_isArg(
'-i') && $this->cli->cli_isArg(
'-i') > 0) {
88 if ($this->scheduler->isValidTaskObject($task)) {
89 if ($this->cli->cli_isArg(
'-s')) {
92 $this->scheduler->executeTask($task);
96 $this->scheduler->recordLastRun(
'cli-by-id');
110 if ($this->scheduler->isValidTaskObject($task)) {
111 $result = $task->unmarkAllExecutions();
122 $taskId = (int)$this->cli->cli_argValue(
'-i');
124 if ($this->cli->cli_isArg(
'-f') || $this->cli->cli_isArg(
'-s')) {
125 $task = $this->scheduler->fetchTask($taskId);
127 $whereClause =
'uid = ' . $taskId .
' AND nextexecution != 0 AND nextexecution <= ' .
$GLOBALS[
'EXEC_TIME'];
128 list($task) = $this->scheduler->fetchTasksWithCondition($whereClause);
137 protected function loopTasks()
144 $task = $this->scheduler->fetchTask();
146 $this->scheduler->executeTask($task);
147 }
catch (\Exception $e) {
153 }
catch (\OutOfBoundsException $e) {
154 $this->hasTask =
false;
155 }
catch (\UnexpectedValueException $e) {
158 }
while ($this->hasTask);
160 $this->scheduler->recordLastRun();