]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add support to know where the storage test comes from
authorJuan Pablo Villafáñez <jvillafanez@solidgear.es>
Tue, 7 Jun 2016 14:53:16 +0000 (16:53 +0200)
committerJuan Pablo Villafáñez <jvillafanez@solidgear.es>
Tue, 7 Jun 2016 14:53:16 +0000 (16:53 +0200)
apps/files_external/js/settings.js
apps/files_external/js/statusmanager.js
apps/files_external/lib/Controller/GlobalStoragesController.php
apps/files_external/lib/Controller/StoragesController.php
apps/files_external/lib/Controller/UserGlobalStoragesController.php
apps/files_external/lib/Controller/UserStoragesController.php
apps/files_external/lib/config.php

index 8d2cb52d67cc672e91c8dfe5fb94cf539b058f1e..4d5a08a5de4fc3ff6a3e7fe18882647ec65c4b4a 100644 (file)
@@ -299,7 +299,8 @@ StorageConfig.prototype = {
                        mountPoint: this.mountPoint,
                        backend: this.backend,
                        authMechanism: this.authMechanism,
-                       backendOptions: this.backendOptions
+                       backendOptions: this.backendOptions,
+                       origin: 'settings'
                };
                if (this.id) {
                        data.id = this.id;
@@ -326,6 +327,7 @@ StorageConfig.prototype = {
                $.ajax({
                        type: 'GET',
                        url: OC.generateUrl(this._url + '/{id}', {id: this.id}),
+                       data: {'origin': 'settings'},
                        success: options.success,
                        error: options.error
                });
@@ -908,6 +910,7 @@ MountConfigListView.prototype = _.extend({
                        $.ajax({
                                type: 'GET',
                                url: OC.generateUrl('apps/files_external/userglobalstorages'),
+                               data: {'origin' : 'settings'},
                                contentType: 'application/json',
                                success: function(result) {
                                        var onCompletion = jQuery.Deferred();
index 118ec17d24658fe5cf3e2796bf90bdb772b66c8c..57acc562deb42172ec97b0721c6a89526253e129 100644 (file)
@@ -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: {'origin' : 'statusmanager'},
                                success: function (response) {
                                        if (response && response.status === 0) {
                                                self.mountStatus[mountData.mount_point] = response;
index 6f9278ce6f1fa2829534e8bb0bb49607da967c7c..af71a4831cdfe4c030152e7286f212119e273170 100644 (file)
@@ -139,7 +139,8 @@ class GlobalStoragesController extends StoragesController {
                $mountOptions,
                $applicableUsers,
                $applicableGroups,
-               $priority
+               $priority,
+               $origin = null
        ) {
                $storage = $this->createStorage(
                        $mountPoint,
@@ -172,7 +173,7 @@ class GlobalStoragesController extends StoragesController {
                        );
                }
 
-               $this->updateStorageStatus($storage);
+               $this->updateStorageStatus($storage, $origin);
 
                return new DataResponse(
                        $storage,
index aa6a04ecb8d1ef3aa680be12f967006254118af2..213518ff4a063ebc74dcbdf0d83e8c0dc414e1a9 100644 (file)
@@ -238,7 +238,7 @@ abstract class StoragesController extends Controller {
         *
         * @param StorageConfig $storage storage configuration
         */
-       protected function updateStorageStatus(StorageConfig &$storage) {
+       protected function updateStorageStatus(StorageConfig &$storage, $origin = null) {
                try {
                        $this->manipulateStorageConfig($storage);
 
@@ -249,7 +249,8 @@ abstract class StoragesController extends Controller {
                                \OC_Mount_Config::getBackendStatus(
                                        $backend->getStorageClass(),
                                        $storage->getBackendOptions(),
-                                       false
+                                       false,
+                                       $origin
                                )
                        );
                } catch (InsufficientDataForMeaningfulAnswerException $e) {
@@ -293,11 +294,11 @@ abstract class StoragesController extends Controller {
         *
         * @return DataResponse
         */
-       public function show($id) {
+       public function show($id, $origin = null) {
                try {
                        $storage = $this->service->getStorage($id);
 
-                       $this->updateStorageStatus($storage);
+                       $this->updateStorageStatus($storage, $origin);
                } catch (NotFoundException $e) {
                        return new DataResponse(
                                [
index 1c94a1e9635ceda2404b1def63e9d587ce981c41..5050962a52e7b746e1e58a27eadb539d9d365830 100644 (file)
@@ -111,11 +111,11 @@ class UserGlobalStoragesController extends StoragesController {
         *
         * @NoAdminRequired
         */
-       public function show($id) {
+       public function show($id, $origin = null) {
                try {
                        $storage = $this->service->getStorage($id);
 
-                       $this->updateStorageStatus($storage);
+                       $this->updateStorageStatus($storage, $origin);
                } catch (NotFoundException $e) {
                        return new DataResponse(
                                [
@@ -146,7 +146,8 @@ class UserGlobalStoragesController extends StoragesController {
         */
        public function update(
                $id,
-               $backendOptions
+               $backendOptions,
+               $origin = null
        ) {
                try {
                        $storage = $this->service->getStorage($id);
index 936da7ec5e25b708fb23df1b56a90d4e1a1f59dd..73f7178b1422ef20ab0e10acbc9a3f4955c9e3ec 100644 (file)
@@ -101,8 +101,8 @@ class UserStoragesController extends StoragesController {
         *
         * {@inheritdoc}
         */
-       public function show($id) {
-               return parent::show($id);
+       public function show($id, $origin = null) {
+               return parent::show($id, $origin);
        }
 
        /**
@@ -170,7 +170,8 @@ class UserStoragesController extends StoragesController {
                $backend,
                $authMechanism,
                $backendOptions,
-               $mountOptions
+               $mountOptions,
+               $origin = null
        ) {
                $storage = $this->createStorage(
                        $mountPoint,
@@ -200,7 +201,7 @@ class UserStoragesController extends StoragesController {
                        );
                }
 
-               $this->updateStorageStatus($storage);
+               $this->updateStorageStatus($storage, $origin);
 
                return new DataResponse(
                        $storage,
index 86aafcf57706573c89c42005b430a9bf2b548378..51d624497828a0b077de98240c76ea71626a3d6c 100644 (file)
@@ -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, $origin = null) {
                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, $origin);
                                        $storage->setAvailability($result);
                                        if ($result) {
                                                return StorageNotAvailableException::STATUS_SUCCESS;