fix import job execution frequency
authorCornelius Weiß <c.weiss@metaways.de>
Fri, 4 Nov 2016 11:23:08 +0000 (12:23 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Fri, 4 Nov 2016 12:18:40 +0000 (13:18 +0100)
- if timestamp is moved by increment, the job might run multiple times
  if it hasn't run for a while

Change-Id: I62f1853c6707ced285cc99b74755d585c15a8932
Reviewed-on: http://gerrit.tine20.com/customers/3731
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/Controller/ScheduledImport.php

index 1aa1218..036fff4 100644 (file)
@@ -209,21 +209,7 @@ class Tinebase_Controller_ScheduledImport extends Tinebase_Controller_Record_Abs
                 Tinebase_Exception::log($e);
             }
 
-            if ($record->interval === Tinebase_Model_Import::INTERVAL_ONCE || !$record->timestamp instanceof Tinebase_DateTime) {
-                $record->timestamp = Tinebase_DateTime::now();
-            }
-
-            switch ($record->interval) {
-                case Tinebase_Model_Import::INTERVAL_DAILY:
-                    $record->timestamp->addDay(1);
-                    break;
-                case Tinebase_Model_Import::INTERVAL_WEEKLY:
-                    $record->timestamp->addWeek(1);
-                    break;
-                case Tinebase_Model_Import::INTERVAL_HOURLY:
-                    $record->timestamp->addHour(1);
-                    break;
-            }
+            $record->timestamp = Tinebase_DateTime::now();
 
             // update record
             $record = $this->update($record);