[Pkg-owncloud-commits] [php-sabredav] 57/66: tab-to-spaces, PHPDoc adjusted/added and namespaces cleaned
David Prévot
taffit at moszumanska.debian.org
Sat Jan 18 20:08:22 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 0ee5a99adc9c1b9a0d646099f6759a9e4a6e9c3f
Author: Thomas Müller <thomas.mueller at tmit.eu>
Date: Mon Jan 13 19:40:33 2014 +0100
tab-to-spaces, PHPDoc adjusted/added and namespaces cleaned
---
lib/Sabre/DAV/CorePlugin.php | 4 +--
lib/Sabre/DAV/Server.php | 45 +++++++++++++-----------
tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php | 9 +++--
3 files changed, 31 insertions(+), 27 deletions(-)
diff --git a/lib/Sabre/DAV/CorePlugin.php b/lib/Sabre/DAV/CorePlugin.php
index 9f85b55..66812de 100644
--- a/lib/Sabre/DAV/CorePlugin.php
+++ b/lib/Sabre/DAV/CorePlugin.php
@@ -316,8 +316,8 @@ class CorePlugin extends ServerPlugin {
);
$depth = $this->server->getHTTPDepth(1);
- // The only two options for the depth of a propfind is 0 or 1 - as long as depth infinity is not enabled
- if (!$this->server->enablePropfindDepthInfinity && $depth != 0) $depth = 1;
+ // The only two options for the depth of a propfind is 0 or 1 - as long as depth infinity is not enabled
+ if (!$this->server->enablePropfindDepthInfinity && $depth != 0) $depth = 1;
$newProperties = $this->server->getPropertiesForPath($path,$requestedProperties,$depth);
diff --git a/lib/Sabre/DAV/Server.php b/lib/Sabre/DAV/Server.php
index 2ee8066..4989cfd 100644
--- a/lib/Sabre/DAV/Server.php
+++ b/lib/Sabre/DAV/Server.php
@@ -156,7 +156,7 @@ class Server extends EventEmitter {
* This property allows you to automatically add the 'resourcetype' value
* based on a node's classname or interface.
*
- * The preset ensures that {DAV:}collection is automaticlly added for nodes
+ * The preset ensures that {DAV:}collection is automatically added for nodes
* implementing Sabre\DAV\ICollection.
*
* @var array
@@ -165,7 +165,12 @@ class Server extends EventEmitter {
'Sabre\\DAV\\ICollection' => '{DAV:}collection',
];
- public $enablePropfindDepthInfinity = false;
+ /**
+ * This property allows the usage of depth INFINITY.
+ *
+ * @var bool
+ */
+ public $enablePropfindDepthInfinity = false;
/**
* If this setting is turned off, SabreDAV's version number will be hidden
@@ -846,18 +851,18 @@ class Server extends EventEmitter {
}
- /**
- * Small helper to support PROPFIND with DEPTH_INFINITY.
- */
- private function addPathNodesRecursively(&$nodes, $path) {
- foreach($this->tree->getChildren($path) as $childNode) {
- $nodes[$path . '/' . $childNode->getName()] = $childNode;
- if ($childNode instanceof \Sabre\DAV\ICollection)
- $this->addPathNodesRecursively($nodes, $path . '/' . $childNode->getName());
- }
- }
-
- /**
+ /**
+ * Small helper to support PROPFIND with DEPTH_INFINITY.
+ */
+ private function addPathNodesRecursively(&$nodes, $path) {
+ foreach($this->tree->getChildren($path) as $childNode) {
+ $nodes[$path . '/' . $childNode->getName()] = $childNode;
+ if ($childNode instanceof ICollection)
+ $this->addPathNodesRecursively($nodes, $path . '/' . $childNode->getName());
+ }
+ }
+
+ /**
* Returns a list of properties for a given path
*
* The path that should be supplied should have the baseUrl stripped out
@@ -873,10 +878,10 @@ class Server extends EventEmitter {
*/
public function getPropertiesForPath($path, $propertyNames = [], $depth = 0) {
- // The only two options for the depth of a propfind is 0 or 1 - as long as depth infinity is not enabled
- if (!$this->enablePropfindDepthInfinity && $depth != 0) $depth = 1;
+ // The only two options for the depth of a propfind is 0 or 1 - as long as depth infinity is not enabled
+ if (!$this->enablePropfindDepthInfinity && $depth != 0) $depth = 1;
- $path = rtrim($path,'/');
+ $path = rtrim($path,'/');
// This event allows people to intercept these requests early on in the
// process.
@@ -894,12 +899,12 @@ class Server extends EventEmitter {
if ($depth==1 && $parentNode instanceof ICollection) {
foreach($this->tree->getChildren($path) as $childNode)
$nodes[$path . '/' . $childNode->getName()] = $childNode;
- } else if ($depth == self::DEPTH_INFINITY && $parentNode instanceof \Sabre\DAV\ICollection) {
- $this->addPathNodesRecursively($nodes, $path);
+ } else if ($depth == self::DEPTH_INFINITY && $parentNode instanceof ICollection) {
+ $this->addPathNodesRecursively($nodes, $path);
}
- foreach($nodes as $myPath=>$node) {
+ foreach($nodes as $myPath=>$node) {
$r = $this->getPropertiesByNode($myPath, $node, $propertyNames);
if ($r) {
diff --git a/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php b/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php
index e3e24d8..605714c 100644
--- a/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php
+++ b/tests/Sabre/DAV/ServerPropsInfiniteDepthTest.php
@@ -3,7 +3,6 @@
namespace Sabre\DAV;
use Sabre\HTTP;
-require_once 'Sabre/HTTP/ResponseMock.php';
require_once 'Sabre/DAV/AbstractServer.php';
class ServerPropsInfiniteDepthTest extends AbstractServer {
@@ -19,11 +18,11 @@ class ServerPropsInfiniteDepthTest extends AbstractServer {
if (file_exists(SABRE_TEMPDIR.'../.sabredav')) unlink(SABRE_TEMPDIR.'../.sabredav');
parent::setUp();
file_put_contents(SABRE_TEMPDIR . '/test2.txt', 'Test contents2');
- mkdir(SABRE_TEMPDIR . '/col');
- mkdir(SABRE_TEMPDIR . '/col/col');
+ mkdir(SABRE_TEMPDIR . '/col');
+ mkdir(SABRE_TEMPDIR . '/col/col');
file_put_contents(SABRE_TEMPDIR . 'col/col/test.txt', 'Test contents');
$this->server->addPlugin(new Locks\Plugin(new Locks\Backend\File(SABRE_TEMPDIR . '/.locksdb')));
- $this->server->enablePropfindDepthInfinity = true;
+ $this->server->enablePropfindDepthInfinity = true;
}
@@ -87,7 +86,7 @@ class ServerPropsInfiniteDepthTest extends AbstractServer {
$this->assertEquals('/',(string)$data,'href element should have been /');
$data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:resourcetype');
- // 8 resources are to be returned: /, col, col/col, col/col/test.txt, dir, dir/child.txt, test.txt and test2.txt
+ // 8 resources are to be returned: /, col, col/col, col/col/test.txt, dir, dir/child.txt, test.txt and test2.txt
$this->assertEquals(8,count($data));
}
--
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