kernel/private/classes/webdav/ezwebdavcontentbackend.php
File containing the eZWebDAVContentBackend class.
- Copyright
- Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.
- License
- eZ Business Use License Agreement Version 2.0
- Package
- kernel
- Version
- 4.6.0
\eZWebDAVContentBackend
WebDAV backend for eZ Publish, based on eZ Components Webdav component.
- Parent(s)
- \ezcWebdavSimpleBackend\ezcWebdavLockBackend
Constants

DEFAULT_MIMETYPE
= "application/octet-stream"
Mimetype for eZ Publish objects which don't have a mimetype.
Properties


\array(string)
$FolderClasses= 'null'
Contains an array with classes that are considered folder.
null
Details- Type
- \array(string)


\array(string)
$availableSites= 'array()'
The list of available sites.
array()
Details- Type
- \array(string)


\array(string=>array())
$cachedNodes= 'array()'
Holds the retrieved nodes to allow for faster retrieval on subsequent requests.
array()
Details- Type
- \array(string=>array())


\array(string=>array())
$cachedProperties= 'array()'
Holds the retrieved properties to allow for faster retrieval on subsequent requests.
array()
Details- Type
- \array(string=>array())


\array(string)
$handledLiveProperties= 'array(
'getcontentlength',
'getlastmodified',
'creationdate',
'displayname',
'getetag',
'getcontenttype',
'resourcetype',
'supportedlock',
'lockdiscovery',
)'
Names of live properties from the DAV: namespace which will be handled live, and should not be stored like dead properties.
array(
'getcontentlength',
'getlastmodified',
'creationdate',
'displayname',
'getetag',
'getcontenttype',
'resourcetype',
'supportedlock',
'lockdiscovery',
)
Details- Type
- \array(string)
Methods


acquireLock(
bool $readOnly
=
false
)
:
void
Wait and get lock for complete directory tree.
Acquire lock for the complete tree for read or write operations. This does not implement any priorities for operations, or check if several read operation may run in parallel. The plain locking should / could be extended by something more sophisticated.
If the tree already has been locked, the method waits until the lock can be acquired.
The optional second parameter $readOnly indicates wheather a read only lock should be acquired. This may be used by extended implementations, but it is not used in this implementation.
Name | Type | Description |
---|---|---|
$readOnly | bool |


appendLogEntry(
string $logString, string $label
=
false
)
:
void
Logs to var/log/webdav.log AND var/
From eZ Publish.
Name | Type | Description |
---|---|---|
$logString | string | String to record |
$label | string | Label to put in front of $logString |


checkDeleteRecursive(
$target
)
:
array
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.
Name | Type | Description |
---|---|---|
$target |
Type | Description |
---|---|
array |


copy(
\ezcWebdavCopyRequest $request
)
:
\ezcWebdavResponse
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.
Name | Type | Description |
---|---|---|
$request | \ezcWebdavCopyRequest |
Type | Description |
---|---|
\ezcWebdavResponse |


copyContent(
string $sourceSite, string $destinationSite, string $sourceVFolder, string $destinationVFolder, string $source, string $destination
)
:
bool
Copies the node specified by the path $source to $destination.
Name | Type | Description |
---|---|---|
$sourceSite | string | Eg. 'plain_site_user' |
$destinationSite | string | Eg. 'plain_site_user' |
$sourceVFolder | string | Eg. 'Content' |
$destinationVFolder | string | Eg. 'Content' |
$source | string | Eg. 'Folder1/file1.txt' |
$destination | string | Eg. 'Folder2/file1.txt' |
Type | Description |
---|---|
bool |


copyObject(
\eZContentObject $object, \eZContentObject $newParentNode
)
:
bool
Copies the specified object as a child to the node $newParentNode.
Name | Type | Description |
---|---|---|
$object | \eZContentObject | |
$newParentNode | \eZContentObject |
Type | Description |
---|---|
bool |


