diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-07-07 23:23:04 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-07-07 23:23:04 +0200 |
commit | 5506f9dc813f034bc79f41aac1dea0db412092af (patch) | |
tree | e229eecc491a8906e54b5d3e539744ac69888ecd | |
parent | ec4cb56bd70f9f81bf4f0d4a3f0728c5f62dbf85 (diff) | |
parent | 128c22606397ef8be2f5babd8010032bde1479b0 (diff) | |
download | nextcloud-server-5506f9dc813f034bc79f41aac1dea0db412092af.tar.gz nextcloud-server-5506f9dc813f034bc79f41aac1dea0db412092af.zip |
Merge pull request #9495 from owncloud/remove-moved-mount
When changing the mountpoint of an external storage, ensure the old one ...
-rw-r--r-- | apps/files_external/ajax/addMountPoint.php | 19 | ||||
-rw-r--r-- | apps/files_external/js/settings.js | 9 | ||||
-rw-r--r-- | apps/files_external/templates/settings.php | 1 |
3 files changed, 21 insertions, 8 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))); diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js index 348fecf0648..be6860bab63 100644 --- a/apps/files_external/js/settings.js +++ b/apps/files_external/js/settings.js @@ -14,6 +14,7 @@ function updateStatus(statusEl, result){ OC.MountConfig={ saveStorage:function(tr, callback) { var mountPoint = $(tr).find('.mountPoint input').val(); + var oldMountPoint = $(tr).find('.mountPoint input').data('mountpoint'); if (mountPoint == '') { return false; } @@ -80,9 +81,11 @@ OC.MountConfig={ classOptions: classOptions, mountType: mountType, applicable: applicable, - isPersonal: isPersonal + isPersonal: isPersonal, + oldMountPoint: oldMountPoint }, success: function(result) { + $(tr).find('.mountPoint input').data('mountpoint', mountPoint); status = updateStatus(statusSpan, result); if (callback) { callback(status); @@ -139,9 +142,11 @@ OC.MountConfig={ classOptions: classOptions, mountType: mountType, applicable: applicable, - isPersonal: isPersonal + isPersonal: isPersonal, + oldMountPoint: oldMountPoint }, success: function(result) { + $(tr).find('.mountPoint input').data('mountpoint', mountPoint); status = updateStatus(statusSpan, result); if (callback) { callback(status); diff --git a/apps/files_external/templates/settings.php b/apps/files_external/templates/settings.php index 98fcf4a0ed4..dcf3938b894 100644 --- a/apps/files_external/templates/settings.php +++ b/apps/files_external/templates/settings.php @@ -24,6 +24,7 @@ </td> <td class="mountPoint"><input type="text" name="mountPoint" value="<?php p(isset($mount['mountpoint']) ? $mount['mountpoint'] : ''); ?>" + data-mountpoint="<?php p(isset($mount['mountpoint']) ? $mount['mountpoint'] : ''); ?>" placeholder="<?php p($l->t('Folder name')); ?>" /></td> <?php if (!isset($mount['mountpoint'])): ?> <td class="backend"> |