fixed missing sorting in inital sync-collection report with empty sync-token

This commit is contained in:
Ralf Becker 2014-02-20 19:26:22 +00:00
parent b54e77f266
commit 8fb730e01a
3 changed files with 16 additions and 10 deletions

View File

@ -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':

View File

@ -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')

View File

@ -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':