summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJuan Pablo Villafañez <jvillafanez@solidgear.es>2016-06-21 15:04:08 +0200
committerThomas Müller <DeepDiver1975@users.noreply.github.com>2016-06-21 15:04:08 +0200
commitbf7a08f62dafd24932b93ffd213f4e40f151ced0 (patch)
tree7f5525a4c9eb1e9fe8d073873ad51f11535da1a4 /apps
parent826654bb70c78bd577e71e0d75b5f2ecef6769ff (diff)
downloadnextcloud-server-bf7a08f62dafd24932b93ffd213f4e40f151ced0.tar.gz
nextcloud-server-bf7a08f62dafd24932b93ffd213f4e40f151ced0.zip
dd support to know where the storage test comes from (#25166)
Diffstat (limited to 'apps')
-rw-r--r--apps/files_external/controller/globalstoragescontroller.php6
-rw-r--r--apps/files_external/controller/storagescontroller.php11
-rw-r--r--apps/files_external/controller/userglobalstoragescontroller.php11
-rw-r--r--apps/files_external/controller/userstoragescontroller.php10
-rw-r--r--apps/files_external/js/settings.js5
-rw-r--r--apps/files_external/js/statusmanager.js1
-rw-r--r--apps/files_external/lib/config.php4
-rw-r--r--apps/files_external/tests/js/settingsSpec.js3
8 files changed, 33 insertions, 18 deletions
diff --git a/apps/files_external/controller/globalstoragescontroller.php b/apps/files_external/controller/globalstoragescontroller.php
index b443cf4ea8f..dc7e8c0c24c 100644
--- a/apps/files_external/controller/globalstoragescontroller.php
+++ b/apps/files_external/controller/globalstoragescontroller.php
@@ -131,6 +131,7 @@ class GlobalStoragesController extends StoragesController {
* @param array $applicableUsers users for which to mount the storage
* @param array $applicableGroups groups for which to mount the storage
* @param int $priority priority
+ * @param bool $testOnly whether to storage should only test the connection or do more things
*
* @return DataResponse
*/
@@ -143,7 +144,8 @@ class GlobalStoragesController extends StoragesController {
$mountOptions,
$applicableUsers,
$applicableGroups,
- $priority
+ $priority,
+ $testOnly = true
) {
$storage = $this->createStorage(
$mountPoint,
@@ -176,7 +178,7 @@ class GlobalStoragesController extends StoragesController {
);
}
- $this->updateStorageStatus($storage);
+ $this->updateStorageStatus($storage, $testOnly);
return new DataResponse(
$storage,
diff --git a/apps/files_external/controller/storagescontroller.php b/apps/files_external/controller/storagescontroller.php
index 09b83104700..b26e85cc9af 100644
--- a/apps/files_external/controller/storagescontroller.php
+++ b/apps/files_external/controller/storagescontroller.php
@@ -240,8 +240,9 @@ abstract class StoragesController extends Controller {
* on whether the remote storage is available or not.
*
* @param StorageConfig $storage storage configuration
+ * @param bool $testOnly whether to storage should only test the connection or do more things
*/
- protected function updateStorageStatus(StorageConfig &$storage) {
+ protected function updateStorageStatus(StorageConfig &$storage, $testOnly = true) {
try {
$this->manipulateStorageConfig($storage);
@@ -252,7 +253,8 @@ abstract class StoragesController extends Controller {
\OC_Mount_Config::getBackendStatus(
$backend->getStorageClass(),
$storage->getBackendOptions(),
- false
+ false,
+ $testOnly
)
);
} catch (InsufficientDataForMeaningfulAnswerException $e) {
@@ -293,14 +295,15 @@ abstract class StoragesController extends Controller {
* Get an external storage entry.
*
* @param int $id storage id
+ * @param bool $testOnly whether to storage should only test the connection or do more things
*
* @return DataResponse
*/
- public function show($id) {
+ public function show($id, $testOnly = true) {
try {
$storage = $this->service->getStorage($id);
- $this->updateStorageStatus($storage);
+ $this->updateStorageStatus($storage, $testOnly);
} catch (NotFoundException $e) {
return new DataResponse(
[
diff --git a/apps/files_external/controller/userglobalstoragescontroller.php b/apps/files_external/controller/userglobalstoragescontroller.php
index 36c3740eed3..f89022ee468 100644
--- a/apps/files_external/controller/userglobalstoragescontroller.php
+++ b/apps/files_external/controller/userglobalstoragescontroller.php
@@ -106,15 +106,16 @@ class UserGlobalStoragesController extends StoragesController {
* Get an external storage entry.
*
* @param int $id storage id
+ * @param bool $testOnly whether to storage should only test the connection or do more things
* @return DataResponse
*
* @NoAdminRequired
*/
- public function show($id) {
+ public function show($id, $testOnly = true) {
try {
$storage = $this->service->getStorage($id);
- $this->updateStorageStatus($storage);
+ $this->updateStorageStatus($storage, $testOnly);
} catch (NotFoundException $e) {
return new DataResponse(
[
@@ -138,6 +139,7 @@ class UserGlobalStoragesController extends StoragesController {
*
* @param int $id storage id
* @param array $backendOptions backend-specific options
+ * @param bool $testOnly whether to storage should only test the connection or do more things
*
* @return DataResponse
*
@@ -145,7 +147,8 @@ class UserGlobalStoragesController extends StoragesController {
*/
public function update(
$id,
- $backendOptions
+ $backendOptions,
+ $testOnly = true
) {
try {
$storage = $this->service->getStorage($id);
@@ -170,7 +173,7 @@ class UserGlobalStoragesController extends StoragesController {
);
}
- $this->updateStorageStatus($storage);
+ $this->updateStorageStatus($storage, $testOnly);
$this->sanitizeStorage($storage);
return new DataResponse(
diff --git a/apps/files_external/controller/userstoragescontroller.php b/apps/files_external/controller/userstoragescontroller.php
index e53ea21f005..8ab22341225 100644
--- a/apps/files_external/controller/userstoragescontroller.php
+++ b/apps/files_external/controller/userstoragescontroller.php
@@ -104,8 +104,8 @@ class UserStoragesController extends StoragesController {
*
* {@inheritdoc}
*/
- public function show($id) {
- return parent::show($id);
+ public function show($id, $testOnly = true) {
+ return parent::show($id, $testOnly);
}
/**
@@ -162,6 +162,7 @@ class UserStoragesController extends StoragesController {
* @param string $authMechanism authentication mechanism identifier
* @param array $backendOptions backend-specific options
* @param array $mountOptions backend-specific mount options
+ * @param bool $testOnly whether to storage should only test the connection or do more things
*
* @return DataResponse
*
@@ -173,7 +174,8 @@ class UserStoragesController extends StoragesController {
$backend,
$authMechanism,
$backendOptions,
- $mountOptions
+ $mountOptions,
+ $testOnly = true
) {
$storage = $this->createStorage(
$mountPoint,
@@ -203,7 +205,7 @@ class UserStoragesController extends StoragesController {
);
}
- $this->updateStorageStatus($storage);
+ $this->updateStorageStatus($storage, $testOnly);
return new DataResponse(
$storage,
diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js
index 0b33458bec2..6262245688b 100644
--- a/apps/files_external/js/settings.js
+++ b/apps/files_external/js/settings.js
@@ -305,7 +305,8 @@ StorageConfig.prototype = {
mountPoint: this.mountPoint,
backend: this.backend,
authMechanism: this.authMechanism,
- backendOptions: this.backendOptions
+ backendOptions: this.backendOptions,
+ testOnly: true
};
if (this.id) {
data.id = this.id;
@@ -332,6 +333,7 @@ StorageConfig.prototype = {
$.ajax({
type: 'GET',
url: OC.generateUrl(this._url + '/{id}', {id: this.id}),
+ data: {'testOnly': true},
success: options.success,
error: options.error
});
@@ -911,6 +913,7 @@ MountConfigListView.prototype = _.extend({
$.ajax({
type: 'GET',
url: OC.generateUrl('apps/files_external/userglobalstorages'),
+ data: {'testOnly': true},
contentType: 'application/json',
success: function(result) {
var onCompletion = jQuery.Deferred();
diff --git a/apps/files_external/js/statusmanager.js b/apps/files_external/js/statusmanager.js
index 33d2ea104be..c51562558cf 100644
--- a/apps/files_external/js/statusmanager.js
+++ b/apps/files_external/js/statusmanager.js
@@ -78,6 +78,7 @@ OCA.External.StatusManager = {
defObj = $.ajax({
type: 'GET',
url: OC.webroot + '/index.php/apps/files_external/' + ((mountData.type === 'personal') ? 'userstorages' : 'userglobalstorages') + '/' + mountData.id,
+ data: {'testOnly': false},
success: function (response) {
if (response && response.status === 0) {
self.mountStatus[mountData.mount_point] = response;
diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php
index 70f8550f39b..11a111bd8ff 100644
--- a/apps/files_external/lib/config.php
+++ b/apps/files_external/lib/config.php
@@ -215,7 +215,7 @@ class OC_Mount_Config {
* @return int see self::STATUS_*
* @throws Exception
*/
- public static function getBackendStatus($class, $options, $isPersonal) {
+ public static function getBackendStatus($class, $options, $isPersonal, $testOnly = true) {
if (self::$skipTest) {
return StorageNotAvailableException::STATUS_SUCCESS;
}
@@ -228,7 +228,7 @@ class OC_Mount_Config {
$storage = new $class($options);
try {
- $result = $storage->test($isPersonal);
+ $result = $storage->test($isPersonal, $testOnly);
$storage->setAvailability($result);
if ($result) {
return StorageNotAvailableException::STATUS_SUCCESS;
diff --git a/apps/files_external/tests/js/settingsSpec.js b/apps/files_external/tests/js/settingsSpec.js
index 462407e9540..e4ee7a61aa9 100644
--- a/apps/files_external/tests/js/settingsSpec.js
+++ b/apps/files_external/tests/js/settingsSpec.js
@@ -223,7 +223,8 @@ describe('OCA.External.Settings tests', function() {
applicableGroups: [],
mountOptions: {
'previews': true
- }
+ },
+ testOnly: true
});
// TODO: respond and check data-id