We should respond with sync-token if PROPFIND asks too.

This commit is contained in:
Andrew McMillan 2012-03-17 21:33:41 +13:00
parent 34cff0d299
commit a96c609cb4

View File

@ -1259,6 +1259,22 @@ EOQRY;
}
/**
* Returns the current sync_token for this collection, or the containing collection
*/
function sync_token() {
if ( !isset($this->sync_token) ) {
$sql = 'SELECT sync_token FROM sync_tokens WHERE collection_id = :collection_id ORDER BY sync_token DESC LIMIT 1';
$params = array( ':collection_id' => $this->collection_id());
$qry = new AwlQuery($sql, $params );
if ( !$qry->Exec() || !$row = $qry->Fetch() ) {
if ( !$qry->QDo('SELECT new_sync_token( 0, :collection_id) AS sync_token', $params) ) throw new Exception('Problem with database query');
}
$this->sync_token = 'data:,'.$row->sync_token;
}
return $this->sync_token;
}
/**
* Checks whether the target collection is publicly_readable
*/
@ -1608,6 +1624,11 @@ EOQRY;
$reply->NSElement($prop, $tag, $this->unique_tag() );
break;
case 'DAV::sync-token':
if ( ! $this->_is_collection ) return false;
$reply->NSElement($prop, $tag, $this->sync_token() );
break;
case 'http://calendarserver.org/ns/:calendar-proxy-read-for':
$proxy_type = 'read';
case 'http://calendarserver.org/ns/:calendar-proxy-write-for':