kernel/private/classes/webdav/ezwebdavcontentbackend.php
public function moveRecursive( $source, $destination, $depth = ezcWebdavRequest::DEPTH_INFINITY )
    {
        $errors = array();
        $fullSource = $source;
        $fullDestination = $destination;
        $source = $this->splitFirstPathElement( $source, $sourceSite );
        $destination = $this->splitFirstPathElement( $destination, $destinationSite );

        if ( $sourceSite !== $destinationSite )
        {
            // We do not support copying from one site to another yet
            // TODO: Check if the sites are using the same db,
            //       if so allow the copy as a simple object copy
            //       If not we will have to do an object export from
            //       $sourceSite and import it in $destinationSite
            return array(); // @as self::FAILED_FORBIDDEN;
        }

        if ( !$sourceSite or
             !$destinationSite )
        {
            // Cannot copy entries in site list
            return array( $fullSource ); // @as self::FAILED_FORBIDDEN;
        }

        $this->moveVirtualFolder( $sourceSite, $destinationSite,
                                  $source, $destination,
                                  $fullSource, $fullDestination );

        if ( $depth === ezcWebdavRequest::DEPTH_ZERO || !$this->isCollection( $fullSource ) )
        {
            // Do not recurse (any more)
            return array();
        }

        // Recurse
        $nodes = $this->getCollectionMembers( $fullSource );
        foreach ( $nodes as $node )
        {
            if ( $node->path === $fullSource . '/' )
            {
                // skip the current node which was copied with copyVirtualFolder() above
                continue;
            }

            $newDepth = ( $depth !== ezcWebdavRequest::DEPTH_ONE ) ? $depth : ezcWebdavRequest::DEPTH_ZERO;
            $errors = array_merge(
                $errors,
                $this->moveRecursive( $node->path,
                                      $fullDestination . '/' . $this->getProperty( $node->path, 'displayname' )->displayName,
                                      $newDepth ) );
        }

        return $errors;
    }
public function moveRecursive( $source, $destination, $depth = ezcWebdavRequest::DEPTH_INFINITY )
    {
        $errors = array();
        $fullSource = $source;
        $fullDestination = $destination;
        $source = $this->splitFirstPathElement( $source, $sourceSite );
        $destination = $this->splitFirstPathElement( $destination, $destinationSite );

        if ( $sourceSite !== $destinationSite )
        {
            // We do not support copying from one site to another yet
            // TODO: Check if the sites are using the same db,
            //       if so allow the copy as a simple object copy
            //       If not we will have to do an object export from
            //       $sourceSite and import it in $destinationSite
            return array(); // @as self::FAILED_FORBIDDEN;
        }

        if ( !$sourceSite or
             !$destinationSite )
        {
            // Cannot copy entries in site list
            return array( $fullSource ); // @as self::FAILED_FORBIDDEN;
        }

        $this->moveVirtualFolder( $sourceSite, $destinationSite,
                                  $source, $destination,
                                  $fullSource, $fullDestination );

        if ( $depth === ezcWebdavRequest::DEPTH_ZERO || !$this->isCollection( $fullSource ) )
        {
            // Do not recurse (any more)
            return array();
        }

        // Recurse
        $nodes = $this->getCollectionMembers( $fullSource );
        foreach ( $nodes as $node )
        {
            if ( $node->path === $fullSource . '/' )
            {
                // skip the current node which was copied with copyVirtualFolder() above
                continue;
            }

            $newDepth = ( $depth !== ezcWebdavRequest::DEPTH_ONE ) ? $depth : ezcWebdavRequest::DEPTH_ZERO;
            $errors = array_merge(
                $errors,
                $this->moveRecursive( $node->path,
                                      $fullDestination . '/' . $this->getProperty( $node->path, 'displayname' )->displayName,
                                      $newDepth ) );
        }

        return $errors;
    }
public function moveRecursive ( $ source , $ destination , $ depth = ezcWebdavRequest :: DEPTH_INFINITY ) { $ errors = array ( ) ; $ fullSource = $ source ; $ fullDestination = $ destination ; $ source = $ this -> splitFirstPathElement ( $ source , $ sourceSite ) ; $ destination = $ this -> splitFirstPathElement ( $ destination , $ destinationSite ) ; if ( $ sourceSite !== $ destinationSite ) { // We do not support copying from one site to another yet // TODO: Check if the sites are using the same db, //       if so allow the copy as a simple object copy //       If not we will have to do an object export from //       $sourceSite and import it in $destinationSite return array ( ) ; // @as self::FAILED_FORBIDDEN; } if ( ! $ sourceSite or ! $ destinationSite ) { // Cannot copy entries in site list return array ( $ fullSource ) ; // @as self::FAILED_FORBIDDEN; } $ this -> moveVirtualFolder ( $ sourceSite , $ destinationSite , $ source , $ destination , $ fullSource , $ fullDestination ) ; if ( $ depth === ezcWebdavRequest :: DEPTH_ZERO || ! $ this -> isCollection ( $ fullSource ) ) { // Do not recurse (any more) return array ( ) ; } // Recurse $ nodes = $ this -> getCollectionMembers ( $ fullSource ) ; foreach ( $ nodes as $ node ) { if ( $ node -> path === $ fullSource . '/' ) { // skip the current node which was copied with copyVirtualFolder() above continue ; } $ newDepth = ( $ depth !== ezcWebdavRequest :: DEPTH_ONE ) ? $ depth : ezcWebdavRequest :: DEPTH_ZERO ; $ errors = array_merge ( $ errors , $ this -> moveRecursive ( $ node -> path , $ fullDestination . '/' . $ this -> getProperty ( $ node -> path , 'displayname' ) -> displayName , $ newDepth ) ) ; } return $ errors ; }
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.

@param string $source
@param string $destination
@param int $depth
@return array
Recursively move a file or directory .