aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-04-17 13:31:22 +0200
committerRobin Appelman <icewind@owncloud.com>2015-04-27 14:07:16 +0200
commit526ea3fcba56502b9a3a5204221a0aa7e4fa538a (patch)
tree71cfb9ec2f63af925f1fa6798255a0e5da4edc3c /apps
parent77fbb4125b95d6fb9c8572bffa007bcf77e16dfa (diff)
downloadnextcloud-server-526ea3fcba56502b9a3a5204221a0aa7e4fa538a.tar.gz
nextcloud-server-526ea3fcba56502b9a3a5204221a0aa7e4fa538a.zip
add rename hook for propagation
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/lib/propagation/changewatcher.php15
-rw-r--r--apps/files_sharing/lib/propagation/propagationmanager.php1
2 files changed, 16 insertions, 0 deletions
diff --git a/apps/files_sharing/lib/propagation/changewatcher.php b/apps/files_sharing/lib/propagation/changewatcher.php
index fa5208b498b..e5ca62c6d8c 100644
--- a/apps/files_sharing/lib/propagation/changewatcher.php
+++ b/apps/files_sharing/lib/propagation/changewatcher.php
@@ -37,6 +37,21 @@ class ChangeWatcher {
}
}
+ public function renameHook($params) {
+ $path1 = $params['oldpath'];
+ $path2 = $params['newpath'];
+ $fullPath1 = $this->baseView->getAbsolutePath($path1);
+ $fullPath2 = $this->baseView->getAbsolutePath($path2);
+ $mount1 = $this->baseView->getMount($path1);
+ $mount2 = $this->baseView->getMount($path2);
+ if ($mount1 instanceof SharedMount) {
+ $this->propagateForOwner($mount1->getShare(), $mount1->getInternalPath($fullPath1), $mount1->getOwnerPropagator());
+ }
+ if ($mount1 !== $mount2 and $mount2 instanceof SharedMount) {
+ $this->propagateForOwner($mount2->getShare(), $mount2->getInternalPath($fullPath2), $mount2->getOwnerPropagator());
+ }
+ }
+
/**
* @param array $share
* @param string $internalPath
diff --git a/apps/files_sharing/lib/propagation/propagationmanager.php b/apps/files_sharing/lib/propagation/propagationmanager.php
index bf530d369b2..14763a4df7a 100644
--- a/apps/files_sharing/lib/propagation/propagationmanager.php
+++ b/apps/files_sharing/lib/propagation/propagationmanager.php
@@ -109,5 +109,6 @@ class PropagationManager {
$this->listenToOwnerChanges($user->getUID(), $user->getUID());
\OC_Hook::connect('OC_Filesystem', 'write', $watcher, 'writeHook');
\OC_Hook::connect('OC_Filesystem', 'delete', $watcher, 'writeHook');
+ \OC_Hook::connect('OC_Filesystem', 'rename', $watcher, 'renameHook');
}
}