aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external/ajax
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-07-07 15:40:01 +0200
committerRobin Appelman <icewind@owncloud.com>2014-07-07 15:40:01 +0200
commit128c22606397ef8be2f5babd8010032bde1479b0 (patch)
treeb0925c3c14249cefb21795f960a141ca7d14f583 /apps/files_external/ajax
parentb271e05bc9066157a7af62062ad2d47e73dd54b7 (diff)
downloadnextcloud-server-128c22606397ef8be2f5babd8010032bde1479b0.tar.gz
nextcloud-server-128c22606397ef8be2f5babd8010032bde1479b0.zip
When changing the mountpoint of an external storage, ensure the old one is removed
Diffstat (limited to 'apps/files_external/ajax')
-rw-r--r--apps/files_external/ajax/addMountPoint.php19
1 files changed, 13 insertions, 6 deletions
diff --git a/apps/files_external/ajax/addMountPoint.php b/apps/files_external/ajax/addMountPoint.php
index 9100d47db3a..4903120c2a8 100644
--- a/apps/files_external/ajax/addMountPoint.php
+++ b/apps/files_external/ajax/addMountPoint.php
@@ -10,10 +10,17 @@ if ($_POST['isPersonal'] == 'true') {
OCP\JSON::checkAdminUser();
$isPersonal = false;
}
-$status = OC_Mount_Config::addMountPoint($_POST['mountPoint'],
- $_POST['class'],
- $_POST['classOptions'],
- $_POST['mountType'],
- $_POST['applicable'],
- $isPersonal);
+
+$mountPoint = $_POST['mountPoint'];
+$oldMountPoint = $_POST['oldMountPoint'];
+$class = $_POST['class'];
+$options = $_POST['classOptions'];
+$type = $_POST['mountType'];
+$applicable = $_POST['applicable'];
+
+if ($oldMountPoint and $oldMountPoint !== $mountPoint) {
+ OC_Mount_Config::removeMountPoint($oldMountPoint, $type, $applicable, $isPersonal);
+}
+
+$status = OC_Mount_Config::addMountPoint($mountPoint, $class, $options, $type, $applicable, $isPersonal);
OCP\JSON::success(array('data' => array('message' => $status)));