[Pkg-owncloud-commits] [php-sabredav] 89/163: Merge branch '1.7' into 1.8

David Prévot taffit at moszumanska.debian.org
Tue May 20 18:54:57 UTC 2014


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

taffit pushed a commit to annotated tag upstream/2.0.0_beta1
in repository php-sabredav.

commit 48f61b69643cf1baa263262c3fd32a1a3e66a38e
Merge: bdc918e 41fc40d
Author: Evert Pot <evert at rooftopsolutions.nl>
Date:   Sun Apr 27 22:39:21 2014 -0400

    Merge branch '1.7' into 1.8
    
    Conflicts:
    	lib/Sabre/DAV/FSExt/File.php
    	lib/Sabre/DAV/PartialUpdate/Plugin.php

 ChangeLog                                          |   3 +
 lib/Sabre/DAV/Exception/LengthRequired.php         |  28 ++++++
 lib/Sabre/DAV/FSExt/File.php                       |  50 +++++++---
 lib/Sabre/DAV/PartialUpdate/IFile.php              |   5 +-
 .../PartialUpdate/{IFile.php => IPatchSupport.php} |  24 +++--
 lib/Sabre/DAV/PartialUpdate/Plugin.php             | 101 ++++++++++++++-------
 .../Sabre/DAV/PartialUpdate/SpecificationTest.php  |  83 +++++++++++++++++
 tests/bootstrap.php                                |   1 +
 8 files changed, 239 insertions(+), 56 deletions(-)

diff --cc ChangeLog
index 188489b,0c2724b..6ca4045
--- a/ChangeLog
+++ b/ChangeLog
@@@ -1,66 -1,7 +1,69 @@@
 +1.8.10-stable (????-??-??)
 +	* includes changes from version 1.7.12.
 +
 +1.8.9-stable (2014-02-26)
 +	* The zip release ships with sabre/vobject 2.1.3.
 +	* includes changes from version 1.7.11.
 +
 +1.8.8-stable (2014-02-09)
 +	* The zip release ships with sabre/vobject 2.1.3.
 +	* includes changes from version 1.7.10.
 +
 +1.8.7-stable (2013-10-02)
 +	* the zip release ships with sabre/vobject 2.1.3.
 +	* includes changes from version 1.7.9.
 +
 +1.8.6-stable (2013-06-18)
 +	* The zip release ships with sabre/vobject 2.1.0.
 +	* Includes changes from version 1.7.8.
 +
 +1.8.5-stable (2013-04-11)
 +	* The zip release ships with sabre/vobject 2.0.7.
 +	* Includes changes from version 1.7.7.
 +
 +1.8.4-stable (2013-04-08)
 +	* The zip release ships with sabre/vobject 2.0.7.
 +	* Includes changes from version 1.7.6.
 +
 +1.8.3-stable (2013-03-01)
 +	* The zip release ships with sabre/vobject 2.0.6.
 +	* Includes changes from version 1.7.5.
 +	* Fixed: organizer email-address for shared calendars is now prefixed with
 +	  mailto:, as it should.
 +
 +1.8.2-stable (2013-01-19)
 +	* The zip release ships with sabre/vobject 2.0.5.
 +	* Includes changes from version 1.7.4.
 +
 +1.8.1-stable (2012-12-01)
 +	* The zip release ships with sabre/vobject 2.0.5.
 +	* Includes changes from version 1.7.3.
 +	* Fixed: Typo in 1.7 migration script caused it to fail.
 +
 +1.8.0-stable (2012-11-08)
 +	* The zip release ships with sabre/vobject 2.0.5.
 +	* BC Break: Moved the entire codebase to PHP namespaces.
 +	* BC Break: Every backend package (CalDAV, CardDAV, Auth, Locks,
 +	  Principals) now has consistent naming conventions. There's a
 +	  BackendInterface, and an AbstractBackend class.
 +	* BC Break: Changed a bunch of constructor signatures in the CalDAV
 +	  package, to reduce dependencies on the ACL package.
 +	* BC Break: Sabre_CalDAV_ISharedCalendar now also has a getShares method,
 +	  so sharees can figure out who is also on a shared calendar.
 +
 +	* Added: Sabre_DAVACL_IPrincipalCollection interface, to advertise support
 +	  for principal-property-search on any node.
 +	* Added: Simple console script to fire up a fileserver in the current
 +	  directory using PHP 5.4's built-in webserver.
 +	* Added: Sharee's can now also read out the list of invites for a shared
 +	  calendar.
 +	* Added: The Proxy principal classes now both implement an interface, for
 +	  greater flexiblity.
 +
  1.7.12-stable (????-??-??)
+ 	* Updated: Issue #439. Lots of updates in PATCH support. The
+ 	  Sabre_DAV_PartialUpdate_IFile interface is now deprecated and will be
+ 	  removed in a future version.
  	* Fixed: Restoring old setting after changing
  	  libxml_disable_entity_loader.
  	* Fixed: Issue #422: Preconditions were not being set on PUT on non-
