summaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib/personalmount.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-05-22 01:40:42 +0200
committerRobin Appelman <icewind@owncloud.com>2014-06-06 09:55:59 +0200
commitcabe2873c47004798eadd39d9f1ad811e7227137 (patch)
tree8544acc6421569a9660f8dbdff7f0862938f7b1b /apps/files_external/lib/personalmount.php
parent8abe1c3f1a5f5da36ab6ac8d1c39b966991387ce (diff)
downloadnextcloud-server-cabe2873c47004798eadd39d9f1ad811e7227137.tar.gz
nextcloud-server-cabe2873c47004798eadd39d9f1ad811e7227137.zip
Make personal external mount points (re)movable from the files app
Diffstat (limited to 'apps/files_external/lib/personalmount.php')
-rw-r--r--apps/files_external/lib/personalmount.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/apps/files_external/lib/personalmount.php b/apps/files_external/lib/personalmount.php
new file mode 100644
index 00000000000..c3e97092520
--- /dev/null
+++ b/apps/files_external/lib/personalmount.php
@@ -0,0 +1,38 @@
+<?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 OCA\Files_External;
+
+use OC\Files\Mount\Mount;
+use OC\Files\Mount\MoveableMount;
+
+/**
+ * Person mount points can be moved by the user
+ */
+class PersonalMount extends Mount implements MoveableMount {
+ /**
+ * Move the mount point to $target
+ *
+ * @param string $target the target mount point
+ * @return bool
+ */
+ public function moveMount($target) {
+ $result = \OC_Mount_Config::movePersonalMountPoint($this->getMountPoint(), $target, \OC_Mount_Config::MOUNT_TYPE_USER);
+ $this->setMountPoint($target);
+ return $result;
+ }
+
+ /**
+ * Remove the mount points
+ *
+ * @return bool
+ */
+ public function removeMount() {
+ return \OC_Mount_Config::removeMountPoint($this->mountPoint, \OC_Mount_Config::MOUNT_TYPE_USER, \OCP\User::getUser(), true);
+ }
+}