ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
|
Main DAV server class. More...
Public Member Functions | |
__construct ($treeOrNode=null) | |
Sets up the server. More... | |
exec () | |
Starts the DAV Server. More... | |
setBaseUri ($uri) | |
Sets the base server uri. More... | |
getBaseUri () | |
Returns the base responding uri. More... | |
guessBaseUri () | |
This method attempts to detect the base uri. More... | |
addPlugin (ServerPlugin $plugin) | |
Adds a plugin to the server. More... | |
getPlugin ($name) | |
Returns an initialized plugin by it's name. More... | |
getPlugins () | |
Returns all plugins. More... | |
getLogger () | |
Returns the PSR-3 logger object. More... | |
invokeMethod (RequestInterface $request, ResponseInterface $response, $sendResponse=true) | |
Handles a http request, and execute a method based on its name. More... | |
getAllowedMethods ($path) | |
Returns an array with all the supported HTTP methods for a specific uri. More... | |
getRequestUri () | |
Gets the uri for the request, keeping the base uri into consideration. More... | |
calculateUri ($uri) | |
Turns a URI such as the REQUEST_URI into a local path. More... | |
getHTTPDepth ($default=self::DEPTH_INFINITY) | |
Returns the HTTP depth header. More... | |
getHTTPRange () | |
Returns the HTTP range header. More... | |
getHTTPPrefer () | |
Returns the HTTP Prefer header information. More... | |
getCopyAndMoveInfo (RequestInterface $request) | |
Returns information about Copy and Move requests. More... | |
getProperties ($path, $propertyNames) | |
Returns a list of properties for a path. More... | |
getPropertiesForChildren ($path, $propertyNames) | |
A kid-friendly way to fetch properties for a node's children. More... | |
getHTTPHeaders ($path) | |
Returns a list of HTTP headers for a particular resource. More... | |
getPropertiesForPath ($path, $propertyNames=[], $depth=0) | |
Returns a list of properties for a given path. More... | |
getPropertiesIteratorForPath ($path, $propertyNames=[], $depth=0) | |
Returns a list of properties for a given path. More... | |
getPropertiesForMultiplePaths (array $paths, array $propertyNames=[]) | |
Returns a list of properties for a list of paths. More... | |
getPropertiesByNode (PropFind $propFind, INode $node) | |
Determines all properties for a node. More... | |
createFile ($uri, $data, &$etag=null) | |
This method is invoked by sub-systems creating a new file. More... | |
updateFile ($uri, $data, &$etag=null) | |
This method is invoked by sub-systems updating a file. More... | |
createDirectory ($uri) | |
This method is invoked by sub-systems creating a new directory. More... | |
createCollection ($uri, MkCol $mkCol) | |
Use this method to create a new collection. More... | |
updateProperties ($path, array $properties) | |
This method updates a resource's properties. More... | |
checkPreconditions (RequestInterface $request, ResponseInterface $response) | |
This method checks the main HTTP preconditions. More... | |
getIfConditions (RequestInterface $request) | |
This method is created to extract information from the WebDAV HTTP 'If:' header. More... | |
getResourceTypeForNode (INode $node) | |
Returns an array with resourcetypes for a node. More... | |
generateMultiStatus ($fileProperties, $strip404s=false) | |
Generates a WebDAV propfind response body based on a list of nodes. More... | |
Public Member Functions inherited from Sabre\Event\EventEmitterInterface | |
on ($eventName, callable $callBack, $priority=100) | |
Subscribe to an event. More... | |
once ($eventName, callable $callBack, $priority=100) | |
Subscribe to an event exactly once. More... | |
emit ($eventName, array $arguments=[], callable $continueCallBack=null) | |
Emits an event. More... | |
listeners ($eventName) | |
Returns the list of listeners for an event. More... | |
removeListener ($eventName, callable $listener) | |
Removes a specific listener from an event. More... | |
removeAllListeners ($eventName=null) | |
Removes all listeners. More... | |
Public Member Functions inherited from Psr\Log\LoggerAwareInterface | |
setLogger (LoggerInterface $logger) | |
Sets a logger instance on the object. More... | |
Data Fields | |
const | DEPTH_INFINITY = -1 |
Infinity is used for some request supporting the HTTP Depth header and indicates that the operation should traverse the entire tree. More... | |
const | NS_SABREDAV = 'http://sabredav.org/ns' |
XML namespace for all SabreDAV related elements. More... | |
$tree | |
$httpResponse | |
$httpRequest | |
$sapi | |
$transactionType | |
$protectedProperties | |
$debugExceptions = false | |
$resourceTypeMapping | |
$enablePropfindDepthInfinity = false | |
$xml | |
Static Public Attributes | |
static | $exposeVersion = true |
Protected Attributes | |
$baseUri = null | |
$plugins = [] | |
Private Member Functions | |
generatePathNodes (PropFind $propFind, array $yieldFirst=null) | |
Small helper to support PROPFIND with DEPTH_INFINITY. More... | |
Main DAV server class.
Definition at line 23 of file Server.php.
Sabre\DAV\Server::__construct | ( | $treeOrNode = null | ) |
Sets up the server.
If a Sabre object is passed as an argument, it will use it as the directory tree. If a Sabre is passed, it will create a Sabre and use the node as the root.
If nothing is passed, a Sabre is created in a Sabre.
If an array is passed, we automatically create a root node, and use the nodes in the array as top-level children.
Definition at line 201 of file Server.php.
References $root, and Sabre\DAV\Server\addPlugin().
Sabre\DAV\Server::addPlugin | ( | ServerPlugin | $plugin | ) |
Adds a plugin to the server.
For more information, console the documentation of Sabre
ServerPlugin | $plugin |
Definition at line 404 of file Server.php.
References Sabre\DAV\ServerPlugin\getPluginName(), and Sabre\DAV\ServerPlugin\initialize().
Referenced by Sabre\DAV\Server\__construct().
Sabre\DAV\Server::calculateUri | ( | $uri | ) |
Turns a URI such as the REQUEST_URI into a local path.
This method:
string | $uri |
Exception |
Definition at line 565 of file Server.php.
References Sabre\DAV\Server\$baseUri, Sabre\HTTP\URLUtil\decodePath(), Sabre\DAV\Server\getBaseUri(), and Sabre\Uri\normalize().
Referenced by Sabre\DAV\Server\getCopyAndMoveInfo(), Sabre\DAV\Server\getIfConditions(), and Sabre\DAV\Server\getRequestUri().
Sabre\DAV\Server::checkPreconditions | ( | RequestInterface | $request, |
ResponseInterface | $response | ||
) |
This method checks the main HTTP preconditions.
Currently these are:
The method will return true if all preconditions are met The method will return false, or throw an exception if preconditions failed. If false is returned the operation should be aborted, and the appropriate HTTP response headers are already set.
Normally this method will throw 412 Precondition Failed for failures related to If-None-Match, If-Match and If-Unmodified Since. It will set the status to 304 Not Modified for If-Modified_since.
RequestInterface | $request | |
ResponseInterface | $response |
Definition at line 1293 of file Server.php.
References $ii, $path, PHPMailer\PHPMailer\$token, Sabre\Event\EventEmitterInterface\emit(), Sabre\DAV\IFile\getETag(), Sabre\HTTP\MessageInterface\getHeader(), Sabre\DAV\Server\getIfConditions(), Sabre\HTTP\RequestInterface\getMethod(), Sabre\HTTP\RequestInterface\getPath(), Sabre\HTTP\Util\parseHTTPDate(), Sabre\HTTP\MessageInterface\setHeader(), Sabre\HTTP\ResponseInterface\setStatus(), and Sabre\HTTP\Util\toHTTPDate().
Referenced by Sabre\DAV\Server\invokeMethod().
Sabre\DAV\Server::createCollection | ( | $uri, | |
MkCol | $mkCol | ||
) |
Use this method to create a new collection.
string | $uri | The new uri |
MkCol | $mkCol |
If the parent is an instance of IExtendedCollection, it means that we can pass the MkCol object directly as it may be able to store properties immediately.
If the parent is a standard ICollection, it means only 'standard' collections can be created, so we should fail any MKCOL operation that carries extra resourcetypes.
Definition at line 1157 of file Server.php.
References $result, $success, Sabre\DAV\PropPatch\commit(), Sabre\Event\EventEmitterInterface\emit(), Sabre\DAV\PropPatch\getRemainingMutations(), Sabre\DAV\MkCol\getResourceType(), Sabre\DAV\PropPatch\getResult(), and Sabre\HTTP\URLUtil\splitPath().
Referenced by Sabre\DAV\Server\createDirectory().
Sabre\DAV\Server::createDirectory | ( | $uri | ) |
This method is invoked by sub-systems creating a new directory.
string | $uri |
Definition at line 1144 of file Server.php.
References Sabre\DAV\Server\createCollection().
Sabre\DAV\Server::createFile | ( | $uri, | |
$data, | |||
& | $etag = null |
||
) |
This method is invoked by sub-systems creating a new file.
Currently this is done by HTTP PUT and HTTP LOCK (in the Locks_Plugin). It was important to get this done through a centralized function, allowing plugins to intercept this using the beforeCreateFile event.
This method will return true if the file was actually created
string | $uri | |
resource | $data | |
string | $etag |
Definition at line 1076 of file Server.php.
References $data, $name, Sabre\Event\EventEmitterInterface\emit(), and Sabre\HTTP\URLUtil\splitPath().
Sabre\DAV\Server::exec | ( | ) |
Definition at line 240 of file Server.php.
References $h, $ignore, Sabre\Event\EventEmitterInterface\emit(), Sabre\DAV\Server\getBaseUri(), Sabre\DAV\Exception\getHTTPCode(), Sabre\DAV\Exception\getHTTPHeaders(), Sabre\DAV\Server\invokeMethod(), Sabre\DAV\Exception\serialize(), and Sabre\DAV\Version\VERSION.
Sabre\DAV\Server::generateMultiStatus | ( | $fileProperties, | |
$strip404s = false |
|||
) |
Generates a WebDAV propfind response body based on a list of nodes.
If 'strip404s' is set to true, all 404 responses will be removed.
array | \Traversable | $fileProperties | The list with nodes |
bool | $strip404s |
Definition at line 1656 of file Server.php.
References Sabre\DAV\Server\$baseUri, $response, and $w.
|
private |
Small helper to support PROPFIND with DEPTH_INFINITY.
PropFind | $propFind | |
array | $yieldFirst |
Definition at line 885 of file Server.php.
References $path, Sabre\DAV\PropFind\getDepth(), Sabre\DAV\PropFind\getPath(), and Sabre\DAV\PropFind\setDepth().
Referenced by Sabre\DAV\Server\getPropertiesIteratorForPath().
Sabre\DAV\Server::getAllowedMethods | ( | $path | ) |
Returns an array with all the supported HTTP methods for a specific uri.
string | $path |
Definition at line 512 of file Server.php.
References $path.
Sabre\DAV\Server::getBaseUri | ( | ) |
Returns the base responding uri.
Definition at line 347 of file Server.php.
References Sabre\DAV\Server\$baseUri, and Sabre\DAV\Server\guessBaseUri().
Referenced by Sabre\DAV\Server\calculateUri(), and Sabre\DAV\Server\exec().
Sabre\DAV\Server::getCopyAndMoveInfo | ( | RequestInterface | $request | ) |
Returns information about Copy and Move requests.
This function is created to help getting information about the source and the destination for the WebDAV MOVE and COPY HTTP request. It also validates a lot of information and throws proper exceptions
The returned value is an array with the following keys:
RequestInterface | $request |
Exception |
Definition at line 729 of file Server.php.
References $destination, Sabre\DAV\Server\calculateUri(), Sabre\HTTP\MessageInterface\getHeader(), Sabre\HTTP\RequestInterface\getPath(), and Sabre\HTTP\URLUtil\splitPath().
Sabre\DAV\Server::getHTTPDepth | ( | $default = self::DEPTH_INFINITY | ) |
Returns the HTTP depth header.
This method returns the contents of the HTTP depth request header. If the depth header was 'infinity' it will return the Sabre::DEPTH_INFINITY object It is possible to supply a default depth value, which is used when the depth header has invalid content, or is completely non-existent
mixed | $default |
Definition at line 603 of file Server.php.
References $default.
Sabre\DAV\Server::getHTTPHeaders | ( | $path | ) |
Returns a list of HTTP headers for a particular resource.
The generated http headers are based on properties provided by the resource. The method basically provides a simple mapping between DAV property and HTTP header.
The headers are intended to be used for HEAD and GET requests.
string | $path |
Definition at line 849 of file Server.php.
References $header, $path, Sabre\DAV\Server\getProperties(), and Sabre\HTTP\Util\toHTTPDate().
Sabre\DAV\Server::getHTTPPrefer | ( | ) |
Returns the HTTP Prefer header information.
The prefer header is defined in: http://tools.ietf.org/html/draft-snell-http-prefer-14
This method will return an array with options.
Currently, the following options may be returned: [ 'return-asynch' => true, 'return-minimal' => true, 'return-representation' => true, 'wait' => 30, 'strict' => true, 'lenient' => true, ]
This method also supports the Brief header, and will also return 'return-minimal' if the brief header was set to 't'.
For the boolean options, false will be returned if the headers are not specified. For the integer options it will be 'null'.
Definition at line 678 of file Server.php.
References $result, and Sabre\HTTP\parsePrefer().
Sabre\DAV\Server::getHTTPRange | ( | ) |
Returns the HTTP range header.
This method returns null if there is no well-formed HTTP range request header or array($start, $end).
The first number is the offset of the first byte in the range. The second number is the offset of the last byte in the range.
If the second offset is null, it should be treated as the offset of the last byte of the entity If the first offset is null, the second offset should be used to retrieve the last x bytes of the entity
Definition at line 634 of file Server.php.
Sabre\DAV\Server::getIfConditions | ( | RequestInterface | $request | ) |
This method is created to extract information from the WebDAV HTTP 'If:' header.
The If header can be quite complex, and has a bunch of features. We're using a regex to extract all relevant information The function will return an array, containing structs with the following keys
Example 1:
If: (<opaquelocktoken:181d4fae-7d8c-11d0-a765-00a0c91e6bf2>)
Would result in:
[ [ 'uri' => '/request/uri', 'tokens' => [ [ [ 'negate' => false, 'token' => 'opaquelocktoken:181d4fae-7d8c-11d0-a765-00a0c91e6bf2', 'etag' => "" ] ] ], ] ]
Example 2:
If: </path> (Not <opaquelocktoken:181d4fae-7d8c-11d0-a765-00a0c91e6bf2> ["Im An ETag"]) (["Another ETag"]) </path2> (Not ["Path2 ETag"])
Would result in:
[ [ 'uri' => 'path', 'tokens' => [ [ [ 'negate' => true, 'token' => 'opaquelocktoken:181d4fae-7d8c-11d0-a765-00a0c91e6bf2', 'etag' => '"Im An ETag"' ], [ 'negate' => false, 'token' => '', 'etag' => '"Another ETag"' ] ] ], ], [ 'uri' => 'path2', 'tokens' => [ [ [ 'negate' => true, 'token' => '', 'etag' => '"Path2 ETag"' ] ] ], ], ]
RequestInterface | $request |
Definition at line 1577 of file Server.php.
References $header, Sabre\DAV\Server\calculateUri(), Sabre\HTTP\MessageInterface\getHeader(), and Sabre\HTTP\RequestInterface\getPath().
Referenced by Sabre\DAV\Server\checkPreconditions().
Sabre\DAV\Server::getLogger | ( | ) |
Sabre\DAV\Server::getPlugin | ( | $name | ) |
Returns an initialized plugin by it's name.
This function returns null if the plugin was not found.
string | $name |
Definition at line 419 of file Server.php.
References $name.
Sabre\DAV\Server::getPlugins | ( | ) |
Returns all plugins.
Definition at line 433 of file Server.php.
References Sabre\DAV\Server\$plugins.
Sabre\DAV\Server::getProperties | ( | $path, | |
$propertyNames | |||
) |
Returns a list of properties for a path.
This is a simplified version getPropertiesForPath. If you aren't interested in status codes, but you just want to have a flat list of properties, use this method.
Please note though that any problems related to retrieving properties, such as permission issues will just result in an empty array being returned.
string | $path | |
array | $propertyNames |
Definition at line 799 of file Server.php.
References $path, $result, and Sabre\DAV\Server\getPropertiesForPath().
Referenced by Sabre\DAV\Server\getHTTPHeaders().
Determines all properties for a node.
This method tries to grab all properties for a node. This method is used internally getPropertiesForPath and a few others.
It could be useful to call this, if you already have an instance of your target node and simply want to run through the system to get a correct list of properties.
Definition at line 1056 of file Server.php.
References Sabre\Event\EventEmitterInterface\emit().
Referenced by Sabre\DAV\Server\getPropertiesForMultiplePaths(), and Sabre\DAV\Server\getPropertiesIteratorForPath().
Sabre\DAV\Server::getPropertiesForChildren | ( | $path, | |
$propertyNames | |||
) |
A kid-friendly way to fetch properties for a node's children.
The returned array will be indexed by the path of the of child node. Only properties that are actually found will be returned.
The parent node will not be returned.
string | $path | |
array | $propertyNames |
Definition at line 822 of file Server.php.
References $path, $result, $row, and Sabre\DAV\Server\getPropertiesForPath().
Sabre\DAV\Server::getPropertiesForMultiplePaths | ( | array | $paths, |
array | $propertyNames = [] |
||
) |
Returns a list of properties for a list of paths.
The path that should be supplied should have the baseUrl stripped out The list of properties should be supplied in Clark notation. If the list is empty 'allprops' is assumed.
The result is returned as an array, with paths for it's keys. The result may be returned out of order.
array | $paths | |
array | $propertyNames |
Definition at line 1014 of file Server.php.
References $nodes, $path, $r, $result, Sabre\DAV\Server\getPropertiesByNode(), and Sabre\DAV\Server\getResourceTypeForNode().
Sabre\DAV\Server::getPropertiesForPath | ( | $path, | |
$propertyNames = [] , |
|||
$depth = 0 |
|||
) |
Returns a list of properties for a given path.
The path that should be supplied should have the baseUrl stripped out The list of properties should be supplied in Clark notation. If the list is empty 'allprops' is assumed.
If a depth of 1 is requested child elements will also be returned.
string | $path | |
array | $propertyNames | |
int | $depth |
Definition at line 937 of file Server.php.
References $path, and Sabre\DAV\Server\getPropertiesIteratorForPath().
Referenced by Sabre\DAV\Server\getProperties(), and Sabre\DAV\Server\getPropertiesForChildren().
Sabre\DAV\Server::getPropertiesIteratorForPath | ( | $path, | |
$propertyNames = [] , |
|||
$depth = 0 |
|||
) |
Returns a list of properties for a given path.
The path that should be supplied should have the baseUrl stripped out The list of properties should be supplied in Clark notation. If the list is empty 'allprops' is assumed.
If a depth of 1 is requested child elements will also be returned.
string | $path | |
array | $propertyNames | |
int | $depth |
Definition at line 956 of file Server.php.
References $path, $r, $result, Sabre\DAV\PropFind\ALLPROPS, Sabre\DAV\Server\generatePathNodes(), Sabre\DAV\Server\getPropertiesByNode(), Sabre\DAV\Server\getResourceTypeForNode(), and Sabre\DAV\PropFind\NORMAL.
Referenced by Sabre\DAV\Server\getPropertiesForPath().
Sabre\DAV\Server::getRequestUri | ( | ) |
Gets the uri for the request, keeping the base uri into consideration.
Definition at line 547 of file Server.php.
References Sabre\DAV\Server\calculateUri().
Sabre\DAV\Server::getResourceTypeForNode | ( | INode | $node | ) |
Returns an array with resourcetypes for a node.
INode | $node |
Definition at line 1633 of file Server.php.
References $result.
Referenced by Sabre\DAV\Server\getPropertiesForMultiplePaths(), and Sabre\DAV\Server\getPropertiesIteratorForPath().
Sabre\DAV\Server::guessBaseUri | ( | ) |
This method attempts to detect the base uri.
Only the PATH_INFO variable is considered.
If this variable is not set, the root (/) is assumed.
Definition at line 362 of file Server.php.
References Sabre\DAV\Server\$baseUri, and Sabre\HTTP\URLUtil\decodePath().
Referenced by Sabre\DAV\Server\getBaseUri().
Sabre\DAV\Server::invokeMethod | ( | RequestInterface | $request, |
ResponseInterface | $response, | ||
$sendResponse = true |
|||
) |
Handles a http request, and execute a method based on its name.
RequestInterface | $request | |
ResponseInterface | $response | |
bool | $sendResponse | Whether to send the HTTP response to the DAV client. |
Definition at line 461 of file Server.php.
References Sabre\DAV\Server\checkPreconditions(), Sabre\Event\EventEmitterInterface\emit(), Sabre\HTTP\RequestInterface\getMethod(), Sabre\HTTP\ResponseInterface\getStatus(), Sabre\HTTP\MessageInterface\setHeader(), and Sabre\DAV\Version\VERSION.
Referenced by Sabre\DAV\Server\exec().
Sabre\DAV\Server::setBaseUri | ( | $uri | ) |
Sets the base server uri.
string | $uri |
Definition at line 332 of file Server.php.
Sabre\DAV\Server::updateFile | ( | $uri, | |
$data, | |||
& | $etag = null |
||
) |
This method is invoked by sub-systems updating a file.
This method will return true if the file was actually updated
string | $uri | |
resource | $data | |
string | $etag |
Definition at line 1117 of file Server.php.
References $data, and Sabre\Event\EventEmitterInterface\emit().
Sabre\DAV\Server::updateProperties | ( | $path, | |
array | $properties | ||
) |
This method updates a resource's properties.
The properties array must be a list of properties. Array-keys are property names in clarknotation, array-values are it's values. If a property must be deleted, the value should be null.
Note that this request should either completely succeed, or completely fail.
The response is an array with properties for keys, and http status codes as their values.
string | $path | |
array | $properties |
Definition at line 1261 of file Server.php.
References $path, and Sabre\Event\EventEmitterInterface\emit().
|
protected |
Definition at line 49 of file Server.php.
Referenced by Sabre\DAV\Server\calculateUri(), Sabre\DAV\Server\generateMultiStatus(), Sabre\DAV\Server\getBaseUri(), and Sabre\DAV\Server\guessBaseUri().
Sabre\DAV\Server::$debugExceptions = false |
Definition at line 141 of file Server.php.
Sabre\DAV\Server::$enablePropfindDepthInfinity = false |
Definition at line 167 of file Server.php.
|
static |
Sabre\DAV\Server::$httpRequest |
Definition at line 63 of file Server.php.
Sabre\DAV\Server::$httpResponse |
Definition at line 56 of file Server.php.
|
protected |
Definition at line 77 of file Server.php.
Referenced by Sabre\DAV\Server\getPlugins().
Sabre\DAV\Server::$protectedProperties |
Definition at line 100 of file Server.php.
Sabre\DAV\Server::$resourceTypeMapping |
Definition at line 152 of file Server.php.
Sabre\DAV\Server::$sapi |
Definition at line 70 of file Server.php.
Sabre\DAV\Server::$transactionType |
Definition at line 90 of file Server.php.
Sabre\DAV\Server::$tree |
Definition at line 42 of file Server.php.
Sabre\DAV\Server::$xml |
Definition at line 174 of file Server.php.
const Sabre\DAV\Server::DEPTH_INFINITY = -1 |
Infinity is used for some request supporting the HTTP Depth header and indicates that the operation should traverse the entire tree.
Definition at line 30 of file Server.php.
Referenced by Sabre\DAV\Xml\Request\SyncCollectionTest\testDeserializeInfinity(), Sabre\DAV\Locks\Backend\AbstractTest\testGetLocksParent(), Sabre\DAV\Xml\Request\SyncCollectionReport\xmlDeserialize(), and Sabre\DAV\Xml\Property\LockDiscovery\xmlSerialize().
const Sabre\DAV\Server::NS_SABREDAV = 'http://sabredav.org/ns' |
XML namespace for all SabreDAV related elements.
Definition at line 35 of file Server.php.
Referenced by Sabre\DAV\TemporaryFileFilterPlugin\httpPropfind().