示例#1
0
 /**
  * Removes given execution from list
  *
  * @param int $executionID Id of the execution to remove.
  * @param \Exception $failure An exception to signal a failed execution
  * @return void
  */
 public function unmarkExecution($executionID, \Exception $failure = null)
 {
     // Get the executions for the task
     $queryArr = array('SELECT' => 'serialized_executions', 'FROM' => 'tx_scheduler_task', 'WHERE' => 'uid = ' . $this->taskUid, 'LIMIT' => 1);
     $res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryArr);
     if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
         if ($row['serialized_executions'] !== '') {
             $runningExecutions = unserialize($row['serialized_executions']);
             // Remove the selected execution
             unset($runningExecutions[$executionID]);
             if (!empty($runningExecutions)) {
                 // Re-serialize the updated executions list (if necessary)
                 $runningExecutionsSerialized = serialize($runningExecutions);
             } else {
                 $runningExecutionsSerialized = '';
             }
             if ($failure instanceof \Exception) {
                 // Log failed execution
                 $logMessage = 'Task failed to execute successfully. Class: ' . get_class($this) . ', UID: ' . $this->taskUid . '. ' . $failure->getMessage();
                 $this->scheduler->log($logMessage, 1, $failure->getCode());
                 // Do not serialize the complete exception or the trace, this can lead to huge strings > 50MB
                 $failureString = serialize(array('code' => $failure->getCode(), 'message' => $failure->getMessage(), 'file' => $failure->getFile(), 'line' => $failure->getLine(), 'traceString' => $failure->getTraceAsString()));
             } else {
                 $failureString = '';
             }
             // Save the updated executions list
             $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_scheduler_task', 'uid = ' . $this->taskUid, array('serialized_executions' => $runningExecutionsSerialized, 'lastexecution_failure' => $failureString));
         }
     }
     $GLOBALS['TYPO3_DB']->sql_free_result($res);
 }
示例#2
0
 /**
  * Removes given execution from list
  *
  * @param integer $executionID Id of the execution to remove.
  * @param \Exception $failure An exception to signal a failed execution
  * @return 	void
  */
 public function unmarkExecution($executionID, \Exception $failure = NULL)
 {
     // Get the executions for the task
     $queryArr = array('SELECT' => 'serialized_executions', 'FROM' => 'tx_scheduler_task', 'WHERE' => 'uid = ' . $this->taskUid, 'LIMIT' => 1);
     $res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryArr);
     if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
         if (strlen($row['serialized_executions']) > 0) {
             $runningExecutions = unserialize($row['serialized_executions']);
             // Remove the selected execution
             unset($runningExecutions[$executionID]);
             if (count($runningExecutions) > 0) {
                 // Re-serialize the updated executions list (if necessary)
                 $runningExecutionsSerialized = serialize($runningExecutions);
             } else {
                 $runningExecutionsSerialized = '';
             }
             if ($failure instanceof \Exception) {
                 // Log failed execution
                 $logMessage = 'Task failed to execute successfully. Class: ' . get_class($this) . ', UID: ' . $this->taskUid . '. ' . $failure->getMessage();
                 $this->scheduler->log($logMessage, 1, $failure->getCode());
                 $failure = serialize($failure);
             } else {
                 $failure = '';
             }
             // Save the updated executions list
             $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_scheduler_task', 'uid = ' . $this->taskUid, array('serialized_executions' => $runningExecutionsSerialized, 'lastexecution_failure' => $failure));
         }
     }
     $GLOBALS['TYPO3_DB']->sql_free_result($res);
 }