/** * Return task * * @return \TYPO3\CMS\Scheduler\Task\AbstractTask */ protected function getTask() { $taskId = (int) $this->cli->cli_argValue('-i'); if ($this->cli->cli_isArg('-f') || $this->cli->cli_isArg('-s')) { $task = $this->scheduler->fetchTask($taskId); } else { $whereClause = 'uid = ' . $taskId . ' AND nextexecution != 0 AND nextexecution <= ' . $GLOBALS['EXEC_TIME']; list($task) = $this->scheduler->fetchTasksWithCondition($whereClause); } return $task; }
/** * Execute a single task * * @param int $taskId * @param bool $forceExecution */ protected function executeSingleTask($taskId, $forceExecution) { // Force the execution of the task even if it is disabled or no execution scheduled if ($forceExecution) { $task = $this->scheduler->fetchTask($taskId); } else { $whereClause = 'uid = ' . (int) $taskId . ' AND nextexecution != 0 AND nextexecution <= ' . (int) $GLOBALS['EXEC_TIME']; list($task) = $this->scheduler->fetchTasksWithCondition($whereClause); } if ($this->scheduler->isValidTaskObject($task)) { try { $this->scheduler->executeTask($task); } catch (\Exception $e) { } // Record the run in the system registry $this->scheduler->recordLastRun('cli-by-id'); } }