[Pkg-owncloud-commits] [php-sabredav] 123/163: Fetching node properties now also moved into an event handler.

David Prévot taffit at moszumanska.debian.org
Tue May 20 18:55:00 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 1e37bb84d2e5b9f14938a025ddb12f738237a341
Author: Evert Pot <me at evertpot.com>
Date:   Wed May 7 17:38:19 2014 -0400

    Fetching node properties now also moved into an event handler.
---
 lib/Sabre/DAV/CorePlugin.php | 25 +++++++++++++++++++++++++
 lib/Sabre/DAV/Server.php     | 19 +------------------
 2 files changed, 26 insertions(+), 18 deletions(-)

diff --git a/lib/Sabre/DAV/CorePlugin.php b/lib/Sabre/DAV/CorePlugin.php
index 265e011..9785bf0 100644
--- a/lib/Sabre/DAV/CorePlugin.php
+++ b/lib/Sabre/DAV/CorePlugin.php
@@ -46,6 +46,7 @@ class CorePlugin extends ServerPlugin {
         $server->on('propPatch', [$this, 'propPatchProtectedPropertyCheck'], 90);
         $server->on('propPatch', [$this, 'propPatchNodeUpdate'], 200);
         $server->on('propFind',  [$this, 'propFind']);
+        $server->on('propFind',  [$this, 'propFindNode'], 120);
 
     }
 
@@ -824,4 +825,28 @@ class CorePlugin extends ServerPlugin {
 
     }
 
+    /**
+     * Fetches properties for a node.
+     *
+     * This event is called a bit later, so plugins have a chance first to
+     * populate the result.
+     *
+     * @param PropFind $propFind
+     * @param INode $node
+     * @return void
+     */
+    public function propFindNode(PropFind $propFind, INode $node) {
+
+        if ($node instanceof IProperties && $propertyNames = $propFind->get404Properties()) {
+
+            $nodeProperties = $node->getProperties($propertyNames);
+
+            foreach($nodeProperties as $propertyName=>$value) {
+                $propFind->set($propertyName, $value, 200);
+            }
+
+        }
+
+    }
+
 }
diff --git a/lib/Sabre/DAV/Server.php b/lib/Sabre/DAV/Server.php
index 50bfbd7..ff89da9 100644
--- a/lib/Sabre/DAV/Server.php
+++ b/lib/Sabre/DAV/Server.php
@@ -1006,24 +1006,7 @@ class Server extends EventEmitter {
      */
     public function getPropertiesByNode(PropFind $propFind, INode $node) {
 
-        $newProperties = [
-            '200' => [],
-            '404' => [],
-        ];
-
-        $this->emit('propFind', [$propFind, $node]);
-
-        if ($node instanceof IProperties && $propertyNames = $propFind->get404Properties()) {
-
-            $nodeProperties = $node->getProperties($propertyNames);
-
-            foreach($nodeProperties as $propertyName=>$value) {
-                $propFind->set($propertyName, $value, 200);
-            }
-
-        }
-
-        return true;
+        return $this->emit('propFind', [$propFind, $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