copyObjectSameDirectory(
\eZContentObject $object, \eZContentObject $newParentNode, string $destinationName
=
null
)
:
bool
Copies the specified object to the same folder, with optional $destinationName.
Name | Type | Description |
---|---|---|
$object | \eZContentObject | |
$newParentNode | \eZContentObject | |
$destinationName | string |
Type | Description |
---|---|
bool |


copyRecursive(
string $source, string $destination, int $depth
=
ezcWebdavRequest::DEPTH_INFINITY
)
:
array
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.
Name | Type | Description |
---|---|---|
$source | string | |
$destination | string | |
$depth | int |
Type | Description |
---|---|
array |


copyVirtualFolder(
string $sourceSite, string $destinationSite, string $source, string $destination
)
:
bool
Handles copying on the virtual folder level.
It will check if the target is below a content folder in which it calls copyContent().
Name | Type | Description |
---|---|---|
$sourceSite | string | Eg. 'plain_site_user' |
$destinationSite | string | Eg. 'plain_site_user' |
$source | string | Eg. 'Content/Folder1/file1.txt' |
$destination | string | Eg. 'Content/Folder2/file1.txt' |
Type | Description |
---|---|
bool |


createCollection(
string $target
)
:
bool
Creates a new collection (folder) at the given path $target.
Name | Type | Description |
---|---|---|
$target | string | Eg. '/plain_site_user/Content/Folder1' |
Type | Description |
---|---|
bool |


createFolder(
\eZContentObject $parentNode, string $target
)
:
bool
Creates a new folder under the given $target path.
Name | Type | Description |
---|---|---|
$parentNode | \eZContentObject | |
$target | string | Eg. 'Folder1' |
Type | Description |
---|---|
bool |


createResource(
string $path, string $content
=
null
)
:
void
Creates a new resource.
Creates a new resource at the given $path, optionally with the given content. If $content is empty, an empty resource will be created.
Name | Type | Description |
---|---|---|
$path | string | |
$content | string |


currentSiteFromPath(
string $path
)
:
string
Detects a possible/valid site-name in start of a path.
From eZ Publish.
Name | Type | Description |
---|---|---|
$path | string | Eg. '/plain_site_user/Content/Folder1/file1.txt' |
Type | Description |
---|---|
string | The name of the site that was detected (eg. 'plain_site_user') or false if not site could be detected |
- Todo
- remove or move in another class?


delete(
\ezcWebdavDeleteRequest $request
)
:
\ezcWebdavResponse
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.
Name | Type | Description |
---|---|---|
$request | \ezcWebdavDeleteRequest |
Type | Description |
---|---|
\ezcWebdavResponse |


deleteContent(
string $currentSite, string $virtualFolder, string $target
)
:
bool
Handles deletion on the content tree level.
It will try to find the node with the path $target and then try to remove it (ie. move to trash) if the user is allowed.
Name | Type | Description |
---|---|---|
$currentSite | string | Eg. 'plain_site_user' |
$virtualFolder | string | Eg. 'Content' |
$target | string | Eg. 'Folder1/file1.txt' |
Type | Description |
---|---|
bool |


deleteVirtualFolder(
string $currentSite, string $target
)
:
bool
Handles deletion on the virtual folder level.
It will check if the target is below a content folder in which it calls deleteContent().
Name | Type | Description |
---|---|---|
$currentSite | string | Eg. 'plain_site_user' |
$target | string | Eg. 'Content/Folder1/file1.txt' |
Type | Description |
---|---|
bool |


encodeResponse(
\ezcWebdavResponse $response
)
:
\ezcWebdavResponse
Encodes the path stored in $response in order to be displayed properly in WebDAV clients.
Code from eZWebDAVServer::outputCollectionContent.
Name | Type | Description |
---|---|---|
$response | \ezcWebdavResponse |
Type | Description |
---|---|
\ezcWebdavResponse |


