Branch 'kolab-syncroton-2.2' - lib/kolab_sync_backend.php
Aleksander Machniak
machniak at kolabsys.com
Tue Aug 26 08:23:28 CEST 2014
lib/kolab_sync_backend.php | 25 +++++++------------------
1 file changed, 7 insertions(+), 18 deletions(-)
New commits:
commit 20da9e2d23233f8c50d792fcf2ca958390c62adc
Author: Aleksander Machniak <alec at alec.pl>
Date: Tue Aug 26 08:22:10 2014 +0200
Performance improvement in modseq_get() (related to last commit)
diff --git a/lib/kolab_sync_backend.php b/lib/kolab_sync_backend.php
index d954191..b4bd3ca 100644
--- a/lib/kolab_sync_backend.php
+++ b/lib/kolab_sync_backend.php
@@ -838,28 +838,17 @@ class kolab_sync_backend
$synctime = $synctime->format('YmdHis');
if (empty($this->modseq[$folderid][$synctime])) {
+ $this->modseq[$folderid] = array();
+
$rcube = rcube::get_instance();
$db = $rcube->get_dbh();
- $db->query("SELECT data, synctime FROM syncroton_modseq"
- ." WHERE device_id = ? AND folder_id = ? AND synctime = ?",
- $deviceid, $folderid, $synctime);
-
- $row = $db->fetch_assoc();
-
- // record doesn't exist, get previous one
- if (!$row) {
- $db->limitquery("SELECT data, synctime FROM syncroton_modseq"
- ." WHERE device_id = ? AND folder_id = ? AND synctime < ?"
- ." ORDER BY synctime DESC",
- 0, 1, $deviceid, $folderid, $synctime);
-
- $row = $db->fetch_assoc();
- }
-
- $this->modseq[$folderid] = array();
+ $db->limitquery("SELECT data, synctime FROM syncroton_modseq"
+ ." WHERE device_id = ? AND folder_id = ? AND synctime <= ?"
+ ." ORDER BY synctime DESC",
+ 0, 1, $deviceid, $folderid, $synctime);
- if ($row) {
+ if ($row = $db->fetch_assoc()) {
$synctime = $row['synctime'];
$this->modseq[$folderid][$synctime] = json_decode($row['data']);
}
More information about the commits
mailing list