aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/lib/CalDAV
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-02-11 09:21:19 +0000
committerMario <mario@mariovavti.com>2022-02-11 09:21:19 +0000
commit6d8aabab2347feabdd804b609dcd4513f09f78d4 (patch)
tree9bea1aba6caa85084ec664f498c445bb92d9457c /vendor/sabre/dav/lib/CalDAV
parente74359fcfe4d97efe72a811b45526a69edae3893 (diff)
downloadvolse-hubzilla-6d8aabab2347feabdd804b609dcd4513f09f78d4.tar.gz
volse-hubzilla-6d8aabab2347feabdd804b609dcd4513f09f78d4.tar.bz2
volse-hubzilla-6d8aabab2347feabdd804b609dcd4513f09f78d4.zip
composer libs minor version updates
Diffstat (limited to 'vendor/sabre/dav/lib/CalDAV')
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Backend/PDO.php51
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Calendar.php13
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Plugin.php2
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Schedule/Plugin.php4
-rw-r--r--vendor/sabre/dav/lib/CalDAV/Subscriptions/Subscription.php2
5 files changed, 50 insertions, 22 deletions
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()
{