[Pkg-owncloud-commits] [php-sabredav] 14/33: Updated changelog Fixed issue 23 in 1.0 branch Added 2 classes for future compatibility

David Prévot taffit at moszumanska.debian.org
Sat Nov 30 15:43:55 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to tag version-1.0.10
in repository php-sabredav.

commit d268f6cfa3b957ee2c35aef0ecda2419b517bc99
Author: Evert Pot <evert at rooftopsolutions.nl>
Date:   Wed Mar 3 19:58:52 2010 +0900

    Updated changelog
    Fixed issue 23 in 1.0 branch
    Added 2 classes for future compatibility
---
 ChangeLog                                          |  6 +++-
 lib/Sabre.includes.php                             |  2 ++
 .../{PermissionDenied.php => Forbidden.php}        |  6 ++--
 lib/Sabre/DAV/Exception/PermissionDenied.php       | 15 ++------
 lib/Sabre/DAV/{IDirectory.php => ICollection.php}  | 10 +++---
 lib/Sabre/DAV/IDirectory.php                       | 40 +++-------------------
 lib/Sabre/DAV/INode.php                            |  2 +-
 lib/Sabre/DAV/ObjectTree.php                       |  8 ++---
 lib/Sabre/DAV/Server.php                           | 10 +++---
 lib/Sabre/DAV/Tree.php                             |  6 ++--
 10 files changed, 37 insertions(+), 68 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b91b0d1..9018c78 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
-1.0.8-stable (2010-??-??)
+1.0.8-stable (2010-03-03)
 	* Fixed: Issue 21: typos causing errors
 	* Fixed: Issue 23: Comma's between methods in Allow header.
+	* Added: Sabre_DAV_ICollection interface, to aid in future compatibility.
+	* Added: Sabre_DAV_Exception_Forbidden exception. This will replace
+	  Sabre_DAV_Exception_PermissionDenied in the future, and can already be
+	  used to ensure future compatibility.
 
 1.0.7-stable (2010-02-24)
 	* Fixed: Issue 19 regression for MS Office
diff --git a/lib/Sabre.includes.php b/lib/Sabre.includes.php
index 590505d..1f28333 100644
--- a/lib/Sabre.includes.php
+++ b/lib/Sabre.includes.php
@@ -36,6 +36,7 @@ include 'Sabre/DAV/Exception/Locked.php';
 include 'Sabre/DAV/Exception/LockTokenMatchesRequestUri.php';
 include 'Sabre/DAV/Exception/MethodNotAllowed.php';
 include 'Sabre/DAV/Exception/NotImplemented.php';
+include 'Sabre/DAV/Exception/Forbidden.php';
 include 'Sabre/DAV/Exception/PermissionDenied.php';
 include 'Sabre/DAV/Exception/PreconditionFailed.php';
 include 'Sabre/DAV/Exception/RequestedRangeNotSatisfiable.php';
@@ -57,6 +58,7 @@ include 'Sabre/DAV/Property/Response.php';
 /* Node interfaces */
 include 'Sabre/DAV/INode.php';
 include 'Sabre/DAV/IFile.php';
+include 'Sabre/DAV/ICollection.php';
 include 'Sabre/DAV/IDirectory.php';
 include 'Sabre/DAV/IProperties.php';
 include 'Sabre/DAV/ILockable.php';
diff --git a/lib/Sabre/DAV/Exception/PermissionDenied.php b/lib/Sabre/DAV/Exception/Forbidden.php
similarity index 82%
copy from lib/Sabre/DAV/Exception/PermissionDenied.php
copy to lib/Sabre/DAV/Exception/Forbidden.php
index 8f66794..652062a 100644
--- a/lib/Sabre/DAV/Exception/PermissionDenied.php
+++ b/lib/Sabre/DAV/Exception/Forbidden.php
@@ -1,7 +1,7 @@
 <?php
 
 /**
- * PermissionDenied
+ * Forbidden
  *
  * 
  * @package Sabre
@@ -14,11 +14,11 @@
 
 
 /**
- * PermissionDenied 
+ * Forbidden
  *
  * This exception is thrown whenever a user tries to do an operation that he's not allowed to
  */
