diff options
author | Thomas Citharel <tcit@tcit.fr> | 2016-09-15 17:01:35 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2016-09-26 11:55:43 +0200 |
commit | 17d5dfdeb159bb940a1e3d45479ad2c5f99d8225 (patch) | |
tree | da8093fbb7cfe9098e1e56068d7b724e37185bf4 /apps | |
parent | 83602225549d1df67403a333ed4a53e8a02d1619 (diff) | |
download | nextcloud-server-17d5dfdeb159bb940a1e3d45479ad2c5f99d8225.tar.gz nextcloud-server-17d5dfdeb159bb940a1e3d45479ad2c5f99d8225.zip |
add in same request
Diffstat (limited to 'apps')
-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); |