summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/CalDAV/CalendarHome.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dav/lib/CalDAV/CalendarHome.php')
-rw-r--r--apps/dav/lib/CalDAV/CalendarHome.php20
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;
+ }
}