eZ Publish Community Project (Legacy Stack) 2013.4
Class

eZWebDAVContentBackend

class eZWebDAVContentBackend extends ezcWebdavSimpleBackend implements ezcWebdavLockBackend

WebDAV backend for eZ Publish, based on eZ Components Webdav component.

Constants

VIRTUAL_CONTENT_FOLDER_NAME

The name of the content folder in eZ Publish.

VIRTUAL_MEDIA_FOLDER_NAME

The name of the media folder in eZ Publish.

WEBDAV_INI_FILE

The ini file which holds settings for WebDAV.

DIRECTORY_MIMETYPE

Mimetype for directories.

DEFAULT_MIMETYPE

Mimetype for eZ Publish objects which don't have a mimetype.

DEFAULT_SIZE

Default size in bytes for eZ Publish objects which don't have a size.

Methods

__construct()

Creates a new backend instance.

void lock(int $waitTime, int $timeout)

Locks the backend.

void unlock()

Removes the lock.

ezcWebdavProperty getProperty(string $path, string $propertyName, string $namespace = 'DAV:')

Returns a property of a resource.

ezcWebdavPropertyStorage getAllProperties(string $path)

Returns all properties for a resource.

ezcWebdavResponse get(ezcWebdavGetRequest $request)

Serves GET requests.

ezcWebdavResponse head(ezcWebdavHeadRequest $request)

Serves HEAD requests.

ezcWebdavResponse propFind(ezcWebdavPropFindRequest $request)

Serves PROPFIND requests.

ezcWebdavResponse propPatch(ezcWebdavPropPatchRequest $request)

Serves PROPPATCH requests.

bool setProperty(string $path, ezcWebdavProperty $property)

Manually sets a property on a resource.

bool removeProperty(string $path, ezcWebdavProperty $property)

Manually removes a property from a resource.

bool resetProperties(string $path, ezcWebdavPropertyStorage $storage)

Resets the property storage for a resource.

ezcWebdavResponse put(ezcWebdavPutRequest $request)

Serves PUT requests.

ezcWebdavResponse delete(ezcWebdavDeleteRequest $request)

Serves DELETE requests.

array checkDeleteRecursive($target)

Returns if everything below a path can be deleted recursively.

ezcWebdavResponse copy(ezcWebdavCopyRequest $request)

Serves COPY requests.

array copyRecursive(string $source, string $destination, int $depth = ezcWebdavRequest::DEPTH_INFINITY)

Recursively copy a file or directory.

array moveRecursive(string $source, string $destination, int $depth = ezcWebdavRequest::DEPTH_INFINITY)

Recursively move a file or directory.

ezcWebdavResponse move(ezcWebdavMoveRequest $request)

Serves MOVE requests.

ezcWebdavResponse makeCollection(ezcWebdavMakeCollectionRequest $request)

Serves MKCOL (make collection) requests.

ezcWebdavResponse options(ezcWebdavOptionsRequest $request)

Required method to serve OPTIONS requests.

setCurrentSite(string $site)

Sets the current site.

string currentSiteFromPath(string $path)

Detects a possible/valid site-name in start of a path.

static  appendLogEntry(string $logString, string $label = false)

Logs to var/log/webdav.log AND var//log/webdav.log.

static string virtualContentFolderName()

The name of the content folder in eZ Publish, translated.

static string virtualMediaFolderName()

The name of the media folder in eZ Publish, translated.

Details

at line 119
public __construct()

Creates a new backend instance.

at line 148
public void lock(int $waitTime, int $timeout)

Locks the backend.

Tries to lock the backend. If the lock is already owned by this process, locking is successful. If $timeout is reached before a lock could be acquired, an {@link ezcWebdavLockTimeoutException} is thrown. Waits $waitTime microseconds between attempts to lock the backend.

Parameters

int $waitTime
int $timeout

Return Value

void

at line 158
public void unlock()

Removes the lock.

Return Value

void

at line 425
public ezcWebdavProperty getProperty(string $path, string $propertyName, string $namespace = 'DAV:')

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.

Parameters

string $path
string $propertyName
string $namespace

Return Value

ezcWebdavProperty

at line 523
public ezcWebdavPropertyStorage getAllProperties(string $path)

Returns all properties for a resource.

Returns all properties for the resource identified by $path as a {@link ezcWebdavBasicPropertyStorage}.

Parameters

string $path

Return Value

ezcWebdavPropertyStorage

at line 609
public ezcWebdavResponse get(ezcWebdavGetRequest $request)

Serves GET requests.

The method receives a {@link ezcWebdavGetRequest} object containing all relevant information obout the clients request and will return an {@link ezcWebdavErrorResponse} instance on error or an instance of {@link ezcWebdavGetResourceResponse} or {@link ezcWebdavGetCollectionResponse} on success, depending on the type of resource that is referenced by the request.

