[TASK] Merge submodule fluid into core
[Packages/TYPO3.CMS.git] / typo3 / sysext / scheduler / Classes / Scheduler.php
index 5a52869..d901210 100644 (file)
@@ -4,7 +4,7 @@ namespace TYPO3\CMS\Scheduler;
 /***************************************************************
  *  Copyright notice
  *
- *  (c) 2005 Christian Jul Jensen <julle@typo3.org>
+ *  (c) 2005-2013 Christian Jul Jensen <julle@typo3.org>
  *
  *  All rights reserved
  *
@@ -401,10 +401,15 @@ class Scheduler implements \TYPO3\CMS\Core\SingletonInterface {
                $tasks = $this->fetchTasksWithCondition('');
                $nextExecution = FALSE;
                foreach ($tasks as $task) {
-                       /** @var $task \TYPO3\CMS\Scheduler\Task\AbstractTask */
-                       $tempNextExecution = $task->getNextDueExecution();
-                       if ($nextExecution === FALSE || $tempNextExecution < $nextExecution) {
-                               $nextExecution = $tempNextExecution;
+                       try {
+                               /** @var $task \TYPO3\CMS\Scheduler\Task\AbstractTask */
+                               $tempNextExecution = $task->getNextDueExecution();
+                               if ($nextExecution === FALSE || $tempNextExecution < $nextExecution) {
+                                       $nextExecution = $tempNextExecution;
+                               }
+                       } catch (\OutOfBoundsException $e) {
+                               // The event will not be executed again or has already ended - we don't have to consider it for
+                               // scheduling the next "at" run
                        }
                }
                if ($nextExecution !== FALSE) {