From 6d8aabab2347feabdd804b609dcd4513f09f78d4 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 11 Feb 2022 09:21:19 +0000 Subject: composer libs minor version updates --- vendor/sabre/dav/lib/CalDAV/Backend/PDO.php | 51 +++++++++++++++------- vendor/sabre/dav/lib/CalDAV/Calendar.php | 13 +++++- vendor/sabre/dav/lib/CalDAV/Plugin.php | 2 +- vendor/sabre/dav/lib/CalDAV/Schedule/Plugin.php | 4 +- .../dav/lib/CalDAV/Subscriptions/Subscription.php | 2 +- 5 files changed, 50 insertions(+), 22 deletions(-) (limited to 'vendor/sabre/dav/lib/CalDAV') diff --git a/vendor/sabre/dav/lib/CalDAV/Backend/PDO.php b/vendor/sabre/dav/lib/CalDAV/Backend/PDO.php index 0d5df3968..2f48ab982 100644 --- a/vendor/sabre/dav/lib/CalDAV/Backend/PDO.php +++ b/vendor/sabre/dav/lib/CalDAV/Backend/PDO.php @@ -948,42 +948,46 @@ SQL; } list($calendarId, $instanceId) = $calendarId; - // Current synctoken - $stmt = $this->pdo->prepare('SELECT synctoken FROM '.$this->calendarTableName.' WHERE id = ?'); - $stmt->execute([$calendarId]); - $currentToken = $stmt->fetchColumn(0); - - if (is_null($currentToken)) { - return null; - } - $result = [ - 'syncToken' => $currentToken, 'added' => [], 'modified' => [], 'deleted' => [], ]; if ($syncToken) { - $query = 'SELECT uri, operation FROM '.$this->calendarChangesTableName.' WHERE synctoken >= ? AND synctoken < ? AND calendarid = ? ORDER BY synctoken'; + $query = 'SELECT uri, operation, synctoken FROM '.$this->calendarChangesTableName.' WHERE synctoken >= ? AND calendarid = ? ORDER BY synctoken'; if ($limit > 0) { - $query .= ' LIMIT '.(int) $limit; + // Fetch one more raw to detect result truncation + $query .= ' LIMIT '.((int) $limit + 1); } // Fetching all changes $stmt = $this->pdo->prepare($query); - $stmt->execute([$syncToken, $currentToken, $calendarId]); + $stmt->execute([$syncToken, $calendarId]); $changes = []; // This loop ensures that any duplicates are overwritten, only the // last change on a node is relevant. while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { - $changes[$row['uri']] = $row['operation']; + $changes[$row['uri']] = $row; } + $currentToken = null; + $result_count = 0; foreach ($changes as $uri => $operation) { - switch ($operation) { + if (!is_null($limit) && $result_count >= $limit) { + $result['result_truncated'] = true; + break; + } + + if (null === $currentToken || $currentToken < $operation['synctoken'] + 1) { + // SyncToken in CalDAV perspective is consistently the next number of the last synced change event in this class. + $currentToken = $operation['synctoken'] + 1; + } + + ++$result_count; + switch ($operation['operation']) { case 1: $result['added'][] = $uri; break; @@ -995,7 +999,24 @@ SQL; break; } } + + if (!is_null($currentToken)) { + $result['syncToken'] = $currentToken; + } else { + // This means returned value is equivalent to syncToken + $result['syncToken'] = $syncToken; + } } else { + // Current synctoken + $stmt = $this->pdo->prepare('SELECT synctoken FROM '.$this->calendarTableName.' WHERE id = ?'); + $stmt->execute([$calendarId]); + $currentToken = $stmt->fetchColumn(0); + + if (is_null($currentToken)) { + return null; + } + $result['syncToken'] = $currentToken; + // No synctoken supplied, this is the initial sync. $query = 'SELECT uri FROM '.$this->calendarObjectTableName.' WHERE calendarid = ?'; $stmt = $this->pdo->prepare($query); diff --git a/vendor/sabre/dav/lib/CalDAV/Calendar.php b/vendor/sabre/dav/lib/CalDAV/Calendar.php index 9f32e702a..6e989314d 100644 --- a/vendor/sabre/dav/lib/CalDAV/Calendar.php +++ b/vendor/sabre/dav/lib/CalDAV/Calendar.php @@ -396,7 +396,8 @@ class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection, * 'deleted' => [ * 'foo.php.bak', * 'old.txt' - * ] + * ], + * 'result_truncated' : true * ]; * * The syncToken property should reflect the *current* syncToken of the @@ -406,6 +407,9 @@ class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection, * If the syncToken is specified as null, this is an initial sync, and all * members should be reported. * + * If result is truncated due to server limitation or limit by client, + * set result_truncated to true, otherwise set to false or do not add the key. + * * The modified property is an array of nodenames that have changed since * the last token. * @@ -422,12 +426,17 @@ class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection, * should be treated as infinite. * * If the limit (infinite or not) is higher than you're willing to return, - * you should throw a Sabre\DAV\Exception\TooMuchMatches() exception. + * the result should be truncated to fit the limit. + * Note that even when the result is truncated, syncToken must be consistent + * with the truncated result, not the result before truncation. + * (See RFC6578 Section 3.6 for detail) * * If the syncToken is expired (due to data cleanup) or unknown, you must * return null. * * The limit is 'suggestive'. You are free to ignore it. + * TODO: RFC6578 Setion 3.7 says that the server must fail when the server + * cannot truncate according to the limit, so it may not be just suggestive. * * @param string $syncToken * @param int $syncLevel diff --git a/vendor/sabre/dav/lib/CalDAV/Plugin.php b/vendor/sabre/dav/lib/CalDAV/Plugin.php index da172049e..98f4f554c 100644 --- a/vendor/sabre/dav/lib/CalDAV/Plugin.php +++ b/vendor/sabre/dav/lib/CalDAV/Plugin.php @@ -243,7 +243,7 @@ class Plugin extends DAV\ServerPlugin * @param mixed $report * @param mixed $path * - * @return bool + * @return bool|null */ public function report($reportName, $report, $path) { diff --git a/vendor/sabre/dav/lib/CalDAV/Schedule/Plugin.php b/vendor/sabre/dav/lib/CalDAV/Schedule/Plugin.php index 38a7ca96f..3cc360f1d 100644 --- a/vendor/sabre/dav/lib/CalDAV/Schedule/Plugin.php +++ b/vendor/sabre/dav/lib/CalDAV/Schedule/Plugin.php @@ -735,9 +735,7 @@ class Plugin extends ServerPlugin /** * This method is responsible for parsing a free-busy query request and - * returning it's result. - * - * @return string + * returning its result in $response. */ protected function handleFreeBusyRequest(IOutbox $outbox, VObject\Component $vObject, RequestInterface $request, ResponseInterface $response) { diff --git a/vendor/sabre/dav/lib/CalDAV/Subscriptions/Subscription.php b/vendor/sabre/dav/lib/CalDAV/Subscriptions/Subscription.php index 3be1b609e..8d56e6441 100644 --- a/vendor/sabre/dav/lib/CalDAV/Subscriptions/Subscription.php +++ b/vendor/sabre/dav/lib/CalDAV/Subscriptions/Subscription.php @@ -75,7 +75,7 @@ class Subscription extends Collection implements ISubscription, IACL /** * Returns the last modification time. * - * @return int + * @return int|null */ public function getLastModified() { -- cgit v1.2.3