[Pkg-owncloud-commits] [owncloud] 165/223: Also support removeable mounts with rmdir

David Prévot taffit at moszumanska.debian.org
Sun Jun 22 01:54:20 UTC 2014


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

taffit pushed a commit to branch master
in repository owncloud.

commit b188550c2218d9feb28c93355accaa9b16bb3000
Author: Robin Appelman <icewind at owncloud.com>
Date:   Mon Jun 16 16:24:42 2014 +0200

    Also support removeable mounts with rmdir
---
 lib/private/files/view.php | 47 +++++++++++++++++++++++++++-------------------
 1 file changed, 28 insertions(+), 19 deletions(-)

diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index b168d17..91d7ea2 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -161,7 +161,34 @@ class View {
 		return $this->basicOperation('mkdir', $path, array('create', 'write'));
 	}
 
+	protected function removeMount($mount, $path){
+		if ($mount instanceof MoveableMount) {
+			\OC_Hook::emit(
+				Filesystem::CLASSNAME, "umount",
+				array(Filesystem::signal_param_path => $path)
+			);
+			$result = $mount->removeMount();
+			if ($result) {
+				\OC_Hook::emit(
+					Filesystem::CLASSNAME, "post_umount",
+					array(Filesystem::signal_param_path => $path)
+				);
+			}
+			return $result;
+		} else {
+			// do not allow deleting the storage's root / the mount point
+			// because for some storages it might delete the whole contents
+			// but isn't supposed to work that way
+			return false;
+		}
+	}
+
 	public function rmdir($path) {
+		$absolutePath= $this->getAbsolutePath($path);
+		$mount = Filesystem::getMountManager()->find($absolutePath);
+		if ($mount->getInternalPath($absolutePath) === '') {
+			return $this->removeMount($mount, $path);
+		}
 		if ($this->is_dir($path)) {
 			return $this->basicOperation('rmdir', $path, array('delete'));
 		} else {
@@ -360,25 +387,7 @@ class View {
 		$absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path));
 		$mount = Filesystem::getMountManager()->find($absolutePath . $postFix);
 		if ($mount->getInternalPath($absolutePath) === '') {
-			if ($mount instanceof MoveableMount) {
-				\OC_Hook::emit(
-						Filesystem::CLASSNAME, "umount",
-						array(Filesystem::signal_param_path => $path)
-						);
-				$result = $mount->removeMount();
-				if ($result) {
-					\OC_Hook::emit(
-							Filesystem::CLASSNAME, "post_umount",
-							array(Filesystem::signal_param_path => $path)
-							);
-				}
-				return $result;
-			} else {
-				// do not allow deleting the storage's root / the mount point
-				// because for some storages it might delete the whole contents
-				// but isn't supposed to work that way
-				return false;
-			}
+			return $this->removeMount($mount, $path);
 		}
 		return $this->basicOperation('unlink', $path, array('delete'));
 	}

-- 
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