[Pkg-owncloud-commits] [php-sabredav] 22/275: Added a SchedulingSupport interface.
David Prévot
taffit at moszumanska.debian.org
Thu Sep 25 14:55:46 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository php-sabredav.
commit a027b20eccb25a385721b4d57f39e5f0cc9d0e07
Author: Evert Pot <evert at rooftopsolutions.nl>
Date: Tue Sep 17 21:57:20 2013 +0100
Added a SchedulingSupport interface.
---
lib/Sabre/CalDAV/Backend/PDO.php | 16 +++++++-
lib/Sabre/CalDAV/Backend/SchedulingSupport.php | 55 ++++++++++++++++++++++++++
lib/Sabre/CalDAV/Schedule/Inbox.php | 2 +-
lib/Sabre/CalDAV/Schedule/SchedulingObject.php | 1 +
lib/Sabre/CalDAV/UserCalendars.php | 6 ++-
5 files changed, 76 insertions(+), 4 deletions(-)
diff --git a/lib/Sabre/CalDAV/Backend/PDO.php b/lib/Sabre/CalDAV/Backend/PDO.php
index 615cc30..be42628 100755
--- a/lib/Sabre/CalDAV/Backend/PDO.php
+++ b/lib/Sabre/CalDAV/Backend/PDO.php
@@ -18,7 +18,7 @@ use
* @author Evert Pot (http://evertpot.com/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
-class PDO extends AbstractBackend implements SyncSupport, SubscriptionSupport {
+class PDO extends AbstractBackend implements SyncSupport, SubscriptionSupport, SchedulingSupport {
/**
* We need to specify a max date, because we need to stop *somewhere*
@@ -1160,6 +1160,15 @@ class PDO extends AbstractBackend implements SyncSupport, SubscriptionSupport {
/**
* Returns a single scheduling object.
*
+ * The returned array should contain the following elements:
+ * * uri - A unique basename for the object. This will be used to
+ * construct a full uri.
+ * * calendardata - The iCalendar object
+ * * lastmodified - The last modification date. Can be an int for a unix
+ * timestamp, or a PHP DateTime object.
+ * * etag - A unique token that must change if the object changed.
+ * * size - The size of the object, in bytes.
+ *
* @param string $principalUri
* @param string $objectUri
* @return array
@@ -1185,6 +1194,11 @@ class PDO extends AbstractBackend implements SyncSupport, SubscriptionSupport {
/**
* Returns all scheduling objects for the inbox collection.
*
+ * These objects should be returned as an array. Every item in the array
+ * should follow the same structure as returned from getSchedulingObject.
+ *
+ * The main difference is that 'calendardata' is optional.
+ *
* @param string $principalUri
* @return array
*/
diff --git a/lib/Sabre/CalDAV/Backend/SchedulingSupport.php b/lib/Sabre/CalDAV/Backend/SchedulingSupport.php
new file mode 100644
index 0000000..c618b03
--- /dev/null
+++ b/lib/Sabre/CalDAV/Backend/SchedulingSupport.php
@@ -0,0 +1,55 @@
+<?php
+
+namespace Sabre\CalDAV\Backend;
+
+/**
+ * Implementing this interface adds CalDAV Scheduling support to your caldav
+ * server, as defined in rfc6638.
+ *
+ * @copyright Copyright (C) 2007-2013 fruux GmbH. All rights reserved.
+ * @author Evert Pot (http://evertpot.com/)
+ * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
+ */
+interface SchedulingSupport extends BackendInterface {
+
+ /**
+ * Returns a single scheduling object.
+ *
+ * The returned array should contain the following elements:
+ * * uri - A unique basename for the object. This will be used to
+ * construct a full uri.
+ * * calendardata - The iCalendar object
+ * * lastmodified - The last modification date. Can be an int for a unix
+ * timestamp, or a PHP DateTime object.
+ * * etag - A unique token that must change if the object changed.
+ * * size - The size of the object, in bytes.
+ *
+ * @param string $principalUri
+ * @param string $objectUri
+ * @return array
+ */
+ public function getSchedulingObject($principalUri, $objectUri);
+
+ /**
+ * Returns all scheduling objects for the inbox collection.
+ *
+ * These objects should be returned as an array. Every item in the array
+ * should follow the same structure as returned from getSchedulingObject.
+ *
+ * The main difference is that 'calendardata' is optional.
+ *
+ * @param string $principalUri
+ * @return array
+ */
+ public function getSchedulingObjects($principalUri);
+
+ /**
+ * Deletes a scheduling object
+ *
+ * @param string $principalUri
+ * @param string $objectUri
+ * @return void
+ */
+ public function deleteSchedulingObject($principalUri, $objectUri);
+
+}
diff --git a/lib/Sabre/CalDAV/Schedule/Inbox.php b/lib/Sabre/CalDAV/Schedule/Inbox.php
index 3150c26..94f12bf 100644
--- a/lib/Sabre/CalDAV/Schedule/Inbox.php
+++ b/lib/Sabre/CalDAV/Schedule/Inbox.php
@@ -36,7 +36,7 @@ class Inbox extends DAV\Collection implements IInbox {
*
* @param string $principalUri
*/
- public function __construct(Backend\BackendInterface $caldavBackend, $principalUri) {
+ public function __construct(Backend\SchedulingSupport $caldavBackend, $principalUri) {
$this->caldavBackend = $caldavBackend;
$this->principalUri = $principalUri;
diff --git a/lib/Sabre/CalDAV/Schedule/SchedulingObject.php b/lib/Sabre/CalDAV/Schedule/SchedulingObject.php
index 4ef3933..51770d1 100644
--- a/lib/Sabre/CalDAV/Schedule/SchedulingObject.php
+++ b/lib/Sabre/CalDAV/Schedule/SchedulingObject.php
@@ -7,6 +7,7 @@ namespace Sabre\CalDAV;
*
* @author Brett (https://github.com/bretten)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
+ * @copyright Copyright (C) 2007-2013 fruux GmbH. All rights reserved.
*/
class SchedulingObject extends \Sabre\DAV\File implements ISchedulingObject, \Sabre\DAVACL\IACL {
diff --git a/lib/Sabre/CalDAV/UserCalendars.php b/lib/Sabre/CalDAV/UserCalendars.php
index ba019e8..be809f7 100644
--- a/lib/Sabre/CalDAV/UserCalendars.php
+++ b/lib/Sabre/CalDAV/UserCalendars.php
@@ -174,9 +174,11 @@ class UserCalendars implements DAV\IExtendedCollection, DAVACL\IACL {
$objs[] = new Calendar($this->caldavBackend, $calendar);
}
}
- $objs[] = new Schedule\Inbox($this->caldavBackend, $this->principalInfo['uri']);
- $objs[] = new Schedule\Outbox($this->principalInfo['uri']);
+ if ($this->caldavBackend instanceof Backend\SchedulingSupport) {
+ $objs[] = new Schedule\Inbox($this->caldavBackend, $this->principalInfo['uri']);
+ $objs[] = new Schedule\Outbox($this->principalInfo['uri']);
+ }
// We're adding a notifications node, if it's supported by the backend.
if ($this->caldavBackend instanceof Backend\NotificationSupport) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabredav.git
More information about the Pkg-owncloud-commits
mailing list