[Pkg-owncloud-commits] [php-sabredav] 140/163: Allowing users to turn on the property storage plugin on a per-path basis.

David Prévot taffit at moszumanska.debian.org
Tue May 20 18:55:02 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 eded86f572ff21359e3ab1ef240876ce26525049
Author: Evert Pot <me at evertpot.com>
Date:   Thu May 15 13:52:56 2014 -0400

    Allowing users to turn on the property storage plugin on a per-path
    basis.
---
 lib/DAV/PropertyStorage/Plugin.php | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/lib/DAV/PropertyStorage/Plugin.php b/lib/DAV/PropertyStorage/Plugin.php
index e787a1f..56ed4d7 100644
--- a/lib/DAV/PropertyStorage/Plugin.php
+++ b/lib/DAV/PropertyStorage/Plugin.php
@@ -11,6 +11,18 @@ use Sabre\DAV\INode;
 class Plugin extends ServerPlugin {
 
     /**
+     * If you only want this plugin to store properties for a limited set of
+     * paths, you can use a pathFilter to do this.
+     *
+     * The pathFilter should be a callable. The callable retrieves a path as
+     * its argument, and should return true or false wether it allows
+     * properties to be stored.
+     *
+     * @var callable
+     */
+    public $pathFilter;
+
+    /**
      * Creates the plugin
      *
      * @param Backend\BackendInterface $backend
@@ -52,6 +64,8 @@ class Plugin extends ServerPlugin {
      */
     public function propFind(PropFind $propFind, INode $node) {
 
+        $path = $propFind->getPath();
+        if ($this->pathFilter && !$this->pathFilter($path)) return;
         $this->backend->propFind($propFind->getPath(), $propFind);
 
     }
@@ -68,6 +82,7 @@ class Plugin extends ServerPlugin {
      */
     public function propPatch($path, PropPatch $propPatch) {
 
+        if ($this->pathFilter && !$this->pathFilter($path)) return;
         $this->backend->propPatch($path, $propPatch);
 
     }
@@ -83,6 +98,7 @@ class Plugin extends ServerPlugin {
      */
     public function afterUnbind($path) {
 
+        if ($this->pathFilter && !$this->pathFilter($path)) return;
         $this->backend->delete($path);
 
     }

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