Branch 'kolab-syncroton-2.2' - lib/kolab_sync_backend.php
Aleksander Machniak
machniak at kolabsys.com
Mon Aug 25 14:29:31 CEST 2014
lib/kolab_sync_backend.php | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
New commits:
commit 0a9e2a1b0f4fef46dbf23a74b04da590d4ee9abe
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 7e7ea66..1f6fd26 100644
--- a/lib/kolab_sync_backend.php
+++ b/lib/kolab_sync_backend.php
@@ -841,7 +841,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();
@@ -855,11 +855,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