diff --git a/inc/WritableCollection.php b/inc/WritableCollection.php index 6d2bb91e..68c78a3a 100644 --- a/inc/WritableCollection.php +++ b/inc/WritableCollection.php @@ -442,4 +442,46 @@ EOSQL; } + + /** + * + * @param unknown_type $some_old_token + */ + public function whatChangedSince( $some_old_token ) { + $params = array( ':collection_id' => $this->collection_id() ); + if ( $some_old_token == 0 || empty($some_old_token) ) { + $sql = <<= (SELECT modification_time FROM sync_tokens WHERE sync_token = :sync_token) + ORDER BY sync_changes.collection_id, sync_changes.dav_id, sync_changes.sync_time +EOSQL; + + } + $qry = new AwlQuery($sql, $params ); + + $changes = array(); + if ( $qry->Exec() && $qry->rows() ) { + while( $change = $qry->Fetch() ) { + $changes[$change->uid] = $change; + } + } + + return $changes; + } }