Abstract base class for common backend operations.
This base backend provides the generic handling of requests and dispatches the required actions to some basic manipulation methods, which you are required to implement, when extending this base class.
This backend does not provide support for extended Webdav features, like compression, or lock handling by the backend, therefore the getFeatures() method is final. If you want to develop a backend which is capable of manual handling those features directly extend from ezcWebdavBackend.
Source for this file: /Webdav/src/backends/simple.php
ezcWebdavBackend | --ezcWebdavSimpleBackend
Version: | //autogentag// |
Child Class | Description |
---|---|
ezcWebdavFileBackend | File system based backend. |
From ezcWebdavBackend: | |
---|---|
ezcWebdavBackend::COMPRESSION_BZIP2
|
Backend has native support for bzip2 compression. |
ezcWebdavBackend::COMPRESSION_GZIP
|
Backend has native support for gzip compression. |
ezcWebdavBackend::CUSTOM_LOCK
|
Backend performs locking itself - no handling by server is required. |
ezcWebdavBackend::MULTIPART
|
Backend has native support for multipart requests. |
ezcWebdavBackend::PARTIAL
|
Backend has native support for partial requests. |
protected ezcWebdavErrorResponse|null |
checkIfMatchHeaders(
$req
, $path
)
Checks the If-Match and If-None-Match headers. |
public ezcWebdavResponse |
copy(
$request
)
Serves COPY requests. |
protected abstract void |
createCollection(
$path
)
Create a new collection. |
protected abstract void |
createResource(
$path
, [ $content
= null] )
Create a new resource. |
public ezcWebdavResponse |
delete(
$request
)
Serves DELETE requests. |
protected ezcWebdavMultistatusResponse |
fetchAllProperties(
$request
)
Returns all available properties for a resource. |
protected ezcWebdavResponse |
fetchProperties(
$request
)
Returns properties, fetched by name. |
protected ezcWebdavResponse |
fetchPropertyNames(
$request
)
Returns names of all available properties for a resource. |
public ezcWebdavResponse |
get(
$request
)
Serves GET requests. |
public abstract ezcWebdavPropertyStorage |
getAllProperties(
$path
)
Returns all properties for a resource. |
protected abstract array(ezcWebdavResource|ezcWebdavCollection) |
getCollectionMembers(
$path
)
Returns members of collection. |
protected void |
getETag(
$path
)
Returns the etag representing the current state of $path. |
public int |
getFeatures(
)
Returns additional features supported by the backend. |
protected array(ezcWebdavResource|ezcWebdavCollection) |
getNodes(
$source
, $depth
)
Returns all child nodes. |
public abstract ezcWebdavProperty |
getProperty(
$path
, $propertyName
, [ $namespace
= 'DAV:'] )
Returns a property of a resource. |
protected abstract string |
getResourceContents(
$path
)
Returns the content of a resource. |
public ezcWebdavResponse |
head(
$request
)
Serves HEAD requests. |
protected abstract bool |
isCollection(
$path
)
Returns if resource is a collection. |
public ezcWebdavResponse |
makeCollection(
$request
)
Serves MKCOL (make collection) requests. |
public ezcWebdavResponse |
move(
$request
)
Serves MOVE requests. |
protected abstract bool |
nodeExists(
$path
)
Returns if a resource exists. |
public ezcWebdavOptionsResponse |
options(
$request
)
Handles the OPTIONS request. |
protected abstract array(ezcWebdavErrorResponse) |
performCopy(
$fromPath
, $toPath
, [ $depth
= ezcWebdavRequest::DEPTH_INFINITY] )
Copies resources recursively from one path to another. |
protected abstract ezcWebdavMultitstatusResponse|null |
performDelete(
$path
)
Deletes everything below a path. |
public ezcWebdavResponse |
propFind(
$request
)
Serves PROPFIND requests. |
public ezcWebdavResponse |
propPatch(
$request
)
Serves PROPPATCH requests. |
public ezcWebdavResponse |
put(
$request
)
Serves PUT requests. |
public abstract bool |
removeProperty(
$path
, $property
)
Manually removes a property from a resource. |
public abstract bool |
resetProperties(
$path
, $properties
)
Resets the property storage for a resource. |
public abstract bool |
setProperty(
$path
, $property
)
Manually sets a property on a resource. |
protected abstract void |
setResourceContents(
$path
, $content
)
Changes contents of a resource. |
From ezcWebdavBackend | |
---|---|
public abstract ezcWebdavResponse |
ezcWebdavBackend::get()
Serves GET requests. |
public int |
ezcWebdavBackend::getFeatures()
Returns additional features supported by the backend. |
public abstract ezcWebdavResponse |
ezcWebdavBackend::head()
Serves HEAD requests. |
public ezcWebdavResponse |
ezcWebdavBackend::options()
Required method to serve OPTIONS requests. |
public ezcWebdavResponse |
ezcWebdavBackend::performRequest()
Performs the given request. |
public abstract ezcWebdavResponse |
ezcWebdavBackend::propFind()
Serves PROPFIND requests. |
public abstract ezcWebdavResponse |
ezcWebdavBackend::propPatch()
Serves PROPPATCH requests. |
Checks the If-Match and If-None-Match headers.
Checks if the If-Match and If-None-Match headers (potentially) provided by $req are valid for the resource identified by $path.
Returns null if everything is alright, ezcWebdavErrorResponse if any ETag check failed.
Name | Type | Description |
---|---|---|
$req |
ezcWebdavRequest | |
$path |
string |
Serves COPY requests.
The method receives a ezcWebdavCopyRequest objects containing all relevant information obout the clients request and will return an instance of ezcWebdavErrorResponse on error or ezcWebdavCopyResponse on success. If only some operations failed, this method may return an instance of ezcWebdavMultistatusResponse.
Name | Type | Description |
---|---|---|
$request |
ezcWebdavCopyRequest |
Method | Description |
---|---|
ezcWebdavBackendChange::copy() |
Serves COPY requests. |
Method | Description |
---|---|
ezcWebdavFileBackend::copy() |
Serves COPY requests. |
Create a new collection.
Creates a new collection at the given $path.
Name | Type | Description |
---|---|---|
$path |
string |
Method | Description |
---|---|
ezcWebdavFileBackend::createCollection() |
Creates a new collection. |
Create a new resource.
Creates a new resource at the given $path, optionally with the given $content.
Name | Type | Description |
---|---|---|
$path |
string | |
$content |
string |
Method | Description |
---|---|
ezcWebdavFileBackend::createResource() |
Creates a new resource. |
Serves DELETE requests.
The method receives a ezcWebdavDeleteRequest objects containing all relevant information obout the clients request and will return an instance of ezcWebdavErrorResponse on error or ezcWebdavDeleteResponse on success.
Name | Type | Description |
---|---|---|
$request |
ezcWebdavDeleteRequest |
Method | Description |
---|---|
ezcWebdavBackendChange::delete() |
Serves DELETE requests. |
Method | Description |
---|---|
ezcWebdavFileBackend::delete() |
Serves DELETE requests. |
Returns all available properties for a resource.
Fetches all available properties assigned to the reosource referenced in $request and, if the resource is a collection, also returns properties for its children, depending on the depth header of the $request. The instances of ezcWebdavPropFindResponse generated by this method are encapsulated in a ezcWebdavMultistatusResponse object.
Name | Type | Description |
---|---|---|
$request |
ezcWebdavPropFindRequest |
Returns properties, fetched by name.
Fetch properties as defined by the passed $request for the resource referenced. Properties are fetched by their names.
This method checks also for each of the nodes affected by the request if authorization suceeds.
Name | Type | Description |
---|---|---|
$request |
ezcWebdavPropFindRequest |
Returns names of all available properties for a resource.
Fetches the names of all properties assigned to the reosource referenced in $request and, if the resozurce is a collection, also returns property names for its children, depending on the depth header of the $request.
Name | Type | Description |
---|---|---|
$request |
ezcWebdavPropFindRequest |
Serves GET requests.
The method receives a ezcWebdavGetRequest object containing all relevant information obout the clients request and will return an ezcWebdavErrorResponse instance on error or an instance of ezcWebdavGetResourceResponse or ezcWebdavGetCollectionResponse on success, depending on the type of resource that is referenced by the request.
Name | Type | Description |
---|---|---|
$request |
ezcWebdavGetRequest |
Method | Description |
---|---|
ezcWebdavBackend::get() |
Serves GET requests. |
Method | Description |
---|---|
ezcWebdavFileBackend::get() |
Serves GET requests. |
Returns all properties for a resource.
Returns all properties for the resource identified by $path as a ezcWebdavBasicPropertyStorage.
Name | Type | Description |
---|---|---|
$path |
string |
Method | Description |
---|---|
ezcWebdavFileBackend::getAllProperties() |
Returns all properties for a resource. |
Returns members of collection.
Returns an array with the members of the collection identified by $path. The returned array can contain ezcWebdavCollection, and ezcWebdavResource instances and might also be empty, if the collection has no members.
Name | Type | Description |
---|---|---|
$path |
string |
Method | Description |
---|---|
ezcWebdavFileBackend::getCollectionMembers() |
Returns members of collection. |
Returns the etag representing the current state of $path.
Calculates and returns the ETag for the resource represented by $path. The ETag is calculated from the $path itself and the following properties, which are concatenated and md5 hashed:
This method can be overwritten in custom backend implementations to access the information needed directly without using the way around properties.
Custom backend implementations are encouraged to use the same mechanism (or this method itself) to determine and generate ETags.
Name | Type | Description |
---|---|---|
$path |
mixed |
Method | Description |
---|---|
ezcWebdavFileBackend::getETag() |
Returns the etag representing the current state of $path. |
Returns additional features supported by the backend.
Returns a bitmap of additional features supported by the backend, referenced by constants from the basic ezcWebdavBackend class.
Method | Description |
---|---|
ezcWebdavBackend::getFeatures() |
Returns additional features supported by the backend. |
Returns all child nodes.
Get all nodes from the resource identified by $source up to the given depth. Reuses the method getCollectionMembers(), but you may want to overwrite this implementation by somethings which fits better with your backend.
Name | Type | Description |
---|---|---|
$source |
string | |
$depth |
int |
Returns a property of a resource.
Returns the property with the given $propertyName, from the resource identified by $path. You may optionally define a $namespace to receive the property from.
Name | Type | Description |
---|---|---|
$path |
string | |
$propertyName |
string | |
$namespace |
string |
Method | Description |
---|---|
ezcWebdavFileBackend::getProperty() |
Returns a property of a resource. |
Returns the content of a resource.
Returns the content of the resource identified by $path.
Name | Type | Description |
---|---|---|
$path |
string |
Method | Description |
---|---|
ezcWebdavFileBackend::getResourceContents() |
Returns the contents of a resource. |
Serves HEAD requests.
The method receives a ezcWebdavHeadRequest object containing all relevant information obout the clients request and will return an ezcWebdavErrorResponse instance on error or an instance of ezcWebdavHeadResponse on success.
Name | Type | Description |
---|---|---|
$request |
ezcWebdavHeadRequest |
Method | Description |
---|---|
ezcWebdavBackend::head() |
Serves HEAD requests. |
Method | Description |
---|---|
ezcWebdavFileBackend::head() |
Serves HEAD requests. |
Returns if resource is a collection.
Returns if the resource identified by $path is a collection resource (true) or a non-collection one (false).
Name | Type | Description |
---|---|---|
$path |
string |
Method | Description |
---|---|
ezcWebdavFileBackend::isCollection() |
Returns if resource is a collection. |
Serves MKCOL (make collection) requests.
The method receives a ezcWebdavMakeCollectionRequest objects containing all relevant information obout the clients request and will return an instance of ezcWebdavErrorResponse on error or ezcWebdavMakeCollectionResponse on success.
Name | Type | Description |
---|---|---|
$request |
ezcWebdavMakeCollectionRequest |
Method | Description |
---|---|
ezcWebdavBackendMakeCollection::makeCollection() |
Serves MKCOL (make collection) requests. |
Method | Description |
---|---|
ezcWebdavFileBackend::makeCollection() |
Serves MKCOL (make collection) requests. |
Serves MOVE requests.
The method receives a ezcWebdavMoveRequest objects containing all relevant information obout the clients request and will return an instance of ezcWebdavErrorResponse on error or ezcWebdavMoveResponse on success. If only some operations failed, this method may return an instance of ezcWebdavMultistatusResponse.
Name | Type | Description |
---|---|---|
$request |
ezcWebdavMoveRequest |
Method | Description |
---|---|
ezcWebdavBackendChange::move() |
Serves MOVE requests. |
Method | Description |
---|---|
ezcWebdavFileBackend::move() |
Serves MOVE requests. |
Returns if a resource exists.
Returns if a the resource identified by $path exists.
Name | Type | Description |
---|---|---|
$path |
string |
Method | Description |
---|---|
ezcWebdavFileBackend::nodeExists() |
Returns if a resource exists. |
Handles the OPTIONS request.
Applies authorization checking to the OPTIONS request and returns the parent response.
Name | Type | Description |
---|---|---|
$request |
ezcWebdavOptionsRequest |
Method | Description |
---|---|
ezcWebdavBackend::options() |
Required method to serve OPTIONS requests. |
Copies resources recursively from one path to another.
Copies the resourced identified by $fromPath recursively to $toPath with the given $depth, where $depth is one of ezcWebdavRequest::DEPTH_ZERO, ezcWebdavRequest::DEPTH_ONE, ezcWebdavRequest::DEPTH_INFINITY.
Returns an array with ezcWebdavErrorResponses for all subtrees, where the copy operation failed. Errors for subsequent resources in a subtree should be ommitted.
If an empty array is return, the operation has been completed successfully.
Name | Type | Description |
---|---|---|
$fromPath |
string | |
$toPath |
string | |
$depth |
int |
Method | Description |
---|---|
ezcWebdavFileBackend::performCopy() |
Copies resources recursively from one path to another. |
Deletes everything below a path.
Deletes the resource identified by $path recursively. Returns an instance of ezcWebdavMultistatusResponse if the deletion failed, and null on success.
Name | Type | Description |
---|---|---|
$path |
string |
Method | Description |
---|---|
ezcWebdavFileBackend::performDelete() |
Deletes everything below a path. |
Serves PROPFIND requests.
The method receives a ezcWebdavPropFindRequest object containing all relevant information obout the clients request and will either return an instance of ezcWebdavErrorResponse to indicate an error or a ezcWebdavPropFindResponse on success. If the referenced resource is a collection or if some properties produced errors, an instance of ezcWebdavMultistatusResponse may be returned.
The ezcWebdavPropFindRequest object contains a definition to find one or more properties of a given collection or non-collection resource.
Name | Type | Description |
---|---|---|
$request |
ezcWebdavPropFindRequest |
Method | Description |
---|---|
ezcWebdavBackend::propFind() |
Serves PROPFIND requests. |
Method | Description |
---|---|
ezcWebdavFileBackend::propFind() |
Serves PROPFIND requests. |
Serves PROPPATCH requests.
The method receives a ezcWebdavPropPatchRequest object containing all relevant information obout the clients request and will return an instance of ezcWebdavErrorResponse on error or a ezcWebdavPropPatchResponse response on success. If the referenced resource is a collection or if only some properties produced errors, an instance of ezcWebdavMultistatusResponse may be returned.
Name | Type | Description |
---|---|---|
$request |
ezcWebdavPropPatchRequest |
Method | Description |
---|---|
ezcWebdavBackend::propPatch() |
Serves PROPPATCH requests. |
Method | Description |
---|---|
ezcWebdavFileBackend::propPatch() |
Serves PROPPATCH requests. |
Serves PUT requests.
The method receives a ezcWebdavPutRequest objects containing all relevant information obout the clients request and will return an instance of ezcWebdavErrorResponse on error or ezcWebdavPutResponse on success.
Name | Type | Description |
---|---|---|
$request |
ezcWebdavPutRequest |
Method | Description |
---|---|
ezcWebdavBackendPut::put() |
Serves PUT requests. |
Method | Description |
---|---|
ezcWebdavFileBackend::put() |
Serves PUT requests. |
Manually removes a property from a resource.
Removes the given $property form the resource identified by $path.
Name | Type | Description |
---|---|---|
$path |
string | |
$property |
ezcWebdavProperty |
Method | Description |
---|---|
ezcWebdavFileBackend::removeProperty() |
Manually removes a property from a resource. |
Resets the property storage for a resource.
Discardes the current ezcWebdavPropertyStorage of the resource identified by $path and replaces it with the given $properties.
Name | Type | Description |
---|---|---|
$path |
string | |
$properties |
ezcWebdavPropertyStorage |
Method | Description |
---|---|
ezcWebdavFileBackend::resetProperties() |
Resets the property storage for a resource. |
Manually sets a property on a resource.
Sets the given $propertyBackup for the resource identified by $path.
Name | Type | Description |
---|---|---|
$path |
string | |
$property |
ezcWebdavProperty |
Method | Description |
---|---|
ezcWebdavFileBackend::setProperty() |
Manually sets a property on a resource. |
Changes contents of a resource.
This method is used to change the contents of the resource identified by $path to the given $content.
Name | Type | Description |
---|---|---|
$path |
string | |
$content |
string |
Method | Description |
---|---|
ezcWebdavFileBackend::setResourceContents() |
Sets the contents of a resource. |