From 7e4364c8036c07d9ecca848c81ace7b61a69dd83 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 25 Sep 2010 22:27:49 +1200 Subject: [PATCH] If we get NULL for a new sync token reset so we sync everything. --- inc/caldav-REPORT-sync-collection.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/inc/caldav-REPORT-sync-collection.php b/inc/caldav-REPORT-sync-collection.php index 3a7da1fa..18e1ed3b 100644 --- a/inc/caldav-REPORT-sync-collection.php +++ b/inc/caldav-REPORT-sync-collection.php @@ -42,6 +42,16 @@ if ( !$qry->Exec("REPORT",__LINE__,__FILE__) || $qry->rows() <= 0 ) { $request->DoResponse( 500, translate("Database error") ); } $row = $qry->Fetch(); + +if ( !isset($row->new_sync_token) ) { + /** If we got a null back then they gave us a sync token we know not of, so provide a full sync */ + $sync_token =0; + $params[':sync_token'] = $sync_token; + if ( !$qry->QDo($sql, $params) || $qry->rows() <= 0 ) { + $request->DoResponse( 500, translate("Database error") ); + } + $row = $qry->Fetch(); +} $new_token = $row->new_sync_token; if ( $sync_token == 0 ) {