summaryrefslogtreecommitdiffstats
path: root/lib/private/files/mount
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-05-22 01:39:24 +0200
committerRobin Appelman <icewind@owncloud.com>2014-06-06 09:55:58 +0200
commit60a659c87e1a3cb2c65dc330cb64c3414fd4b648 (patch)
tree36fc571a0d5d4ad30780f1b86cbdcbdd7555b276 /lib/private/files/mount
parent79b65269c9e1dd1cd01dc2fd28a979105650fc91 (diff)
downloadnextcloud-server-60a659c87e1a3cb2c65dc330cb64c3414fd4b648.tar.gz
nextcloud-server-60a659c87e1a3cb2c65dc330cb64c3414fd4b648.zip
Add a system for (re)movable mount points
Diffstat (limited to 'lib/private/files/mount')
-rw-r--r--lib/private/files/mount/manager.php9
-rw-r--r--lib/private/files/mount/mount.php12
-rw-r--r--lib/private/files/mount/moveablemount.php30
3 files changed, 45 insertions, 6 deletions
diff --git a/lib/private/files/mount/manager.php b/lib/private/files/mount/manager.php
index db1f4600c74..45a9f339fba 100644
--- a/lib/private/files/mount/manager.php
+++ b/lib/private/files/mount/manager.php
@@ -31,6 +31,15 @@ class Manager {
}
/**
+ * @param string $mountPoint
+ * @param string $target
+ */
+ public function moveMount($mountPoint, $target){
+ $this->mounts[$target] = $this->mounts[$mountPoint];
+ unset($this->mounts[$mountPoint]);
+ }
+
+ /**
* Find the mount for $path
*
* @param string $path
diff --git a/lib/private/files/mount/mount.php b/lib/private/files/mount/mount.php
index 7c40853ac95..7561cd7311b 100644
--- a/lib/private/files/mount/mount.php
+++ b/lib/private/files/mount/mount.php
@@ -16,11 +16,11 @@ class Mount {
/**
* @var \OC\Files\Storage\Storage $storage
*/
- private $storage = null;
- private $class;
- private $storageId;
- private $arguments = array();
- private $mountPoint;
+ protected $storage = null;
+ protected $class;
+ protected $storageId;
+ protected $arguments = array();
+ protected $mountPoint;
/**
* @var \OC\Files\Storage\Loader $loader
@@ -142,7 +142,7 @@ class Mount {
} else {
$internalPath = substr($path, strlen($this->mountPoint));
}
- return $internalPath;
+ return (string)$internalPath;
}
/**
diff --git a/lib/private/files/mount/moveablemount.php b/lib/private/files/mount/moveablemount.php
new file mode 100644
index 00000000000..117649339e9
--- /dev/null
+++ b/lib/private/files/mount/moveablemount.php
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Files\Mount;
+
+/**
+ * Defines the mount point to be (re)moved by the user
+ */
+interface MoveableMount {
+ /**
+ * Move the mount point to $target
+ *
+ * @param string $target the target mount point
+ * @return bool
+ */
+ public function moveMount($target);
+
+ /**
+ * Remove the mount points
+ *
+ * @return mixed
+ * @return bool
+ */
+ public function removeMount();
+}