ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Plugin.php
Go to the documentation of this file.
1 <?php
2 
4 
10 
26 class Plugin extends ServerPlugin {
27 
38  public $pathFilter;
39 
43  public $backend;
44 
50  function __construct(Backend\BackendInterface $backend) {
51 
52  $this->backend = $backend;
53 
54  }
55 
68 
69  $server->on('propFind', [$this, 'propFind'], 130);
70  $server->on('propPatch', [$this, 'propPatch'], 300);
71  $server->on('afterMove', [$this, 'afterMove']);
72  $server->on('afterUnbind', [$this, 'afterUnbind']);
73 
74  }
75 
86  function propFind(PropFind $propFind, INode $node) {
87 
88  $path = $propFind->getPath();
90  if ($pathFilter && !$pathFilter($path)) return;
91  $this->backend->propFind($propFind->getPath(), $propFind);
92 
93  }
94 
105  function propPatch($path, PropPatch $propPatch) {
106 
108  if ($pathFilter && !$pathFilter($path)) return;
109  $this->backend->propPatch($path, $propPatch);
110 
111  }
112 
122  function afterUnbind($path) {
123 
125  if ($pathFilter && !$pathFilter($path)) return;
126  $this->backend->delete($path);
127 
128  }
129 
140 
142  if ($pathFilter && !$pathFilter($source)) return;
143  // If the destination is filtered, afterUnbind will handle cleaning up
144  // the properties.
145  if ($pathFilter && !$pathFilter($destination)) return;
146 
147  $this->backend->move($source, $destination);
148 
149  }
150 
159  function getPluginName() {
160 
161  return 'property-storage';
162 
163  }
164 
176  function getPluginInfo() {
177 
178  return [
179  'name' => $this->getPluginName(),
180  'description' => 'This plugin allows any arbitrary WebDAV property to be set on any resource.',
181  'link' => 'http://sabre.io/dav/property-storage/',
182  ];
183 
184  }
185 }
$path
Definition: aliased.php:25
The baseclass for all server plugins.
on($eventName, callable $callBack, $priority=100)
Subscribe to an event.
This class represents a set of properties that are going to be updated.
Definition: PropPatch.php:20
getPluginInfo()
Returns a bunch of meta-data about the plugin.
Definition: Plugin.php:176
getPath()
Returns the path this PROPFIND request is for.
Definition: PropFind.php:187
$destination
This class holds all the information about a PROPFIND request.
Definition: PropFind.php:11
$server
Definition: sabredav.php:48
PropertyStorage Plugin.
Definition: Plugin.php:26
afterUnbind($path)
Called after a node is deleted.
Definition: Plugin.php:122
propPatch($path, PropPatch $propPatch)
Called during PROPPATCH operations.
Definition: Plugin.php:105
afterMove($source, $destination)
Called after a node is moved.
Definition: Plugin.php:139
Main DAV server class.
Definition: Server.php:23
The INode interface is the base interface, and the parent class of both ICollection and IFile...
Definition: INode.php:12
getPluginName()
Returns a plugin name.
Definition: Plugin.php:159
propFind(PropFind $propFind, INode $node)
Called during PROPFIND operations.
Definition: Plugin.php:86
__construct(Backend\BackendInterface $backend)
Creates the plugin.
Definition: Plugin.php:50
initialize(Server $server)
This initializes the plugin.
Definition: Plugin.php:67
$source
Definition: linkback.php:22