-class Sabre_DAV_Exception_PermissionDenied extends Sabre_DAV_Exception {
+class Sabre_DAV_Exception_Forbidden extends Sabre_DAV_Exception {
 
     /**
      * getHTTPCode 
diff --git a/lib/Sabre/DAV/Exception/PermissionDenied.php b/lib/Sabre/DAV/Exception/PermissionDenied.php
index 8f66794..f09efa6 100644
--- a/lib/Sabre/DAV/Exception/PermissionDenied.php
+++ b/lib/Sabre/DAV/Exception/PermissionDenied.php
@@ -16,19 +16,10 @@
 /**
  * PermissionDenied 
  *
- * This exception is thrown whenever a user tries to do an operation that he's not allowed to
+ * This exception is thrown whenever a user tries to do an operation that he's not allowed to.
+ * This class will be deprecated in the future. Update your code to use Sabre_DAV_Exception_Forbidden instead.
  */
-class Sabre_DAV_Exception_PermissionDenied extends Sabre_DAV_Exception {
+class Sabre_DAV_Exception_PermissionDenied extends Sabre_DAV_Exception_Forbidden {
 
-    /**
-     * getHTTPCode 
-     * 
-     * @return int 
-     */
-    public function getHTTPCode() {
-
-        return 403;
-
-    }
 
 }
diff --git a/lib/Sabre/DAV/IDirectory.php b/lib/Sabre/DAV/ICollection.php
similarity index 87%
copy from lib/Sabre/DAV/IDirectory.php
copy to lib/Sabre/DAV/ICollection.php
index 1504390..66e6599 100644
--- a/lib/Sabre/DAV/IDirectory.php
+++ b/lib/Sabre/DAV/ICollection.php
@@ -1,10 +1,12 @@
 <?php
 
 /**
- * The IDirectory Interface
+ * The ICollection Interface
+ *
+ * This interface should be implemented by each class that represents a collection
+ *
+ * This interface replaces Sabre_DAV_IDirectory.
  *
- * This interface should be implemented by each class that represents a directory (or branch in the tree)
- * 
  * @package Sabre
  * @subpackage DAV
  * @version $Id$
@@ -12,7 +14,7 @@
  * @author Evert Pot (http://www.rooftopsolutions.nl/) 
  * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
  */
-interface Sabre_DAV_IDirectory extends Sabre_DAV_INode {
+interface Sabre_DAV_ICollection extends Sabre_DAV_INode {
 
     /**
      * Creates a new file in the directory 
diff --git a/lib/Sabre/DAV/IDirectory.php b/lib/Sabre/DAV/IDirectory.php
index 1504390..073bdb4 100644
--- a/lib/Sabre/DAV/IDirectory.php
+++ b/lib/Sabre/DAV/IDirectory.php
@@ -3,7 +3,10 @@
 /**
  * The IDirectory Interface
  *
- * This interface should be implemented by each class that represents a directory (or branch in the tree)
+ * This interface should be implemented by each class that represents a directory.
+ *
+ * In future versions of SabreDAV this class will be removed. It is recommended to
+ * use Sabre_DAV_ICollection instead for future compatibility.
  * 
  * @package Sabre
  * @subpackage DAV
@@ -12,41 +15,8 @@
  * @author Evert Pot (http://www.rooftopsolutions.nl/) 
  * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
  */
-interface Sabre_DAV_IDirectory extends Sabre_DAV_INode {
-
-    /**
-     * Creates a new file in the directory 
-     * 
-     * data is a readable stream resource
-     *
-     * @param string $name Name of the file 
-     * @param resource $data Initial payload 
-     * @return void
-     */
-    function createFile($name, $data = null);
-
-    /**
-     * Creates a new subdirectory 
-     * 
-     * @param string $name 
-     * @return void
-     */
-    function createDirectory($name);
-
-    /**
-     * Returns a specific child node, referenced by its name 
-     * 
-     * @param string $name 
-     * @return Sabre_DAV_INode 
-     */
-    function getChild($name);
+interface Sabre_DAV_IDirectory extends Sabre_DAV_ICollection {
 
-    /**
-     * Returns an array with all the child nodes 
-     * 
-     * @return Sabre_DAV_INode[] 
-     */
-    function getChildren();
 
 }
 
diff --git a/lib/Sabre/DAV/INode.php b/lib/Sabre/DAV/INode.php
index dd2bcca..880338b 100644
--- a/lib/Sabre/DAV/INode.php
+++ b/lib/Sabre/DAV/INode.php
@@ -1,7 +1,7 @@
 <?php
 
 /**
- * The INode interface is the base interface, and the parent class of both IDirectory and IFile
+ * The INode interface is the base interface, and the parent class of both ICollection and IFile
  * 
  * @package Sabre
  * @subpackage DAV
diff --git a/lib/Sabre/DAV/ObjectTree.php b/lib/Sabre/DAV/ObjectTree.php
index 9018618..16e63f6 100644
--- a/lib/Sabre/DAV/ObjectTree.php
+++ b/lib/Sabre/DAV/ObjectTree.php
@@ -3,7 +3,7 @@
 /**
  * ObjectTree class
  *
- * This implementation of the Tree class makes use of the INode, IFile and IDirectory API's 
+ * This implementation of the Tree class makes use of the INode, IFile and ICollection API's 
  * 
  * @package Sabre
  * @subpackage DAV
@@ -17,7 +17,7 @@ class Sabre_DAV_ObjectTree extends Sabre_DAV_Tree {
     /**
      * The root node 
      * 
-     * @var Sabre_DAV_IDirectory 
+     * @var Sabre_DAV_ICollection 
      */
     protected $rootNode;
 
@@ -27,10 +27,10 @@ class Sabre_DAV_ObjectTree extends Sabre_DAV_Tree {
      *
      * This method expects the rootObject to be passed as a parameter
      * 
-     * @param Sabre_DAV_IDirectory $rootNode 
+     * @param Sabre_DAV_ICollection $rootNode 
      * @return void
      */
-    public function __construct(Sabre_DAV_IDirectory $rootNode) {
+    public function __construct(Sabre_DAV_ICollection $rootNode) {
 
         $this->rootNode = $rootNode;
 
diff --git a/lib/Sabre/DAV/Server.php b/lib/Sabre/DAV/Server.php
index d5124c7..2ade1d2 100644
--- a/lib/Sabre/DAV/Server.php
+++ b/lib/Sabre/DAV/Server.php
@@ -524,7 +524,7 @@ class Sabre_DAV_Server {
             }
             
             // If the node is a collection, we'll deny it
-            if ($node instanceof Sabre_DAV_IDirectory) throw new Sabre_DAV_Exception_Conflict('PUTs on directories are not allowed');
+            if ($node instanceof Sabre_DAV_ICollection) throw new Sabre_DAV_Exception_Conflict('PUTs on directories are not allowed');
             if (!$this->broadcastEvent('beforeWriteContent',$this->getRequestUri())) return false;
 
             $node->put($this->httpRequest->getBody());
@@ -560,7 +560,7 @@ class Sabre_DAV_Server {
         
         try {
             if ($parent = $this->tree->getNodeForPath(dirname($this->getRequestUri()))) {
-                if (!$parent instanceof Sabre_DAV_IDirectory) {
+                if (!$parent instanceof Sabre_DAV_ICollection) {
                     throw new Sabre_DAV_Exception_Conflict('Parent node is not a directory');
                 }
             }
@@ -855,7 +855,7 @@ class Sabre_DAV_Server {
 
         try {
             $destinationParent = $this->tree->getNodeForPath($destinationUri);
-            if (!($destinationParent instanceof Sabre_DAV_IDirectory)) throw new Sabre_DAV_Exception_UnsupportedMediaType('The destination node is not a collection');
+            if (!($destinationParent instanceof Sabre_DAV_ICollection)) throw new Sabre_DAV_Exception_UnsupportedMediaType('The destination node is not a collection');
         } catch (Sabre_DAV_Exception_FileNotFound $e) {
 
             // If the destination parent node is not found, we throw a 409
@@ -913,7 +913,7 @@ class Sabre_DAV_Server {
         $nodes = array(
             $path => $parentNode
         );
-        if ($depth==1 && $parentNode instanceof Sabre_DAV_IDirectory) {
+        if ($depth==1 && $parentNode instanceof Sabre_DAV_ICollection) {
             foreach($parentNode->getChildren() as $childNode)
                 $nodes[$path . '/' . $childNode->getName()] = $childNode;
         }            
@@ -959,7 +959,7 @@ class Sabre_DAV_Server {
                 switch($prop) {
                     case '{DAV:}getlastmodified'       : if ($node->getLastModified()) $newProperties[200][$prop] = new Sabre_DAV_Property_GetLastModified($node->getLastModified()); break;
                     case '{DAV:}getcontentlength'      : if ($node instanceof Sabre_DAV_IFile) $newProperties[200][$prop] = (int)$node->getSize(); break;
-                    case '{DAV:}resourcetype'          : $newProperties[200][$prop] = new Sabre_DAV_Property_ResourceType($node instanceof Sabre_DAV_IDirectory?self::NODE_DIRECTORY:self::NODE_FILE); break;
+                    case '{DAV:}resourcetype'          : $newProperties[200][$prop] = new Sabre_DAV_Property_ResourceType($node instanceof Sabre_DAV_ICollection?self::NODE_DIRECTORY:self::NODE_FILE); break;
                     case '{DAV:}quota-used-bytes'      : 
                         if ($node instanceof Sabre_DAV_IQuota) {
                             $quotaInfo = $node->getQuotaInfo();
diff --git a/lib/Sabre/DAV/Tree.php b/lib/Sabre/DAV/Tree.php
index 139e2e9..332473f 100644
--- a/lib/Sabre/DAV/Tree.php
+++ b/lib/Sabre/DAV/Tree.php
@@ -60,10 +60,10 @@ abstract class Sabre_DAV_Tree {
      * copyNode 
      * 
      * @param Sabre_DAV_INode $source 
-     * @param Sabre_DAV_IDirectory $destination 
+     * @param Sabre_DAV_ICollection $destination 
      * @return void
      */
-    protected function copyNode(Sabre_DAV_INode $source,Sabre_DAV_IDirectory $destinationParent,$destinationName = null) {
+    protected function copyNode(Sabre_DAV_INode $source,Sabre_DAV_ICollection $destinationParent,$destinationName = null) {
 
         if (!$destinationName) $destinationName = $source->getName();
 
@@ -81,7 +81,7 @@ abstract class Sabre_DAV_Tree {
             $destinationParent->createFile($destinationName,$data);
             $destination = $destinationParent->getChild($destinationName);
 
-        } elseif ($source instanceof Sabre_DAV_IDirectory) {
+        } elseif ($source instanceof Sabre_DAV_ICollection) {
 
             $destinationParent->createDirectory($destinationName);
             

-- 
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