diff --cc lib/Sabre/DAV/FSExt/File.php
index 88e0d4b,329afcd..6588fad
--- a/lib/Sabre/DAV/FSExt/File.php
+++ b/lib/Sabre/DAV/FSExt/File.php
@@@ -10,7 -9,7 +10,7 @@@ use Sabre\DAV
   * @author Evert Pot (http://evertpot.com/)
   * @license http://sabre.io/license/ Modified BSD License
   */
- class File extends Node implements DAV\PartialUpdate\IFile {
 -class Sabre_DAV_FSExt_File extends Sabre_DAV_FSExt_Node implements Sabre_DAV_PartialUpdate_IPatchSupport {
++class File extends Node implements DAV\PartialUpdate\IPatchSupport {
  
      /**
       * Updates the data
diff --cc lib/Sabre/DAV/PartialUpdate/IFile.php
index 299713a,389a885..9cfb473
--- a/lib/Sabre/DAV/PartialUpdate/IFile.php
+++ b/lib/Sabre/DAV/PartialUpdate/IFile.php
@@@ -1,19 -1,16 +1,18 @@@
  <?php
  
 +namespace Sabre\DAV\PartialUpdate;
 +
 +use Sabre\DAV;
 +
  /**
-  * This interface provides a way to modify only part of a target resource
-  * It may be used to update a file chunk, upload big a file into smaller
-  * chunks or resume an upload
+  * This interface is deprecated. Use IPatchSupport instead.
   *
 - * @package Sabre
 - * @subpackage DAV
   * @copyright Copyright (C) 2007-2014 fruux GmbH (https://fruux.com/).
   * @author Jean-Tiare LE BIGOT (http://www.jtlebi.fr/)
   * @license http://sabre.io/license/ Modified BSD License
+  * @deprecated
   */
 -interface Sabre_DAV_PartialUpdate_IFile extends Sabre_DAV_IFile {
 +interface IFile extends DAV\IFile {
  
      /**
       * Updates the data at a given offset
diff --cc lib/Sabre/DAV/PartialUpdate/IPatchSupport.php
index 299713a,2dee02f..aff1d32
--- a/lib/Sabre/DAV/PartialUpdate/IPatchSupport.php
+++ b/lib/Sabre/DAV/PartialUpdate/IPatchSupport.php
@@@ -13,14 -11,21 +13,21 @@@ use Sabre\DAV
   * @author Jean-Tiare LE BIGOT (http://www.jtlebi.fr/)
   * @license http://sabre.io/license/ Modified BSD License
   */
- interface IFile extends DAV\IFile {
 -interface Sabre_DAV_PartialUpdate_IPatchSupport extends Sabre_DAV_IFile {
++interface IPatchSupport extends DAV\IFile {
  
      /**
-      * Updates the data at a given offset
+      * Updates the file based on a range specification.
       *
-      * The data argument is a readable stream resource.
-      * The offset argument is an integer describing the offset. Contrary to
-      * what's sent in the request, the offset here is a 0-based index.
+      * The first argument is the data, which is either a readable stream
+      * resource or a string.
+      *
+      * The second argument is the type of update we're doing.
+      * This is either:
+      * * 1. append
+      * * 2. update based on a start byte
+      * * 3. update based on an end byte
+      *;
+      * The third argument is the start or end byte.
       *
       * After a successful put operation, you may choose to return an ETag. The
       * etag must always be surrounded by double-quotes. These quotes must
diff --cc lib/Sabre/DAV/PartialUpdate/Plugin.php
index 9170e54,416fdd8..eb95107
--- a/lib/Sabre/DAV/PartialUpdate/Plugin.php
+++ b/lib/Sabre/DAV/PartialUpdate/Plugin.php
@@@ -18,8 -15,12 +18,12 @@@ use Sabre\DAV
   * @author Jean-Tiare LE BIGOT (http://www.jtlebi.fr/)
   * @license http://sabre.io/license/ Modified BSD License
   */
 -class Sabre_DAV_PartialUpdate_Plugin extends Sabre_DAV_ServerPlugin {
 +class Plugin extends DAV\ServerPlugin {
  
+     const RANGE_APPEND = 1;
+     const RANGE_START = 2;
+     const RANGE_END = 3;
+ 
      /**
       * Reference to server
       *
@@@ -92,14 -93,14 +96,13 @@@
       * @return array
       */
      public function getHTTPMethods($uri) {
-         
+ 
          $tree = $this->server->tree;
-         
 -
 -        if ($tree->nodeExists($uri) &&
 -            $tree->getNodeForPath($uri) instanceof Sabre_DAV_PartialUpdate_IFile) {
 +        if ($tree->nodeExists($uri) && 
 +            $tree->getNodeForPath($uri) instanceof IFile) {
              return array('PATCH');
           }
-          
+ 
           return array();
  
      }
@@@ -129,36 -130,42 +132,42 @@@
  
          // Get the node. Will throw a 404 if not found
          $node = $this->server->tree->getNodeForPath($uri);
-         if (!($node instanceof IFile)) {
 -        if (!$node instanceof Sabre_DAV_PartialUpdate_IFile && !$node instanceof Sabre_DAV_PartialUpdate_IPatchSupport) {
 -            throw new Sabre_DAV_Exception_MethodNotAllowed('The target resource does not support the PATCH method.');
++        if (!$node instanceof IFile && !$node instanceof IPatchSupport) {
 +            throw new DAV\Exception\MethodNotAllowed('The target resource does not support the PATCH method.');
          }
  
          $range = $this->getHTTPUpdateRange();
  
          if (!$range) {
 -            throw new Sabre_DAV_Exception_BadRequest('No valid "X-Update-Range" found in the headers');
 +            throw new DAV\Exception\BadRequest('No valid "X-Update-Range" found in the headers');
          }
-         
+ 
          $contentType = strtolower(
              $this->server->httpRequest->getHeader('Content-Type')
          );
-         
+ 
          if ($contentType != 'application/x-sabredav-partialupdate') {
 -            throw new Sabre_DAV_Exception_UnsupportedMediaType('Unknown Content-Type header "' . $contentType . '"');
 +            throw new DAV\Exception\UnsupportedMediaType('Unknown Content-Type header "' . $contentType . '"');
          }
  
          $len = $this->server->httpRequest->getHeader('Content-Length');
- 
-         // Load the begin and end data
-         $start = ($range[0])?$range[0]:0;
-         $end   = ($range[1])?$range[1]:$start+$len-1;
- 
-         // Check consistency
-         if($end < $start)
-             throw new DAV\Exception\RequestedRangeNotSatisfiable('The end offset (' . $range[1] . ') is lower than the start offset (' . $range[0] . ')');
-         if($end - $start + 1 != $len)
-             throw new DAV\Exception\RequestedRangeNotSatisfiable('Actual data length (' . $len . ') is not consistent with begin (' . $range[0] . ') and end (' . $range[1] . ') offsets');
- 
 -        if (!$len) throw new Sabre_DAV_Exception_LengthRequired('A Content-Length header is required');
++        if (!$len) throw new DAV\Exception\LengthRequired('A Content-Length header is required');
+ 
+         switch($range[0]) {
+             case self::RANGE_START :
+                 // Calculate the end-range if it doesn't exist.
+                 if (!$range[2]) {
+                     $range[2] = $range[1] + $len - 1;
+                 } else {
+                     if ($range[2] < $range[1]) {
 -                        throw new Sabre_DAV_Exception_RequestedRangeNotSatisfiable('The end offset (' . $range[2] . ') is lower than the start offset (' . $range[1] . ')');
++                        throw new DAV\Exception\RequestedRangeNotSatisfiable('The end offset (' . $range[2] . ') is lower than the start offset (' . $range[1] . ')');
+                     }
+                     if($range[2] - $range[1] + 1 != $len) {
 -                        throw new Sabre_DAV_Exception_RequestedRangeNotSatisfiable('Actual data length (' . $len . ') is not consistent with begin (' . $range[1] . ') and end (' . $range[2] . ') offsets');
++                        throw new DAV\Exception\RequestedRangeNotSatisfiable('Actual data length (' . $len . ') is not consistent with begin (' . $range[1] . ') and end (' . $range[2] . ') offsets');
+                     }
+                 }
+                 break;
+         }
          // Checking If-None-Match and related headers.
          if (!$this->server->checkPreconditions()) return;
  
@@@ -166,7 -173,23 +175,23 @@@
              return;
  
          $body = $this->server->httpRequest->getBody();
-         $etag = $node->putRange($body, $start-1);
+ 
+ 
+         if ($node instanceof Sabre_DAV_PartialUpdate_IPatchSupport) {
+             $etag = $node->patch($body, $range[0], isset($range[1])?$range[1]:null);
+         } else {
+             // The old interface
+             switch($range[0]) {
+                 case self::RANGE_APPEND :
 -                    throw new Sabre_DAV_Exception_NotImplemented('This node does not support the append syntax. Please upgrade it to IPatchSupport');
++                    throw new DAV\Exception\NotImplemented('This node does not support the append syntax. Please upgrade it to IPatchSupport');
+                 case self::RANGE_START :
+                     $etag = $node->putRange($body, $range[1]);
+                     break;
+                 case self::RANGE_END :
 -                    throw new Sabre_DAV_Exception_NotImplemented('This node does not support the end-range syntax. Please upgrade it to IPatchSupport');
++                    throw new DAV\Exception\NotImplemented('This node does not support the end-range syntax. Please upgrade it to IPatchSupport');
+                     break;
+             }
+         }
  
          $this->server->broadcastEvent('afterWriteContent',array($uri, $node));
  

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