diff options
Diffstat (limited to 'apps/dav')
-rw-r--r-- | apps/dav/lib/CalDAV/CalDavBackend.php | 21 | ||||
-rw-r--r-- | apps/dav/lib/CalDAV/Calendar.php | 6 | ||||
-rw-r--r-- | apps/dav/lib/CalDAV/Publishing/PublishPlugin.php | 2 |
3 files changed, 4 insertions, 25 deletions
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index 34bc0b3c8be..440188c13ca 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -1633,27 +1633,10 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription /** * @param \OCA\DAV\CalDAV\Calendar $calendar - * @return boolean + * @return mixed */ public function getPublishStatus($calendar) { $query = $this->db->getQueryBuilder(); - $result = $query->select($query->createFunction('COUNT(*)')) - ->from('dav_shares') - ->where($query->expr()->eq('resourceid', $query->createNamedParameter($calendar->getResourceId()))) - ->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC))) - ->execute(); - - $row = $result->fetch(); - $result->closeCursor(); - return reset($row) > 0; - } - - /** - * @param \OCA\DAV\CalDAV\Calendar $calendar - * @return string - */ - public function getPublishToken($calendar) { - $query = $this->db->getQueryBuilder(); $result = $query->select('publicuri') ->from('dav_shares') ->where($query->expr()->eq('resourceid', $query->createNamedParameter($calendar->getResourceId()))) @@ -1662,7 +1645,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $row = $result->fetch(); $result->closeCursor(); - return reset($row); + return $row ? reset($row) : false; } /** diff --git a/apps/dav/lib/CalDAV/Calendar.php b/apps/dav/lib/CalDAV/Calendar.php index 17cc4780f78..3fbcd87acc0 100644 --- a/apps/dav/lib/CalDAV/Calendar.php +++ b/apps/dav/lib/CalDAV/Calendar.php @@ -261,16 +261,12 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { } /** - * @return boolean $value + * @return mixed $value */ function getPublishStatus() { return $this->caldavBackend->getPublishStatus($this); } - function getPublishToken() { - return $this->caldavBackend->getPublishToken($this); - } - private function canWrite() { if (isset($this->calendarInfo['{http://owncloud.org/ns}read-only'])) { return !$this->calendarInfo['{http://owncloud.org/ns}read-only']; diff --git a/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php b/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php index aaa2868a86d..241e5260c70 100644 --- a/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php +++ b/apps/dav/lib/CalDAV/Publishing/PublishPlugin.php @@ -97,7 +97,7 @@ class PublishPlugin extends ServerPlugin { $propFind->handle('{'.self::NS_CALENDARSERVER.'}publish-url', function () use ($node) { if ($node->getPublishStatus()) { // We return the publish-url only if the calendar is published. - $token = $node->getPublishToken(); + $token = $node->getPublishStatus(); $publishUrl = $this->urlGenerator->getAbsoluteURL($this->server->getBaseUri().'public-calendars/').$token; return new Publisher($publishUrl, true); |