CorePlugin
extends ServerPlugin
in package
The core plugin provides all the basic features for a WebDAV server.
Tags
Table of Contents
- $server : Server
- Reference to server object.
- exception() : mixed
- Listens for exception events, and automatically logs them.
- getFeatures() : array<string|int, mixed>
- This method should return a list of server-features.
- getHTTPMethods() : array<string|int, mixed>
- Use this method to tell the server this plugin defines additional HTTP methods.
- getPluginInfo() : array<string|int, mixed>
- Returns a bunch of meta-data about the plugin.
- getPluginName() : string
- Returns a plugin name.
- getSupportedReportSet() : array<string|int, mixed>
- Returns a list of reports this plugin supports.
- httpCopy() : bool
- WebDAV HTTP COPY method.
- httpDelete() : mixed
- HTTP Delete.
- httpGet() : bool
- This is the default implementation for the GET method.
- httpHead() : bool
- HTTP HEAD.
- httpMkcol() : bool
- WebDAV MKCOL.
- httpMove() : bool
- WebDAV HTTP MOVE method.
- httpOptions() : bool
- HTTP OPTIONS.
- httpPropFind() : mixed
- WebDAV PROPFIND.
- httpPropPatch() : bool
- WebDAV PROPPATCH.
- httpPut() : bool
- HTTP PUT method.
- httpReport() : bool
- HTTP REPORT method implementation.
- initialize() : mixed
- Sets up the plugin.
- propFind() : mixed
- This method is called when properties are retrieved.
- propFindLate() : mixed
- This method is called when properties are retrieved.
- propFindNode() : mixed
- Fetches properties for a node.
- propPatchNodeUpdate() : mixed
- This method is called during property updates.
- propPatchProtectedPropertyCheck() : mixed
- This method is called during property updates.
Properties
$server
Reference to server object.
protected
Server
$server
Methods
exception()
Listens for exception events, and automatically logs them.
public
exception(Exception $e) : mixed
Parameters
- $e : Exception
Return values
mixed —getFeatures()
This method should return a list of server-features.
public
getFeatures() : array<string|int, mixed>
This is for example 'versioning' and is added to the DAV: header in an OPTIONS response.
Return values
array<string|int, mixed> —getHTTPMethods()
Use this method to tell the server this plugin defines additional HTTP methods.
public
getHTTPMethods(string $path) : array<string|int, mixed>
This method is passed a uri. It should only return HTTP methods that are available for the specified uri.
Parameters
- $path : string
Return values
array<string|int, mixed> —getPluginInfo()
Returns a bunch of meta-data about the plugin.
public
getPluginInfo() : array<string|int, mixed>
Providing this information is optional, and is mainly displayed by the Browser plugin.
The description key in the returned array may contain html and will not be sanitized.
Return values
array<string|int, mixed> —getPluginName()
Returns a plugin name.
public
getPluginName() : string
Using this name other plugins will be able to access other plugins using DAV\Server::getPlugin
Return values
string —getSupportedReportSet()
Returns a list of reports this plugin supports.
public
getSupportedReportSet(string $uri) : array<string|int, mixed>
This will be used in the {DAV:}supported-report-set property. Note that you still need to subscribe to the 'report' event to actually implement them
Parameters
- $uri : string
Return values
array<string|int, mixed> —httpCopy()
WebDAV HTTP COPY method.
public
httpCopy(RequestInterface $request, ResponseInterface $response) : bool
This method copies one uri to a different uri, and works much like the MOVE request A lot of the actual request processing is done in getCopyMoveInfo
Parameters
- $request : RequestInterface
- $response : ResponseInterface
Return values
bool —httpDelete()
HTTP Delete.
public
httpDelete(RequestInterface $request, ResponseInterface $response) : mixed
The HTTP delete method, deletes a given uri
Parameters
- $request : RequestInterface
- $response : ResponseInterface
Return values
mixed —httpGet()
This is the default implementation for the GET method.
public
httpGet(RequestInterface $request, ResponseInterface $response) : bool
Parameters
- $request : RequestInterface
- $response : ResponseInterface
Return values
bool —httpHead()
HTTP HEAD.
public
httpHead(RequestInterface $request, ResponseInterface $response) : bool
This method is normally used to take a peak at a url, and only get the HTTP response headers, without the body. This is used by clients to determine if a remote file was changed, so they can use a local cached version, instead of downloading it again
Parameters
- $request : RequestInterface
- $response : ResponseInterface
Return values
bool —httpMkcol()
WebDAV MKCOL.
public
httpMkcol(RequestInterface $request, ResponseInterface $response) : bool
The MKCOL method is used to create a new collection (directory) on the server
Parameters
- $request : RequestInterface
- $response : ResponseInterface
Return values
bool —httpMove()
WebDAV HTTP MOVE method.
public
httpMove(RequestInterface $request, ResponseInterface $response) : bool
This method moves one uri to a different uri. A lot of the actual request processing is done in getCopyMoveInfo
Parameters
- $request : RequestInterface
- $response : ResponseInterface
Return values
bool —httpOptions()
HTTP OPTIONS.
public
httpOptions(RequestInterface $request, ResponseInterface $response) : bool
Parameters
- $request : RequestInterface
- $response : ResponseInterface
Return values
bool —httpPropFind()
WebDAV PROPFIND.
public
httpPropFind(RequestInterface $request, ResponseInterface $response) : mixed
This WebDAV method requests information about an uri resource, or a list of resources If a client wants to receive the properties for a single resource it will add an HTTP Depth: header with a 0 value If the value is 1, it means that it also expects a list of sub-resources (e.g.: files in a directory)
The request body contains an XML data structure that has a list of properties the client understands The response body is also an xml document, containing information about every uri resource and the requested properties
It has to return a HTTP 207 Multi-status status code
Parameters
- $request : RequestInterface
- $response : ResponseInterface
Return values
mixed —httpPropPatch()
WebDAV PROPPATCH.
public
httpPropPatch(RequestInterface $request, ResponseInterface $response) : bool
This method is called to update properties on a Node. The request is an XML body with all the mutations. In this XML body it is specified which properties should be set/updated and/or deleted
Parameters
- $request : RequestInterface
- $response : ResponseInterface
Return values
bool —httpPut()
HTTP PUT method.
public
httpPut(RequestInterface $request, ResponseInterface $response) : bool
This HTTP method updates a file, or creates a new one.
If a new resource was created, a 201 Created status code should be returned. If an existing resource is updated, it's a 204 No Content
Parameters
- $request : RequestInterface
- $response : ResponseInterface
Return values
bool —httpReport()
HTTP REPORT method implementation.
public
httpReport(RequestInterface $request, ResponseInterface $response) : bool
Although the REPORT method is not part of the standard WebDAV spec (it's from rfc3253) It's used in a lot of extensions, so it made sense to implement it into the core.
Parameters
- $request : RequestInterface
- $response : ResponseInterface
Return values
bool —initialize()
Sets up the plugin.
public
initialize(Server $server) : mixed
Parameters
- $server : Server
Return values
mixed —propFind()
This method is called when properties are retrieved.
public
propFind(PropFind $propFind, INode $node) : mixed
Here we add all the default properties.
Parameters
Return values
mixed —propFindLate()
This method is called when properties are retrieved.
public
propFindLate(PropFind $propFind, INode $node) : mixed
This specific handler is called very late in the process, because we want other systems to first have a chance to handle the properties.
Parameters
Return values
mixed —propFindNode()
Fetches properties for a node.
public
propFindNode(PropFind $propFind, INode $node) : mixed
This event is called a bit later, so plugins have a chance first to populate the result.
Parameters
Return values
mixed —propPatchNodeUpdate()
This method is called during property updates.
public
propPatchNodeUpdate(string $path, PropPatch $propPatch) : mixed
Here we check if a node implements IProperties and let the node handle updating of (some) properties.
Parameters
- $path : string
- $propPatch : PropPatch
Return values
mixed —propPatchProtectedPropertyCheck()
This method is called during property updates.
public
propPatchProtectedPropertyCheck(string $path, PropPatch $propPatch) : mixed
Here we check if a user attempted to update a protected property and ensure that the process fails if this is the case.
Parameters
- $path : string
- $propPatch : PropPatch