kernel/private/classes/webdav/ezwebdavcontentbackend.php

Show: inherited
Table of Contents

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

Package: Default

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

Parent(s)
\ezcWebdavSimpleBackend\ezcWebdavLockBackend

Constants

Constant  VIRTUAL_CONTENT_FOLDER_NAME = 'Content'

The name of the content folder in eZ Publish.

Constant  VIRTUAL_MEDIA_FOLDER_NAME = 'Media'

The name of the media folder in eZ Publish.

Constant  WEBDAV_INI_FILE = "webdav.ini"

The ini file which holds settings for WebDAV.

Constant  DIRECTORY_MIMETYPE = 'httpd/unix-directory'

Mimetype for directories.

Constant  DEFAULT_MIMETYPE = "application/octet-stream"

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

Constant  DEFAULT_SIZE = 0

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

Properties

Propertyprotected\array(string)  $FolderClasses= 'null'

Contains an array with classes that are considered folder.

Default valuenullDetails
Type
\array(string)
Propertyprotected\array(string)  $availableSites= 'array()'

The list of available sites.

Default valuearray()Details
Type
\array(string)
Propertyprotected\array(string=>array())  $cachedNodes= 'array()'

Holds the retrieved nodes to allow for faster retrieval on subsequent requests.

Default valuearray()Details
Type
\array(string=>array())
Propertyprotected\array(string=>array())  $cachedProperties= 'array()'

Holds the retrieved properties to allow for faster retrieval on subsequent requests.

Default valuearray()Details
Type
\array(string=>array())
Propertyprotected\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.

Default valuearray( 'getcontentlength', 'getlastmodified', 'creationdate', 'displayname', 'getetag', 'getcontenttype', 'resourcetype', 'supportedlock', 'lockdiscovery', )Details
Type
\array(string)
Propertyprotectedbool  $useLogging= ''
static

Specifies weather to log with appendLogEntry().

Value defined in webdav.ini, read in appendLogEntry().

Details
Type
bool

Methods

methodpublic__construct( ) : void

Creates a new backend instance.

