From 8fb730e01acbca14ac5e3f111218b818f92573fc Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 20 Feb 2014 19:26:22 +0000 Subject: [PATCH] fixed missing sorting in inital sync-collection report with empty sync-token --- addressbook/inc/class.addressbook_groupdav.inc.php | 6 ++++-- calendar/inc/class.calendar_groupdav.inc.php | 10 ++++++---- infolog/inc/class.infolog_groupdav.inc.php | 10 ++++++---- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/addressbook/inc/class.addressbook_groupdav.inc.php b/addressbook/inc/class.addressbook_groupdav.inc.php index 1ec86bace9..67b230c294 100644 --- a/addressbook/inc/class.addressbook_groupdav.inc.php +++ b/addressbook/inc/class.addressbook_groupdav.inc.php @@ -155,6 +155,9 @@ class addressbook_groupdav extends groupdav_handler $files['sync-token-params'] = array($path, $user); $this->sync_collection_token = null; + + $filter['order'] = 'contact_modified ASC'; // return oldest modifications first + $filter['sync-collection'] = true; } if (isset($nresults)) @@ -207,7 +210,7 @@ class addressbook_groupdav extends groupdav_handler $order = 'egw_addressbook.contact_id'; } // detect sync-collection report - $sync_collection_report = isset($filter[0]) && strpos($filter[0], 'contact_modified>') === 0; + $sync_collection_report = $filter['sync-collection']; if (isset($filter_in[self::$path_attr]) && !is_array($filter_in[self::$path_attr])) { @@ -484,7 +487,6 @@ class addressbook_groupdav extends groupdav_handler $sync_token = array_pop($parts); $filters[] = 'contact_modified>'.(int)$sync_token; $filters['tid'] = null; // to return deleted entries too - $filters['order'] = 'contact_modified ASC'; // return oldest modifications first } break; case 'sync-level': diff --git a/calendar/inc/class.calendar_groupdav.inc.php b/calendar/inc/class.calendar_groupdav.inc.php index a3b0cf6c1d..976eefe5dc 100644 --- a/calendar/inc/class.calendar_groupdav.inc.php +++ b/calendar/inc/class.calendar_groupdav.inc.php @@ -220,6 +220,11 @@ class calendar_groupdav extends groupdav_handler $files['sync-token-params'] = array($path, $user); $this->sync_collection_token = null; + + $filter['order'] = 'cal_modified ASC'; // return oldest modifications first + $filter['sync-collection'] = true; + // no end-date / limit into the future, as unchanged entries would never be transferted later on + unset($filter['end']); } if (isset($nresults)) @@ -267,7 +272,7 @@ class calendar_groupdav extends groupdav_handler $filter['num_rows'] = $start[1]; } $requested_multiget_ids = (array)$filter['query'][self::$path_attr]; - $sync_collection = strpos($filter['query'][0],'cal_modified>') === 0 && $filter['filter'] == 'everything'; + $sync_collection = $filter['sync-collection']; $events =& $this->bo->search($filter); @@ -496,12 +501,9 @@ class calendar_groupdav extends groupdav_handler $sync_token = array_pop($parts); $cal_filters['query'][] = 'cal_modified>'.(int)$sync_token; $cal_filters['filter'] = 'everything'; // to return deleted entries too - $cal_filters['order'] = 'cal_modified ASC'; // return oldest modifications first // no standard time-range! unset($cal_filters['start']); } - // no end-date / limit into the future, as unchanged entries would never be transferted later on - unset($cal_filters['end']); break; case 'sync-level': if ($option['data'] != '1') diff --git a/infolog/inc/class.infolog_groupdav.inc.php b/infolog/inc/class.infolog_groupdav.inc.php index d518cdf4a1..dd1f3a4087 100644 --- a/infolog/inc/class.infolog_groupdav.inc.php +++ b/infolog/inc/class.infolog_groupdav.inc.php @@ -188,6 +188,9 @@ class infolog_groupdav extends groupdav_handler $files['sync-token-params'] = array($path, $user); $this->sync_collection_token = null; + + $filter['order'] = 'info_datemodified ASC'; // return oldest modifications first + $filter['sync-collection'] = true; } if (isset($nresults)) @@ -306,15 +309,15 @@ class infolog_groupdav extends groupdav_handler } } // sync-collection report --> return modified of last contact as sync-token - $sync_collection_report = strpos($task_filter, '+deleted') !== false; + $sync_collection_report = $filter['sync-collection']; if ($sync_collection_report) { - $this->sync_collection_token = $info['date_modified']; + $this->sync_collection_token = $task['date_modified']; // hack to support limit with sync-collection report: tasks are returned in modified ASC order (oldest first) // if limit is smaller then full result, return modified-1 as sync-token, so client requests next chunk incl. modified // (which might contain further entries with identical modification time) - if ($start[0] == 0 && $start[1] != groupdav_propfind_iterator::CHUNK_SIZE && $query['total'] > $start[1]) + if ($start[0] == 0 && $start[1] != groupdav_propfind_iterator::CHUNK_SIZE && $this->bo->total > $start[1]) { --$this->sync_collection_token; } @@ -408,7 +411,6 @@ class infolog_groupdav extends groupdav_handler $sync_token = array_pop($parts); $cal_filters[] = 'info_datemodified>'.(int)$sync_token; $cal_filters['filter'] .= '+deleted'; // to return deleted entries too - $cal_filters['order'] = 'info_datemodified ASC'; // return oldest modifications first } break; case 'sync-level':