Index: class.tx_scheduler_task.php =================================================================== --- class.tx_scheduler_task.php (revision 1114) +++ class.tx_scheduler_task.php (working copy) @@ -121,8 +121,9 @@ * It MUST be implemented by all classes inheriting from this one * Note that there is no error handling, errors and failures are expected * to be handled and logged by the client implementations. + * Should return true on successful execution, false on error. * - * @return void + * @return boolean Returns true on successful execution, false on error */ abstract public function execute(); @@ -427,10 +428,11 @@ /** * Removes given execution from list * - * @param integer $executionID: id of the execution to remove + * @param integer Id of the execution to remove. + * @param boolean Status of the last execution, true for success, false to represent an error. * @return void */ - public function unmarkExecution($executionID) { + public function unmarkExecution($executionID, $successfullyExecuted = false) { // Get the executions for the task $queryArr = array( 'SELECT' => 'serialized_executions', @@ -456,7 +458,10 @@ $GLOBALS['TYPO3_DB']->exec_UPDATEquery( 'tx_scheduler_task', 'uid = ' . intval($this->taskUid), - array('serialized_executions' => $runningExecutionsSerialized) + array( + 'serialized_executions' => $runningExecutionsSerialized, + 'lastexecution_success' => (int) $successfullyExecuted + ) ); } } Index: mod1/index.php =================================================================== --- mod1/index.php (revision 1115) +++ mod1/index.php (working copy) @@ -860,6 +860,11 @@ $executionStatus = 'disabled'; } + // a failure is the worst thing that could happen, so it must overwrite all other statuses + if (!empty($schedulerRecord['lastexecution_time']) && !$schedulerRecord['lastexecution_success']) { + $executionStatus = 'failure'; + } + // formatting the execution status $executionStatus = '' . $GLOBALS['LANG']->getLL('status.' . $executionStatus) . ''; @@ -889,10 +894,11 @@ $content .= '

' . $GLOBALS['LANG']->getLL('status.legend') . ':

'; Index: mod1/locallang.xml =================================================================== --- mod1/locallang.xml (revision 1115) +++ mod1/locallang.xml (working copy) @@ -88,10 +88,12 @@ + + Index: ext_tables.sql =================================================================== --- ext_tables.sql (revision 1114) +++ ext_tables.sql (working copy) @@ -8,6 +8,7 @@ crid varchar(255) DEFAULT '' NOT NULL, nextexecution int(11) unsigned DEFAULT '0' NOT NULL, lastexecution_time int(11) unsigned DEFAULT '0' NOT NULL, + lastexecution_success int(1) unsigned DEFAULT '0' NOT NULL, lastexecution_context char(3) DEFAULT '' NOT NULL, serialized_task_object text NOT NULL, serialized_executions text NOT NULL, Index: examples/class.tx_scheduler_sleeptask.php =================================================================== --- examples/class.tx_scheduler_sleeptask.php (revision 1114) +++ examples/class.tx_scheduler_sleeptask.php (working copy) @@ -55,6 +55,8 @@ } sleep($time); + + return true; } } Index: examples/class.tx_scheduler_testtask.php =================================================================== --- examples/class.tx_scheduler_testtask.php (revision 1114) +++ examples/class.tx_scheduler_testtask.php (working copy) @@ -49,6 +49,7 @@ * @return void */ public function execute() { + $success = false; if (!empty($this->email)) { // If an email address is defined, send a message to it @@ -100,11 +101,13 @@ $mailer->setRecipient($this->email); $mailer->setHeaders(); $mailer->setContent(); - $mailer->sendtheMail(); + $success = $mailer->sendtheMail(); } else { // No email defined, just log the task t3lib_div::devLog('[tx_scheduler_testtask]: No email address given', 'scheduler', 2); } + + return $success; } } Index: class.tx_scheduler.php =================================================================== --- class.tx_scheduler.php (revision 1114) +++ class.tx_scheduler.php (working copy) @@ -203,10 +203,10 @@ $executionID = $task->markExecution(); // Execute task - $task->execute(); + $successfullyExecuted = $task->execute(); // Unregister excution - $task->unmarkExecution($executionID); + $task->unmarkExecution($executionID, $successfullyExecuted); // Log completion of execution $GLOBALS['BE_USER']->writelog(