/**
  * 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');
     }
 }
示例#2
0
	/**
	 * Stop task
	 *
	 * @param \TYPO3\CMS\Scheduler\Task\AbstractTask $task
	 */
	protected function stopTask($task) {
		if ($this->scheduler->isValidTaskObject($task)) {
			$result = $task->unmarkAllExecutions();
		}
	}