[Pkg-owncloud-commits] [owncloud] 97/215: add rename hook for propagation

David Prévot taffit at moszumanska.debian.org
Tue May 5 01:01:28 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch stable8
in repository owncloud.

commit 526ea3fcba56502b9a3a5204221a0aa7e4fa538a
Author: Robin Appelman <icewind at owncloud.com>
Date:   Fri Apr 17 13:31:22 2015 +0200

    add rename hook for propagation
---
 apps/files_sharing/lib/propagation/changewatcher.php      | 15 +++++++++++++++
 apps/files_sharing/lib/propagation/propagationmanager.php |  1 +
 2 files changed, 16 insertions(+)

diff --git a/apps/files_sharing/lib/propagation/changewatcher.php b/apps/files_sharing/lib/propagation/changewatcher.php
index fa5208b..e5ca62c 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 bf530d3..14763a4 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');
 	}
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list