lib/kolab_sync_backend.php

Aleksander Machniak machniak at kolabsys.com
Mon Aug 25 13:58:13 CEST 2014


 lib/kolab_sync_backend.php |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit c6f3c1e31e93bba51b1ff86f5e180f8cb943500d
Author: Aleksander Machniak <alec at alec.pl>
Date:   Mon Aug 25 13:57:53 2014 +0200

    Fix removing old syncroton_modseq records

diff --git a/lib/kolab_sync_backend.php b/lib/kolab_sync_backend.php
index e7b4162..3fbf6cb 100644
--- a/lib/kolab_sync_backend.php
+++ b/lib/kolab_sync_backend.php
@@ -843,7 +843,7 @@ class kolab_sync_backend
         $synctime = $synctime->format('Ymdhis');
 
         if (!isset($this->modseq[$deviceid]) || !isset($this->modseq[$deviceid][$folderid])
-            || !isset($this->modseq[$deviceid][$synctime])
+            || !isset($this->modseq[$deviceid][$folderid][$synctime])
         ) {
             $rcube = rcube::get_instance();
             $db    = $rcube->get_dbh();
@@ -857,11 +857,11 @@ class kolab_sync_backend
                 $current = $row['synctime'];
                 $this->modseq[$deviceid][$folderid][$synctime] = json_decode($row['data']);
 
-                // Cleanup: remove old records (older than 12 hours from the last one)
-                if (($row = $db->fetch_assoc()) && $row['synctime'] < $current - 86400) {
+                // Cleanup: remove old records (keep last two)
+                if ($row = $db->fetch_assoc()) {
                     $db->query("DELETE FROM syncroton_modseq"
                         ." WHERE device_id = ? AND folder_id = ? AND synctime < ?",
-                    $deviceid, $folderid, $current - 86400);
+                    $deviceid, $folderid, $row['synctime']);
                 }
             }
         }




More information about the commits mailing list