methodprotectedacquireLock( 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.

Parameters
Name Type Description
$readOnly bool
methodpublicappendLogEntry( string $logString, string $label = false ) : void
static

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

From eZ Publish.

Parameters
Name Type Description
$logString string

String to record

$label string

Label to put in front of $logString

methodpubliccheckDeleteRecursive(  $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.

Parameters
Name Type Description
$target
Returns
Type Description
array
methodpubliccopy( \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.

Parameters
Name Type Description
$request \ezcWebdavCopyRequest
Returns
Type Description
\ezcWebdavResponse
methodprotectedcopyContent( string $sourceSite, string $destinationSite, string $sourceVFolder, string $destinationVFolder, string $source, string $destination ) : bool

Copies the node specified by the path $source to $destination.

Parameters
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'

Returns
Type Description
bool
methodprotectedcopyObject( \eZContentObject $object, \eZContentObject $newParentNode ) : bool

Copies the specified object as a child to the node $newParentNode.

Parameters
Name Type Description
$object \eZContentObject
$newParentNode \eZContentObject
Returns
Type Description
bool
methodprotectedcopyObjectSameDirectory( \eZContentObject $object, \eZContentObject $newParentNode, string $destinationName = null ) : bool

Copies the specified object to the same folder, with optional $destinationName.

Parameters
Name Type Description
$object \eZContentObject
$newParentNode \eZContentObject
$destinationName string
Returns
Type Description
bool
methodpubliccopyRecursive( 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.

Parameters
Name Type Description
$source string
$destination string
$depth int
Returns
Type Description
array
methodprotectedcopyVirtualFolder( 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().

Parameters
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'

Returns
Type Description
bool
methodprotectedcreateCollection( string $target ) : bool

Creates a new collection (folder) at the given path $target.

Parameters
Name Type Description
$target string

Eg. '/plain_site_user/Content/Folder1'

Returns
Type Description
bool
methodprotectedcreateFolder( \eZContentObject $parentNode, string $target ) : bool

Creates a new folder under the given $target path.

Parameters
Name Type Description
$parentNode \eZContentObject
$target string

Eg. 'Folder1'

Returns
Type Description
bool
methodprotectedcreateResource( 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.

Parameters
Name Type Description
$path string
$content string
methodpubliccurrentSiteFromPath( string $path ) : string

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

From eZ Publish.

Parameters
Name Type Description
$path string

Eg. '/plain_site_user/Content/Folder1/file1.txt'

Returns
Type Description
string The name of the site that was detected (eg. 'plain_site_user') or false if not site could be detected
Details
Todo
remove or move in another class?  
methodpublicdelete( \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.

Parameters
Name Type Description
$request \ezcWebdavDeleteRequest
Returns
Type Description
\ezcWebdavResponse
methodprotecteddeleteContent( 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.

Parameters
Name Type Description
$currentSite string

Eg. 'plain_site_user'

$virtualFolder string

Eg. 'Content'

$target string

Eg. 'Folder1/file1.txt'

Returns
Type Description
bool
methodprotecteddeleteVirtualFolder( 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().

Parameters
Name Type Description
$currentSite string

Eg. 'plain_site_user'

$target string

Eg. 'Content/Folder1/file1.txt'

Returns
Type Description
bool
methodprotectedencodeResponse( \ezcWebdavResponse $response ) : \ezcWebdavResponse

Encodes the path stored in $response in order to be displayed properly in WebDAV clients.

Code from eZWebDAVServer::outputCollectionContent.

Parameters
Name Type Description
$response \ezcWebdavResponse
Returns
Type Description
\ezcWebdavResponse
methodprotectedfetchContainerNodeInfo( 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')
Parameters
Name Type Description
$fullPath string

Eg. '/plain_site_user/Content/Folder1'

$site string

Eg. 'plain_site_user'

$nodeName string

Eg. 'Folder1'

Returns
Type Description
\array(array(string=>mixed))
methodprotectedfetchContentList( 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/')
Parameters
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

Returns
Type Description
\array(array(string=>mixed))
methodprotectedfetchNodeByTranslation( string $nodePathString ) : \eZContentObject

Attempts to fetch a possible node by translating the provided string/path to a node-number.

Parameters
Name Type Description
$nodePathString string

Eg. 'Folder1/file1.txt'

Returns
Type Description
\eZContentObject Eg. the node of 'Folder1/file1.txt'
methodprotectedfetchNodeInfo( 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')
Parameters
Name Type Description
$target string

Eg. '/plain_site_user/Content/Folder1/file1.jpg

$node \eZContentObject

&$node The node corresponding to $target

Returns
Type Description
\array(string=>mixed)
Details
Todo
remove/replace .ini calls, eZContentUpload, eZMimeType, eZSys RequestURI  
Todo
handle articles as files  
methodprotectedfetchParentNodeByTranslation( 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.

Parameters
Name Type Description
$nodePathString string

Eg. 'Folder1/file1.txt'

Returns
Type Description
\eZContentObject Eg. the node of 'Folder1'
methodprotectedfetchSiteListContent( 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/')
Parameters
Name Type Description
$target string

Eg. '/'

$depth string

One of -1 (infinite), 0, 1

$properties \array(string)

Currently not used

Returns
Type Description
\array(array(string=>mixed))
methodprotectedfetchVirtualSiteContent( 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')
Parameters
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

Returns
Type Description
\array(array(string=>mixed))
methodprotectedfileBasename( string $name ) : string

Returns $name without the final suffix (.jpg, .gif etc.).

Parameters
Name Type Description
$name string
Returns
Type Description
string
Details
Todo
remove or replace  
methodprotectedfreeLock( ) : void

Free lock.

Frees the lock after the operation has been finished.

methodpublicget( \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.

Parameters
Name Type Description
$request \ezcWebdavGetRequest
Returns
Type Description
\ezcWebdavResponse
methodpublicgetAllProperties( string $path ) : \ezcWebdavPropertyStorage

Returns all properties for a resource.

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

Parameters
Name Type Description
$path string
Returns
Type Description
\ezcWebdavPropertyStorage
methodprotectedgetCollectionContent( 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.

Parameters
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

Returns
Type Description
\array(string=>array())
methodprotectedgetCollectionMembers( 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.

Parameters
Name Type Description
$path string
$depth int

Added by @as

Returns
Type Description
\array(ezcWebdavResource | \ezcWebdavCollection)
methodprotectedgetContentNodeData( \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 );
Parameters
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'

Returns
Type Description
\array(string=>mixed) Or false if an error appeared
Details
Todo
remove/replace eZContentUpload  
methodprotectedgetContentTreeCollection(  $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/')
Parameters
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

Returns
Type Description
\array(array(string=>mixed))
methodprotectedgetNodeInfo(  $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 )
Parameters
Name Type Description
$requestUri
$source
Returns
Type Description
\array(string=>boolean)
methodprotectedgetNodes(  $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.

Parameters
Name Type Description
$requestUri
$depth int
Returns
Type Description
\array(ezcWebdavResource | \ezcWebdavCollection)
methodpublicgetProperty( 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.

Parameters
Name Type Description
$path string
$propertyName string
$namespace string
Returns
Type Description
\ezcWebdavProperty
methodprotectedgetPropertyStorage( string $path ) : \ezcWebdavBasicPropertyStorage

Returns the property storage for a resource.

Returns the {@link ezcWebdavPropertyStorage} instance containing the properties for the resource identified by $path.

Parameters
Name Type Description
$path string
Returns
Type Description
\ezcWebdavBasicPropertyStorage
methodprotectedgetResourceContents( string $target ) : string

Returns the contents of a resource.

This method returns the content of the resource identified by $path as a string.

Parameters
Name Type Description
$target string
Returns
Type Description
string
methodprotectedgetVirtualFolderCollection(  $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')
Parameters
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

Returns
Type Description
\array(array(string=>mixed))
methodprotectedgetVirtualFolderData( \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 );
Parameters
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'

Returns
Type Description
\array(string=>mixed) Or false if an error appeared
methodpublichead( \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.

Parameters
Name Type Description
$request \ezcWebdavHeadRequest
Returns
Type Description
\ezcWebdavResponse
methodprotectedinternalNodePath( string $virtualFolder, string $collection ) : string

Returns a path that corresponds to the internal path of nodes.

Parameters
Name Type Description
$virtualFolder string
$collection string
Returns
Type Description
string
Details
Todo
remove or replace  
methodprotectedisCollection( 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).

Parameters
Name Type Description
$path string
Returns
Type Description
bool
methodprotectedisObjectFolder( resource $object, resource $class ) : void

Returns whether $class is an folder class.

Parameters
Name Type Description
$object resource
$class resource
methodpubliclock( 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.

Parameters
Name Type Description
$waitTime int
$timeout int
methodpublicmakeCollection( \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.

Parameters
Name Type Description
$request \ezcWebdavMakeCollectionRequest
Returns
Type Description
\ezcWebdavResponse
methodprotectedmkcolContent( 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.

Parameters
Name Type Description
$currentSite string

Eg. 'plain_site_user'

$virtualFolder string

Eg. 'Content'

$target string

Eg. 'Folder1'

Returns
Type Description
bool
methodprotectedmkcolVirtualFolder( 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().

Parameters
Name Type Description
$currentSite string

Eg. 'plain_site_user'

$target string

Eg. 'Content/Folder1'

Returns
Type Description
bool
methodpublicmove( \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.

Parameters
Name Type Description
$request \ezcWebdavMoveRequest
Returns
Type Description
\ezcWebdavResponse
methodprotectedmoveContent( 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.

Parameters
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
Returns
Type Description
bool
methodpublicmoveRecursive( 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.

Parameters
Name Type Description
$source string
$destination string
$depth int
Returns
Type Description
array
methodprotectedmoveVirtualFolder( 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().

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

Returns if a resource exists.

Returns if a the resource identified by $path exists.

Parameters
Name Type Description
$path string
Returns
Type Description
bool
methodpublicoptions( \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.

Parameters
Name Type Description
$request \ezcWebdavOptionsRequest
Returns
Type Description
\ezcWebdavResponse
methodprotectedperformCopy(  $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().

Parameters
Name Type Description
$source
$destination
$depth int
Returns
Type Description
\array(ezcWebdavErrorResponse)
methodprotectedperformDelete(  $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.

Parameters
Name Type Description
$target
Returns
Type Description
\ezcWebdavErrorResponse
methodpublicpropFind( \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().

Parameters
Name Type Description
$request \ezcWebdavPropFindRequest
Returns
Type Description
\ezcWebdavResponse
methodpublicpropPatch( \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.

Parameters
Name Type Description
$request \ezcWebdavPropPatchRequest
Returns
Type Description
\ezcWebdavResponse
methodpublicput( \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.

Parameters
Name Type Description
$request \ezcWebdavPutRequest
Returns
Type Description
\ezcWebdavResponse
methodprotectedputContentData( 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.

Parameters
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

Returns
Type Description
bool
Details
Todo
remove/replace eZContentUpload  
methodprotectedputVirtualFolderData( 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().

Parameters
Name Type Description
$currentSite string

Eg. 'plain_site_user'

$target string

Eg. 'Content/Folder1/file1.txt'

$tempFile string

The temporary file holding the contents

Returns
Type Description
bool
methodprotectedrecode( string $string, string $fromCharset, string $toCharset, bool $stop = false ) : string
static

Recodes $string from charset $fromCharset to charset $toCharset.

Method from eZWebDAVServer.

Parameters
Name Type Description
$string string
$fromCharset string
$toCharset string
$stop bool
Returns
Type Description
string
methodpublicremoveProperty( string $path, \ezcWebdavProperty $property ) : bool

Manually removes a property from a resource.

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

Parameters
Name Type Description
$path string
$property \ezcWebdavProperty
Returns
Type Description
bool
methodpublicresetProperties( 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.

Parameters
Name Type Description
$path string
$storage \ezcWebdavPropertyStorage
Returns
Type Description
bool
methodpublicsetCurrentSite( string $site ) : void

Sets the current site.

From eZ Publish.

Parameters
Name Type Description
$site string

Eg. 'plain_site_user'

Details
Todo
remove or move in another class?  
methodpublicsetProperty( string $path, \ezcWebdavProperty $property ) : bool

Manually sets a property on a resource.

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

Parameters
Name Type Description
$path string
$property \ezcWebdavProperty
Returns
Type Description
bool
methodprotectedsetResourceContents( 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.

Parameters
Name Type Description
$path string
$content string
methodprotectedsplitFirstPathElement( 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 ''
Parameters
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

Returns
Type Description
string The rest of the path without the ending slash
Details
Todo
remove or replace  
methodprotectedsplitLastPathElement( 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 ''
Parameters
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

Returns
Type Description
string The rest of the path without the ending slash
Details
Todo
remove or replace  
methodprotectedstoreProperties( 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.

Parameters
Name Type Description
$path string
$storage \ezcWebdavBasicPropertyStorage
methodprotectedstoreUploadedFile( string $target, string $contents ) : string

Stores $contents to a temporary location under the file name $target.

Parameters
Name Type Description
$target string
$contents string
Returns
Type Description
string The name of the temp file or false if it failed.
Details
Todo
remove or replace with eZ Components functionality  
methodprotectedtempDirectory( ) : string
static

Returns the path to the WebDAV temporary directory.

If the directory does not exist yet, it will be created first.

Returns
Type Description
string
Details
Todo
remove or replace with eZ Components functionality  
methodpublicunlock( ) : void

Removes the lock.

methodpublicvirtualContentFolderName( ) : string
static

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

Returns
Type Description
string
methodpublicvirtualMediaFolderName( ) : string
static

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

Returns
Type Description
string
Documentation was generated by DocBlox 0.18.1.