This method acquires the internal lock of the backend, dispatches to {@link ezcWebdavSimpleBackend} to perform the operation and releases the lock afterwards.

Parameters

ezcWebdavGetRequest $request

Return Value

ezcWebdavResponse

at line 633
public ezcWebdavResponse head(ezcWebdavHeadRequest $request)

Serves HEAD requests.

The method receives a {@link ezcWebdavHeadRequest} object containing all relevant information obout the clients request and will return an {@link ezcWebdavErrorResponse} instance on error or an instance of {@link ezcWebdavHeadResponse} on success.

This method acquires the internal lock of the backend, dispatches to {@link ezcWebdavSimpleBackend} to perform the operation and releases the lock afterwards.

Parameters

ezcWebdavHeadRequest $request

Return Value

ezcWebdavResponse

at line 672
public ezcWebdavResponse propFind(ezcWebdavPropFindRequest $request)

Serves PROPFIND requests.

The method receives a {@link ezcWebdavPropFindRequest} object containing all relevant information obout the clients request and will either return an instance of {@link ezcWebdavErrorResponse} to indicate an error or a {@link ezcWebdavPropFindResponse} on success. If the referenced resource is a collection or if some properties produced errors, an instance of {@link ezcWebdavMultistatusResponse} may be returned.

The {@link ezcWebdavPropFindRequest} object contains a definition to find one or more properties of a given collection or non-collection resource.

This method acquires the internal lock of the backend, dispatches to {@link ezcWebdavSimpleBackend} to perform the operation and releases the lock afterwards.

This method is an overwrite of the propFind method from ezcWebdavSimpleBackend, a hack necessary to permit correct output of eZ Publish nodes. The array of ezcWebdavPropFindResponse objects returned by ezcWebdavSimpleBackend::propFind is iterated and the paths of the nodes in the ezcWebdavPropFindResponse objects are encoded properly, in order to be displayed correctly in WebDAV clients. The encoding is from the ini setting Charset in [CharacterSettings] in i18n.ini.

Parameters

ezcWebdavPropFindRequest $request

Return Value

ezcWebdavResponse

at line 723
public ezcWebdavResponse propPatch(ezcWebdavPropPatchRequest $request)

Serves PROPPATCH requests.

The method receives a {@link ezcWebdavPropPatchRequest} object containing all relevant information obout the clients request and will return an instance of {@link ezcWebdavErrorResponse} on error or a {@link ezcWebdavPropPatchResponse} response on success. If the referenced resource is a collection or if only some properties produced errors, an instance of {@link ezcWebdavMultistatusResponse} may be returned.

This method acquires the internal lock of the backend, dispatches to {@link ezcWebdavSimpleBackend} to perform the operation and releases the lock afterwards.

Parameters

ezcWebdavPropPatchRequest $request

Return Value

ezcWebdavResponse

at line 757
public bool setProperty(string $path, ezcWebdavProperty $property)

Manually sets a property on a resource.

Sets the given $propertyBackup for the resource identified by $path.

Parameters

string $path
ezcWebdavProperty $property

Return Value

bool

at line 798
public bool removeProperty(string $path, ezcWebdavProperty $property)

Manually removes a property from a resource.

Removes the given $property form the resource identified by $path.

Parameters

string $path
ezcWebdavProperty $property

Return Value

bool

at line 814
public bool resetProperties(string $path, ezcWebdavPropertyStorage $storage)

Resets the property storage for a resource.

Discards the current {@link ezcWebdavPropertyStorage} of the resource identified by $path and replaces it with the given $properties.

Parameters

string $path
ezcWebdavPropertyStorage $storage

Return Value

bool

at line 834
public ezcWebdavResponse put(ezcWebdavPutRequest $request)

Serves PUT requests.

The method receives a {@link ezcWebdavPutRequest} objects containing all relevant information obout the clients request and will return an instance of {@link ezcWebdavErrorResponse} on error or {@link ezcWebdavPutResponse} on success.

This method acquires the internal lock of the backend, dispatches to {@link ezcWebdavSimpleBackend} to perform the operation and releases the lock afterwards.

Parameters

ezcWebdavPutRequest $request

Return Value

ezcWebdavResponse

at line 910
public ezcWebdavResponse delete(ezcWebdavDeleteRequest $request)

Serves DELETE requests.

The method receives a {@link ezcWebdavDeleteRequest} objects containing all relevant information obout the clients request and will return an instance of {@link ezcWebdavErrorResponse} on error or {@link ezcWebdavDeleteResponse} on success.

This method acquires the internal lock of the backend, dispatches to {@link ezcWebdavSimpleBackend} to perform the operation and releases the lock afterwards.

Parameters

