aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-02-28 12:04:46 +0000
committerMario <mario@mariovavti.com>2024-02-28 12:04:46 +0000
commitfc5b5ba021e23d2cc1b7556a77f176309e46edb9 (patch)
treed55fd3314455bdf6b896d2c7cf82c9569b8d7193
parent056c55a9632521b1dba9a01c943f44db21689109 (diff)
downloadvolse-hubzilla-fc5b5ba021e23d2cc1b7556a77f176309e46edb9.tar.gz
volse-hubzilla-fc5b5ba021e23d2cc1b7556a77f176309e46edb9.tar.bz2
volse-hubzilla-fc5b5ba021e23d2cc1b7556a77f176309e46edb9.zip
if we rename a folder in dav we should also move its content
-rw-r--r--Zotlabs/Storage/Directory.php18
1 files changed, 16 insertions, 2 deletions
diff --git a/Zotlabs/Storage/Directory.php b/Zotlabs/Storage/Directory.php
index 683887b31..333251f69 100644
--- a/Zotlabs/Storage/Directory.php
+++ b/Zotlabs/Storage/Directory.php
@@ -173,7 +173,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMo
intval($this->auth->owner_id)
);
- $x = attach_syspaths($this->auth->owner_id,$this->folder_hash);
+ $x = attach_syspaths($this->auth->owner_id, $this->folder_hash);
$y = q("update attach set display_path = '%s' where hash = '%s' and uid = %d",
dbesc($x['path']),
@@ -181,6 +181,20 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMo
intval($this->auth->owner_id)
);
+ $z = q("select hash from attach where folder = '%s' and uid = %d",
+ dbesc($this->folder_hash),
+ intval($this->auth->owner_id)
+ );
+
+ if($z) {
+ foreach ($z as $zz) {
+ $rs = attach_move($this->auth->owner_id, $zz['hash'], $this->folder_hash, '', false);
+ if(!$rs['success']) {
+ break;
+ }
+ }
+ }
+
$ch = channelx_by_n($this->auth->owner_id);
if ($ch) {
$sync = attach_export_data($ch, $this->folder_hash);
@@ -481,7 +495,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMo
}
- public function moveInto($targetName,$sourcePath, DAV\INode $sourceNode) {
+ public function moveInto($targetName, $sourcePath, DAV\INode $sourceNode) {
$channel_id = $this->auth->owner_id;
// Files have $sourceNode->data['hash'] set. For directories rely on $sourceNode->folder_hash.