diff options
author | Georg Ehrke <developer@georgehrke.com> | 2018-06-28 13:07:33 +0200 |
---|---|---|
committer | Georg Ehrke <developer@georgehrke.com> | 2018-11-07 13:25:14 +0100 |
commit | 30d13bb760b233eb4b55b46066deb4bf05d41ce4 (patch) | |
tree | 0d7af03bab6ce7ca549df78eeb2d87163c597320 /apps/dav/lib/CalDAV/CalendarHome.php | |
parent | b56cb41e2fc5bd8ec4ef4661009b6feb4c75b7dc (diff) | |
download | nextcloud-server-30d13bb760b233eb4b55b46066deb4bf05d41ce4.tar.gz nextcloud-server-30d13bb760b233eb4b55b46066deb4bf05d41ce4.zip |
cache webcal calendars on server
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'apps/dav/lib/CalDAV/CalendarHome.php')
-rw-r--r-- | apps/dav/lib/CalDAV/CalendarHome.php | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/apps/dav/lib/CalDAV/CalendarHome.php b/apps/dav/lib/CalDAV/CalendarHome.php index 6700b1b2496..9ff71410f87 100644 --- a/apps/dav/lib/CalDAV/CalendarHome.php +++ b/apps/dav/lib/CalDAV/CalendarHome.php @@ -42,6 +42,9 @@ class CalendarHome extends \Sabre\CalDAV\CalendarHome { /** @var \OCP\IConfig */ private $config; + /** @var bool */ + private $returnCachedSubscriptions=false; + public function __construct(BackendInterface $caldavBackend, $principalInfo) { parent::__construct($caldavBackend, $principalInfo); $this->l10n = \OC::$server->getL10N('dav'); @@ -91,7 +94,11 @@ class CalendarHome extends \Sabre\CalDAV\CalendarHome { // If the backend supports subscriptions, we'll add those as well, if ($this->caldavBackend instanceof SubscriptionSupport) { foreach ($this->caldavBackend->getSubscriptionsForUser($this->principalInfo['uri']) as $subscription) { - $objects[] = new Subscription($this->caldavBackend, $subscription); + if ($this->returnCachedSubscriptions) { + $objects[] = new CachedSubscription($this->caldavBackend, $subscription); + } else { + $objects[] = new Subscription($this->caldavBackend, $subscription); + } } } @@ -123,6 +130,10 @@ class CalendarHome extends \Sabre\CalDAV\CalendarHome { if ($this->caldavBackend instanceof SubscriptionSupport) { foreach ($this->caldavBackend->getSubscriptionsForUser($this->principalInfo['uri']) as $subscription) { if ($subscription['uri'] === $name) { + if ($this->returnCachedSubscriptions) { + return new CachedSubscription($this->caldavBackend, $subscription); + } + return new Subscription($this->caldavBackend, $subscription); } } @@ -141,4 +152,11 @@ class CalendarHome extends \Sabre\CalDAV\CalendarHome { $principalUri = $this->principalInfo['uri']; return $this->caldavBackend->calendarSearch($principalUri, $filters, $limit, $offset); } + + /** + * + */ + public function enableCachedSubscriptionsForThisRequest() { + $this->returnCachedSubscriptions = true; + } } |