/** * Copy the resource and all its children * * @param DAV_Collection $resource * @param string $destination * @param string $dr destinationRoot */ private function copy_recursively($resource, $destination, $dr = null) { if (!$dr) { $dr = $destination; } elseif ($dr === $resource->path) { return; } $resource->method_COPY($destination); if (!$resource instanceof DAV_Collection || DAV::DEPTH_INF !== $this->depth()) { return; } foreach ($resource as $member) { $memberResource = DAV::$REGISTRY->resource($resource->path . $member); try { $this->copy_recursively($memberResource, $destination . $member, $dr); } catch (DAV_Status $e) { DAV_Multistatus::inst()->addStatus($resource->path . $member, $e); } } }