ezcWebdavDeleteRequest $request

Return Value

ezcWebdavResponse

at line 929
public array checkDeleteRecursive($target)

Returns if everything below a path can be deleted recursively.

Checks files and directories recursively and returns if everything can be deleted. Returns an empty array if no errors occured, and an array with the files which caused errors otherwise.

Parameters

$target

Return Value

array

at line 1028
public ezcWebdavResponse copy(ezcWebdavCopyRequest $request)

Serves COPY requests.

The method receives a {@link ezcWebdavCopyRequest} objects containing all relevant information obout the clients request and will return an instance of {@link ezcWebdavErrorResponse} on error or {@link ezcWebdavCopyResponse} on success. If only some operations failed, this method may return an instance of {@link ezcWebdavMultistatusResponse}.

This method acquires the internal lock of the backend, dispatches to {@link ezcWebdavSimpleBackend} to perform the operation and releases the lock afterwards.

Parameters

ezcWebdavCopyRequest $request

Return Value

ezcWebdavResponse

at line 1119
public array copyRecursive(string $source, string $destination, int $depth = ezcWebdavRequest::DEPTH_INFINITY)

Recursively copy a file or directory.

Recursively copy a file or directory in $source to the given $destination. If a $depth is given, the operation will stop as soon as the given recursion depth is reached. A depth of -1 means no limit, while a depth of 0 means, that only the current file or directory will be copied, without any recursion.

Returns an empty array if no errors occured, and an array with the files which caused errors otherwise.

Parameters

string $source
string $destination
int $depth

Return Value

array

at line 1191
public array moveRecursive(string $source, string $destination, int $depth = ezcWebdavRequest::DEPTH_INFINITY)

Recursively move a file or directory.

Recursively move a file or directory in $source to the given $destination. If a $depth is given, the operation will stop as soon as the given recursion depth is reached. A depth of -1 means no limit, while a depth of 0 means, that only the current file or directory will be copied, without any recursion.

Returns an empty array if no errors occured, and an array with the files which caused errors otherwise.

Parameters

string $source
string $destination
int $depth

Return Value

array

at line 1263
public ezcWebdavResponse move(ezcWebdavMoveRequest $request)

Serves MOVE requests.

The method receives a {@link ezcWebdavMoveRequest} objects containing all relevant information obout the clients request and will return an instance of {@link ezcWebdavErrorResponse} on error or {@link ezcWebdavMoveResponse} on success. If only some operations failed, this method may return an instance of {@link ezcWebdavMultistatusResponse}.

This method acquires the internal lock of the backend, dispatches to {@link ezcWebdavSimpleBackend} to perform the operation and releases the lock afterwards.

Parameters

ezcWebdavMoveRequest $request

Return Value

ezcWebdavResponse

at line 1287
public ezcWebdavResponse makeCollection(ezcWebdavMakeCollectionRequest $request)

Serves MKCOL (make collection) requests.

The method receives a {@link ezcWebdavMakeCollectionRequest} objects containing all relevant information obout the clients request and will return an instance of {@link ezcWebdavErrorResponse} on error or {@link ezcWebdavMakeCollectionResponse} on success.

This method acquires the internal lock of the backend, dispatches to {@link ezcWebdavSimpleBackend} to perform the operation and releases the lock afterwards.

Parameters

ezcWebdavMakeCollectionRequest $request

Return Value

ezcWebdavResponse

at line 1308
public ezcWebdavResponse options(ezcWebdavOptionsRequest $request)

Required method to serve OPTIONS requests.

The method receives a {@link ezcWebdavOptionsRequest} object containing all relevant information obout the clients request and should either return an error by returning an {@link ezcWebdavErrorResponse} object, or any other {@link ezcWebdavResponse} objects.

Parameters

ezcWebdavOptionsRequest $request

Return Value

ezcWebdavResponse

at line 1356
public setCurrentSite(string $site)

Sets the current site.

From eZ Publish.

Parameters

string $site Eg. 'plainsiteuser'

at line 1382
public string currentSiteFromPath(string $path)

Detects a possible/valid site-name in start of a path.

From eZ Publish.

Parameters

string $path Eg. '/plainsiteuser/Content/Folder1/file1.txt'

Return Value

string The name of the site that was detected (eg. 'plainsiteuser') or false if not site could be detected

at line 3085
static public appendLogEntry(string $logString, string $label = false)

Logs to var/log/webdav.log AND var//log/webdav.log.

From eZ Publish.

Parameters

string $logString String to record
string $label Label to put in front of $logString

at line 3161
static public string virtualContentFolderName()

The name of the content folder in eZ Publish, translated.

Return Value

string

at line 3171
static public string virtualMediaFolderName()

The name of the media folder in eZ Publish, translated.

Return Value

string