summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-08-25 11:57:53 (GMT)
committerAleksander Machniak <alec@alec.pl>2014-08-25 11:57:53 (GMT)
commitc6f3c1e31e93bba51b1ff86f5e180f8cb943500d (patch)
treeb3e86c64584d575c58e1c2acba8d5a8835dc876d
parent9be6b26bc8967daa2256aab5a09abb11d51c8dce (diff)
downloadkolab-syncroton-c6f3c1e31e93bba51b1ff86f5e180f8cb943500d.tar.gz
Fix removing old syncroton_modseq records
-rw-r--r--lib/kolab_sync_backend.php8
1 files changed, 4 insertions, 4 deletions
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']);
}
}
}