From d326e7a75c58e49d84d286f89a97573dbc3e870b Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 6 Dec 2017 16:07:40 -0800 Subject: hubzilla issue #680, implement IMoveTarget and recursive file/directory move/rename --- Zotlabs/Storage/Directory.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Storage/Directory.php') diff --git a/Zotlabs/Storage/Directory.php b/Zotlabs/Storage/Directory.php index 45df9ddd5..63ff4341c 100644 --- a/Zotlabs/Storage/Directory.php +++ b/Zotlabs/Storage/Directory.php @@ -16,7 +16,7 @@ use Sabre\DAV; * @link http://github.com/friendica/red * @license http://opensource.org/licenses/mit-license.php The MIT License (MIT) */ -class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota { +class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMoveTarget { /** * @brief The path inside /cloud @@ -457,6 +457,22 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota { return false; } + + public function moveInto($targetName,$sourcePath, DAV\INode $sourceNode) { + + if(! $this->auth->owner_id) { + return false; + } + + if(! ($sourceNode->data && $sourceNode->data->hash)) { + return false; + } + + return attach_move($this->auth->owner_id, $sourceNode->data->hash, $this->folder_hash); + + } + + /** * @todo add description of what this function does. * -- cgit v1.2.3