fetchContainerNodeInfo(
string $fullPath, string $site, string $nodeName
)
:
\array(array(string=>mixed))
Same as fetchVirtualSiteContent(), but only one entry is returned (Content or Media).
An entry in the the returned array is of this form:
array( 'name' => node name (eg. 'Group picture'),
'size' => storage size of the_node in bytes (eg. 57123),
'mimetype' => mime type of the node (eg. 'image/jpeg'),
'ctime' => creation time as timestamp,
'mtime' => latest modification time as timestamp,
'href' => the path to the node (eg. '/plain_site_user/Content/Folder1/file1.jpg')
Name | Type | Description |
---|---|---|
$fullPath | string | Eg. '/plain_site_user/Content/Folder1' |
$site | string | Eg. 'plain_site_user' |
$nodeName | string | Eg. 'Folder1' |
Type | Description |
---|---|
\array(array(string=>mixed)) |


fetchContentList(
string $fullPath, \eZContentObject $node, string $target, string $depth, \array(string) $properties
)
:
\array(array(string=>mixed))
Gets and returns the content of an actual node.
List of other nodes belonging to the target node (one level below it) will be returned as well.
An entry in the the returned array is of this form:
array( 'name' => node name (eg. 'Content'),
'size' => storage size of the_node in bytes (eg. 4096 for collections),
'mimetype' => mime type of the node (eg. 'httpd/unix-directory'),
'ctime' => creation time as timestamp,
'mtime' => latest modification time as timestamp,
'href' => the path to the node (eg. '/plain_site_user/Content/')
Name | Type | Description |
---|---|---|
$fullPath | string | Eg. '/plain_site_user/Content/' |
$node | \eZContentObject | &$node The note corresponding to $fullPath |
$target | string | Eg. 'Content' |
$depth | string | One of -1 (infinite), 0, 1 |
$properties | \array(string) | Currently not used |
Type | Description |
---|---|
\array(array(string=>mixed)) |


fetchNodeByTranslation(
string $nodePathString
)
:
\eZContentObject
Attempts to fetch a possible node by translating the provided string/path to a node-number.
Name | Type | Description |
---|---|---|
$nodePathString | string | Eg. 'Folder1/file1.txt' |
Type | Description |
---|---|
\eZContentObject | Eg. the node of 'Folder1/file1.txt' |


fetchNodeInfo(
string $target, \eZContentObject $node
)
:
\array(string=>mixed)
Gathers information about a given node specified as parameter.
The format of the returned array is:
array( 'name' => node name (eg. 'Group picture'),
'size' => storage size of the_node in bytes (eg. 57123),
'mimetype' => mime type of the node (eg. 'image/jpeg'),
'ctime' => creation time as timestamp,
'mtime' => latest modification time as timestamp,
'href' => the path to the node (eg. '/plain_site_user/Content/Folder1/file1.jpg')
Name | Type | Description |
---|---|---|
$target | string | Eg. '/plain_site_user/Content/Folder1/file1.jpg |
$node | \eZContentObject | &$node The node corresponding to $target |
Type | Description |
---|---|
\array(string=>mixed) |
- Todo
- remove/replace .ini calls, eZContentUpload, eZMimeType, eZSys RequestURI
- Todo
- handle articles as files


fetchParentNodeByTranslation(
string $nodePathString
)
:
\eZContentObject
Attempts to fetch a possible node by translating the provided string/path to a node-number.
The last section of the path is removed before the actual translation: hence, the PARENT node is returned.
Name | Type | Description |
---|---|---|
$nodePathString | string | Eg. 'Folder1/file1.txt' |
Type | Description |
---|---|
\eZContentObject | Eg. the node of 'Folder1' |


fetchSiteListContent(
string $target, string $depth, \array(string) $properties
)
:
\array(array(string=>mixed))
Builds a content-list of available sites and returns it.
An entry in the the returned array is of this form:
array( 'name' => node name (eg. 'plain_site_user'),
'size' => storage size of the_node in bytes (eg. 4096 for collections),
'mimetype' => mime type of the node (eg. 'httpd/unix-directory'),
'ctime' => creation time as timestamp,
'mtime' => latest modification time as timestamp,
'href' => the path to the node (eg. '/plain_site_user/')
Name | Type | Description |
---|---|---|
$target | string | Eg. '/' |
$depth | string | One of -1 (infinite), 0, 1 |
$properties | \array(string) | Currently not used |
Type | Description |
---|---|
\array(array(string=>mixed)) |


fetchVirtualSiteContent(
string $target, string $site, string $depth, \array(string) $properties
)
:
\array(array(string=>mixed))
Builds and returns the content of the virtual start folder for a site.
The virtual startfolder is an intermediate step between the site-list and actual content. This directory contains the "content" folder which leads to the site's actual content.
An entry in the the returned array is of this form:
array( 'name' => node name (eg. 'Group picture'),
'size' => storage size of the_node in bytes (eg. 57123),
'mimetype' => mime type of the node (eg. 'image/jpeg'),
'ctime' => creation time as timestamp,
'mtime' => latest modification time as timestamp,
'href' => the path to the node (eg. '/plain_site_user/Content/Folder1/file1.jpg')
Name | Type | Description |
---|---|---|
$target | string | Eg. '/plain_site_user/Content/Folder1' |
$site | string | Eg. 'plain_site_user |
$depth | string | One of -1 (infinite), 0, 1 |
$properties | \array(string) | Currently not used |
Type | Description |
---|---|
\array(array(string=>mixed)) |


fileBasename(
string $name
)
:
string
Returns $name without the final suffix (.jpg, .gif etc.).
Name | Type | Description |
---|---|---|
$name | string |
Type | Description |
---|---|
string |
- Todo
- remove or replace


get(
\ezcWebdavGetRequest $request
)
:
\ezcWebdavResponse
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.
Name | Type | Description |
---|---|---|
$request | \ezcWebdavGetRequest |
Type | Description |
---|---|
\ezcWebdavResponse |


getAllProperties(
string $path
)
:
\ezcWebdavPropertyStorage
Returns all properties for a resource.
Returns all properties for the resource identified by $path as a {@link ezcWebdavBasicPropertyStorage}.
Name | Type | Description |
---|---|---|
$path | string |
Type | Description |
---|---|
\ezcWebdavPropertyStorage |


getCollectionContent(
string $collection, int $depth
=
false, \array(string) $properties
=
false
)
:
\array(string=>array())
Produces the collection content.
Builds either the virtual start folder with the virtual content folder in it (and additional files). OR: if we're browsing within the content folder: it gets the content of the target/given folder.
Name | Type | Description |
---|---|---|
$collection | string | Eg. '/plain_site_user/Content/Folder1' |
$depth | int | One of -1 (infinite), 0, 1 |
$properties | \array(string) | Currently not used |
Type | Description |
---|---|
\array(string=>array()) |


getCollectionMembers(
string $path, int $depth
=
ezcWebdavRequest::DEPTH_INFINITY
)
:
\array(ezcWebdavResource | \ezcWebdavCollection)
Returns members of collection.
Returns an array with the members of the collection identified by $path. The returned array can contain {@link ezcWebdavCollection}, and {@link ezcWebdavResource} instances and might also be empty, if the collection has no members.
Added $depth.
Name | Type | Description |
---|---|---|
$path | string | |
$depth | int | Added by @as |
Type | Description |
---|---|
\array(ezcWebdavResource | \ezcWebdavCollection) |


getContentNodeData(
\array(string=>mixed) $result, string $currentSite, string $virtualFolder, string $target, string $fullPath
)
:
\array(string=>mixed)
Handles data retrival on the content tree level.
The format of the returned array is the same as $result:
array( 'isFile' => bool,
'isCollection' => bool,
'file' => path to the storage file which contain the contents );
Name | Type | Description |
---|---|---|
$result | \array(string=>mixed) | |
$currentSite | string | Eg. 'plain_site_user' |
$virtualFolder | string | Eg. 'Content' |
$target | string | Eg. 'Folder1/file1.txt' |
$fullPath | string | Eg. '/plain_site_user/Content/Folder1/file1.txt' |
Type | Description |
---|---|
\array(string=>mixed) | Or false if an error appeared |
- Todo
- remove/replace eZContentUpload


getContentTreeCollection(
$currentSite, string $virtualFolder, string $collection, string $fullPath, string $depth, \array(string) $properties
)
:
\array(array(string=>mixed))
Handles collections on the content tree level.
Depending on the virtual folder we will generate a node path url and fetch the nodes for that path.
An entry in the the returned array is of this form:
array( 'name' => node name (eg. 'Folder1'),
'size' => storage size of the_node in bytes (eg. 4096 for collections),
'mimetype' => mime type of the node (eg. 'httpd/unix-directory'),
'ctime' => creation time as timestamp,
'mtime' => latest modification time as timestamp,
'href' => the path to the node (eg. '/plain_site_user/Content/Folder1/')
Name | Type | Description |
---|---|---|
$currentSite | ||
$virtualFolder | string | Eg. 'Content' |
$collection | string | Eg. 'Folder1' |
$fullPath | string | Eg. '/plain_site_user/Content/Folder1/' |
$depth | string | One of -1 (infinite), 0, 1 |
$properties | \array(string) | Currently not used |
Type | Description |
---|---|
\array(array(string=>mixed)) |


getNodeInfo(
$requestUri, $source
=
null
)
:
\array(string=>boolean)
Returns an array with information about the node with path $path.
The returned array is of this form:
array( 'nodeExists' => boolean, 'isCollection' => boolean )
Name | Type | Description |
---|---|---|
$requestUri | ||
$source |
Type | Description |
---|---|
\array(string=>boolean) |


getNodes(
$requestUri, int $depth
)
:
\array(ezcWebdavResource | \ezcWebdavCollection)
Returns all child nodes.
Get all nodes from the resource identified by $source up to the given depth. Reuses the method {@link getCollectionMembers()}, but you may want to overwrite this implementation by somethings which fits better with your backend.
Name | Type | Description |
---|---|---|
$requestUri | ||
$depth | int |
Type | Description |
---|---|
\array(ezcWebdavResource | \ezcWebdavCollection) |


getProperty(
string $path, string $propertyName, string $namespace
=
'DAV:'
)
:
\ezcWebdavProperty
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 |
Type | Description |
---|---|
\ezcWebdavProperty |


getPropertyStorage(
string $path
)
:
\ezcWebdavBasicPropertyStorage
Returns the property storage for a resource.
Returns the {@link ezcWebdavPropertyStorage} instance containing the properties for the resource identified by $path.
Name | Type | Description |
---|---|---|
$path | string |
Type | Description |
---|---|
\ezcWebdavBasicPropertyStorage |


getResourceContents(
string $target
)
:
string
Returns the contents of a resource.
This method returns the content of the resource identified by $path as a string.
Name | Type | Description |
---|---|---|
$target | string |
Type | Description |
---|---|
string |


getVirtualFolderCollection(
$currentSite, string $collection, string $fullPath, string $depth, \array(string) $properties
)
:
\array(array(string=>mixed))
Handles collections on the virtual folder level, if no virtual folder elements are accessed it lists the virtual folders.
An entry in the the returned array is of this form:
array( 'name' => node name (eg. 'Group picture'),
'size' => storage size of the_node in bytes (eg. 57123),
'mimetype' => mime type of the node (eg. 'image/jpeg'),
'ctime' => creation time as timestamp,
'mtime' => latest modification time as timestamp,
'href' => the path to the node (eg. '/plain_site_user/Content/Folder1/file1.jpg')
Name | Type | Description |
---|---|---|
$currentSite | ||
$collection | string | Eg. 'Folder1' |
$fullPath | string | Eg. '/plain_site_user/Content/Folder1' |
$depth | string | One of -1 (infinite), 0, 1 |
$properties | \array(string) | Currently not used |
Type | Description |
---|---|
\array(array(string=>mixed)) |


getVirtualFolderData(
\array(string=>mixed) $result, string $currentSite, string $target, string $fullPath
)
:
\array(string=>mixed)
Handles data retrival on the virtual folder level.
The format of the returned array is the same as $result:
array( 'isFile' => bool,
'isCollection' => bool,
'file' => path to the storage file which contain the contents );
Name | Type | Description |
---|---|---|
$result | \array(string=>mixed) | |
$currentSite | string | Eg. 'plain_site_user' |
$target | string | Eg. 'Content/Folder1/file1.txt' |
$fullPath | string | Eg. '/plain_site_user/Content/Folder1/file1.txt' |
Type | Description |
---|---|
\array(string=>mixed) | Or false if an error appeared |


head(
\ezcWebdavHeadRequest $request
)
:
\ezcWebdavResponse
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.
Name | Type | Description |
---|---|---|
$request | \ezcWebdavHeadRequest |
Type | Description |
---|---|
\ezcWebdavResponse |


internalNodePath(
string $virtualFolder, string $collection
)
:
string
Returns a path that corresponds to the internal path of nodes.
Name | Type | Description |
---|---|---|
$virtualFolder | string | |
$collection | string |
Type | Description |
---|---|
string |
- Todo
- remove or replace


isCollection(
string $path
)
:
bool
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 |
Type | Description |
---|---|
bool |


isObjectFolder(
resource $object, resource $class
)
:
void
Returns whether $class is an folder class.
Name | Type | Description |
---|---|---|
$object | resource | |
$class | resource |


lock(
int $waitTime, int $timeout
)
:
void
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.
Name | Type | Description |
---|---|---|
$waitTime | int | |
$timeout | int |


makeCollection(
\ezcWebdavMakeCollectionRequest $request
)
:
\ezcWebdavResponse
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.
Name | Type | Description |
---|---|---|
$request | \ezcWebdavMakeCollectionRequest |
Type | Description |
---|---|
\ezcWebdavResponse |


mkcolContent(
string $currentSite, string $virtualFolder, string $target
)
:
bool
Handles collection creation on the content tree level.
It will try to find the parent node of the wanted placement and create a new collection (folder etc.) as a child.
Name | Type | Description |
---|---|---|
$currentSite | string | Eg. 'plain_site_user' |
$virtualFolder | string | Eg. 'Content' |
$target | string | Eg. 'Folder1' |
Type | Description |
---|---|
bool |


mkcolVirtualFolder(
string $currentSite, string $target
)
:
bool
Handles collection creation on the virtual folder level.
It will check if the target is below a content folder in which it calls mkcolContent().
Name | Type | Description |
---|---|---|
$currentSite | string | Eg. 'plain_site_user' |
$target | string | Eg. 'Content/Folder1' |
Type | Description |
---|---|
bool |


move(
\ezcWebdavMoveRequest $request
)
:
\ezcWebdavResponse
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.
Name | Type | Description |
---|---|---|
$request | \ezcWebdavMoveRequest |
Type | Description |
---|---|
\ezcWebdavResponse |


moveContent(
string $sourceSite, string $destinationSite, string $sourceVFolder, string $destinationVFolder, string $source, string $destination, $fullSource, $fullDestination
)
:
bool
Moves the node specified by the path $source to $destination.
Name | Type | Description |
---|---|---|
$sourceSite | string | Eg. 'plain_site_user' |
$destinationSite | string | Eg. 'plain_site_user' |
$sourceVFolder | string | Eg. 'Content' |
$destinationVFolder | string | Eg. 'Content' |
$source | string | Eg. 'Folder1/file1.txt' |
$destination | string | Eg. 'Folder2/file1.txt' |
$fullSource | ||
$fullDestination |
Type | Description |
---|---|
bool |


moveRecursive(
string $source, string $destination, int $depth
=
ezcWebdavRequest::DEPTH_INFINITY
)
:
array
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.
Name | Type | Description |
---|---|---|
$source | string | |
$destination | string | |
$depth | int |
Type | Description |
---|---|
array |


moveVirtualFolder(
string $sourceSite, string $destinationSite, string $source, string $destination, $fullSource, $fullDestination
)
:
bool
Handles moving on the virtual folder level.
It will check if the target is below a content folder in which it calls moveContent().
Name | Type | Description |
---|---|---|
$sourceSite | string | Eg. 'plain_site_user' |
$destinationSite | string | Eg. 'plain_site_user' |
$source | string | Eg. 'Content/Folder1/file1.txt' |
$destination | string | Eg. 'Content/Folder2/file1.txt' |
$fullSource | ||
$fullDestination |
Type | Description |
---|---|
bool |


nodeExists(
string $path
)
:
bool
Returns if a resource exists.
Returns if a the resource identified by $path exists.
Name | Type | Description |
---|---|---|
$path | string |
Type | Description |
---|---|
bool |


options(
\ezcWebdavOptionsRequest $request
)
:
\ezcWebdavResponse
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.
Name | Type | Description |
---|---|---|
$request | \ezcWebdavOptionsRequest |
Type | Description |
---|---|
\ezcWebdavResponse |


performCopy(
$source, $destination, int $depth
=
ezcWebdavRequest::DEPTH_INFINITY
)
:
\array(ezcWebdavErrorResponse)
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 {@link ezcWebdavRequest::DEPTH_ZERO}, {@link ezcWebdavRequest::DEPTH_ONE}, {@link ezcWebdavRequest::DEPTH_INFINITY}.
Returns an array with {@link ezcWebdavErrorResponse}s 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.
In case performCopy() was called from a MOVE operation, do a real move operation, because the move() function from ezcWebdavSimpleBackend calls performCopy() and performDelete().
Name | Type | Description |
---|---|---|
$source | ||
$destination | ||
$depth | int |
Type | Description |
---|---|
\array(ezcWebdavErrorResponse) |


performDelete(
$target
)
:
\ezcWebdavErrorResponse
Deletes everything below a path.
Deletes the resource identified by $path recursively. Returns an instance of {@link ezcWebdavErrorResponse} if the deletion failed, and null on success.
In case performDelete() was called from a MOVE operation, it does not delete anything, because the move() function in ezcWebdavSimpleBackend first calls performDelete(), which deletes the destination if the source and destination are the same in URL alias terms.
Name | Type | Description |
---|---|---|
$target |
Type | Description |
---|---|
\ezcWebdavErrorResponse |


propFind(
\ezcWebdavPropFindRequest $request
)
:
\ezcWebdavResponse
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.
The code for coding is taken from eZWebDAVServer::outputCollectionContent().
Name | Type | Description |
---|---|---|
$request | \ezcWebdavPropFindRequest |
Type | Description |
---|---|
\ezcWebdavResponse |


propPatch(
\ezcWebdavPropPatchRequest $request
)
:
\ezcWebdavResponse
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.
Name | Type | Description |
---|---|---|
$request | \ezcWebdavPropPatchRequest |
Type | Description |
---|---|
\ezcWebdavResponse |


put(
\ezcWebdavPutRequest $request
)
:
\ezcWebdavResponse
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.
Name | Type | Description |
---|---|---|
$request | \ezcWebdavPutRequest |
Type | Description |
---|---|
\ezcWebdavResponse |


putContentData(
string $currentSite, string $virtualFolder, string $target, string $tempFile
)
:
bool
Handles data storage on the content tree level.
It will try to find the parent node of the wanted placement and create a new object with data from $tempFile.
Name | Type | Description |
---|---|---|
$currentSite | string | Eg. 'plain_site_user' |
$virtualFolder | string | Eg. 'Content' |
$target | string | Eg. 'Folder1/file1.txt' |
$tempFile | string | The temporary file holding the contents |
Type | Description |
---|---|
bool |
- Todo
- remove/replace eZContentUpload


putVirtualFolderData(
string $currentSite, string $target, string $tempFile
)
:
bool
Handles data storage on the content tree level.
It will check if the target is below a content folder in which it calls putContentData().
Name | Type | Description |
---|---|---|
$currentSite | string | Eg. 'plain_site_user' |
$target | string | Eg. 'Content/Folder1/file1.txt' |
$tempFile | string | The temporary file holding the contents |
Type | Description |
---|---|
bool |


recode(
string $string, string $fromCharset, string $toCharset, bool $stop
=
false
)
:
string
Recodes $string from charset $fromCharset to charset $toCharset.
Method from eZWebDAVServer.
Name | Type | Description |
---|---|---|
$string | string | |
$fromCharset | string | |
$toCharset | string | |
$stop | bool |
Type | Description |
---|---|
string |


removeProperty(
string $path, \ezcWebdavProperty $property
)
:
bool
Manually removes a property from a resource.
Removes the given $property form the resource identified by $path.
Name | Type | Description |
---|---|---|
$path | string | |
$property | \ezcWebdavProperty |
Type | Description |
---|---|
bool |


resetProperties(
string $path, \ezcWebdavPropertyStorage $storage
)
:
bool
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.
Name | Type | Description |
---|---|---|
$path | string | |
$storage | \ezcWebdavPropertyStorage |
Type | Description |
---|---|
bool |


setCurrentSite(
string $site
)
:
void
Sets the current site.
From eZ Publish.
Name | Type | Description |
---|---|---|
$site | string | Eg. 'plain_site_user' |
- Todo
- remove or move in another class?


setProperty(
string $path, \ezcWebdavProperty $property
)
:
bool
Manually sets a property on a resource.
Sets the given $propertyBackup for the resource identified by $path.
Name | Type | Description |
---|---|---|
$path | string | |
$property | \ezcWebdavProperty |
Type | Description |
---|---|
bool |


setResourceContents(
string $path, string $content
)
:
void
Sets the contents of a resource.
This method replaces the content of the resource identified by $path with the submitted $content.
Name | Type | Description |
---|---|---|
$path | string | |
$content | string |


splitFirstPathElement(
string $path, string $element
)
:
string
Takes the first path element from \a $path and removes it from the path, the extracted part will be placed in \a $name.
$path = '/path/to/item/';
$newPath = self::splitFirstPathElement( $path, $root );
print( $root ); // prints 'path', $newPath is now 'to/item/'
$newPath = self::splitFirstPathElement( $newPath, $second );
print( $second ); // prints 'to', $newPath is now 'item/'
$newPath = self::splitFirstPathElement( $newPath, $third );
print( $third ); // prints 'item', $newPath is now ''
Name | Type | Description |
---|---|---|
$path | string | A path of elements delimited by a slash, if the path ends with a slash it will be removed |
$element | string | &$element The name of the first path element without any slashes |
Type | Description |
---|---|
string | The rest of the path without the ending slash |
- Todo
- remove or replace


splitLastPathElement(
string $path, string $element
)
:
string
Takes the last path element from \a $path and removes it from the path, the extracted part will be placed in \a $name.
$path = '/path/to/item/';
$newPath = self::splitLastPathElement( $path, $root );
print( $root ); // prints 'item', $newPath is now '/path/to'
$newPath = self::splitLastPathElement( $newPath, $second );
print( $second ); // prints 'to', $newPath is now '/path'
$newPath = self::splitLastPathElement( $newPath, $third );
print( $third ); // prints 'path', $newPath is now ''
Name | Type | Description |
---|---|---|
$path | string | A path of elements delimited by a slash, if the path ends with a slash it will be removed |
$element | string | &$element The name of the first path element without any slashes |
Type | Description |
---|---|
string | The rest of the path without the ending slash |
- Todo
- remove or replace


storeProperties(
string $path, \ezcWebdavBasicPropertyStorage $storage
)
:
void
Stores properties for a resource.
Creates a new property storage file and stores the properties given for the resource identified by $path. This depends on the affected resource and the actual properties in the property storage.
Name | Type | Description |
---|---|---|
$path | string | |
$storage | \ezcWebdavBasicPropertyStorage |


storeUploadedFile(
string $target, string $contents
)
:
string
Stores $contents to a temporary location under the file name $target.
Name | Type | Description |
---|---|---|
$target | string | |
$contents | string |
Type | Description |
---|---|
string | The name of the temp file or false if it failed. |
- Todo
- remove or replace with eZ Components functionality


tempDirectory(
)
:
string
Returns the path to the WebDAV temporary directory.
If the directory does not exist yet, it will be created first.
Type | Description |
---|---|
string |
- Todo
- remove or replace with eZ Components functionality


virtualContentFolderName(
)
:
string
The name of the content folder in eZ Publish, translated.
Type | Description |
---|---|
string |