summaryrefslogtreecommitdiffstats
path: root/apps/files_external/controller
diff options
context:
space:
mode:
authorRobin McCorkell <rmccorkell@owncloud.com>2015-08-12 20:03:11 +0100
committerRobin McCorkell <rmccorkell@owncloud.com>2015-08-19 10:05:11 +0100
commit1eeca031f863a652d07ebfa2f75339232bf60dc1 (patch)
tree2f4b046e3506d4e9e385415bf01961f9b9978d97 /apps/files_external/controller
parent272a46ebe1a5e195a078dde74f5f2ad941923d9e (diff)
downloadnextcloud-server-1eeca031f863a652d07ebfa2f75339232bf60dc1.tar.gz
nextcloud-server-1eeca031f863a652d07ebfa2f75339232bf60dc1.zip
Split backend identifiers from the class name
Prior to this, the storage class name was stored in mount.json under the "class" parameter, and the auth mechanism class name under the "authMechanism" parameter. This decouples the class name from the identifier used to retrieve the backend or auth mechanism. Now, backends/auth mechanisms have a unique identifier, which is saved in the "backend" or "authMechanism" parameter in mount.json respectively. An identifier is considered unique for the object it references, but the underlying class may change (e.g. files_external gets pulled into core and namespaces are modified).
Diffstat (limited to 'apps/files_external/controller')
-rw-r--r--apps/files_external/controller/globalstoragescontroller.php24
-rw-r--r--apps/files_external/controller/storagescontroller.php14
-rw-r--r--apps/files_external/controller/userstoragescontroller.php26
3 files changed, 32 insertions, 32 deletions
diff --git a/apps/files_external/controller/globalstoragescontroller.php b/apps/files_external/controller/globalstoragescontroller.php
index 2c7b6af4192..756a34fc5d4 100644
--- a/apps/files_external/controller/globalstoragescontroller.php
+++ b/apps/files_external/controller/globalstoragescontroller.php
@@ -63,8 +63,8 @@ class GlobalStoragesController extends StoragesController {
* Create an external storage entry.
*
* @param string $mountPoint storage mount point
- * @param string $backendClass backend class name
- * @param string $authMechanismClass authentication mechanism class
+ * @param string $backend backend identifier
+ * @param string $authMechanism authentication mechanism identifier
* @param array $backendOptions backend-specific options
* @param array $mountOptions mount-specific options
* @param array $applicableUsers users for which to mount the storage
@@ -75,8 +75,8 @@ class GlobalStoragesController extends StoragesController {
*/
public function create(
$mountPoint,
- $backendClass,
- $authMechanismClass,
+ $backend,
+ $authMechanism,
$backendOptions,
$mountOptions,
$applicableUsers,
@@ -85,8 +85,8 @@ class GlobalStoragesController extends StoragesController {
) {
$newStorage = $this->createStorage(
$mountPoint,
- $backendClass,
- $authMechanismClass,
+ $backend,
+ $authMechanism,
$backendOptions,
$mountOptions,
$applicableUsers,
@@ -117,8 +117,8 @@ class GlobalStoragesController extends StoragesController {
*
* @param int $id storage id
* @param string $mountPoint storage mount point
- * @param string $backendClass backend class name
- * @param string $authMechanismClass authentication mechansim class
+ * @param string $backend backend identifier
+ * @param string $authMechanism authentication mechansim identifier
* @param array $backendOptions backend-specific options
* @param array $mountOptions mount-specific options
* @param array $applicableUsers users for which to mount the storage
@@ -130,8 +130,8 @@ class GlobalStoragesController extends StoragesController {
public function update(
$id,
$mountPoint,
- $backendClass,
- $authMechanismClass,
+ $backend,
+ $authMechanism,
$backendOptions,
$mountOptions,
$applicableUsers,
@@ -140,8 +140,8 @@ class GlobalStoragesController extends StoragesController {
) {
$storage = $this->createStorage(
$mountPoint,
- $backendClass,
- $authMechanismClass,
+ $backend,
+ $authMechanism,
$backendOptions,
$mountOptions,
$applicableUsers,
diff --git a/apps/files_external/controller/storagescontroller.php b/apps/files_external/controller/storagescontroller.php
index 5f3779dc8b9..f1d1625bdc6 100644
--- a/apps/files_external/controller/storagescontroller.php
+++ b/apps/files_external/controller/storagescontroller.php
@@ -77,8 +77,8 @@ abstract class StoragesController extends Controller {
* Create a storage from its parameters
*
* @param string $mountPoint storage mount point
- * @param string $backendClass backend class name
- * @param string $authMechanismClass authentication mechanism class name
+ * @param string $backend backend identifier
+ * @param string $authMechanism authentication mechanism identifier
* @param array $backendOptions backend-specific options
* @param array|null $mountOptions mount-specific options
* @param array|null $applicableUsers users for which to mount the storage
@@ -89,8 +89,8 @@ abstract class StoragesController extends Controller {
*/
protected function createStorage(
$mountPoint,
- $backendClass,
- $authMechanismClass,
+ $backend,
+ $authMechanism,
$backendOptions,
$mountOptions = null,
$applicableUsers = null,
@@ -100,8 +100,8 @@ abstract class StoragesController extends Controller {
try {
return $this->service->createStorage(
$mountPoint,
- $backendClass,
- $authMechanismClass,
+ $backend,
+ $authMechanism,
$backendOptions,
$mountOptions,
$applicableUsers,
@@ -145,7 +145,7 @@ abstract class StoragesController extends Controller {
return new DataResponse(
array(
'message' => (string)$this->l10n->t('Invalid storage backend "%s"', [
- $storage->getBackend()->getClass()
+ $storage->getBackend()->getIdentifier()
])
),
Http::STATUS_UNPROCESSABLE_ENTITY
diff --git a/apps/files_external/controller/userstoragescontroller.php b/apps/files_external/controller/userstoragescontroller.php
index e72b51ff653..0d41e088a76 100644
--- a/apps/files_external/controller/userstoragescontroller.php
+++ b/apps/files_external/controller/userstoragescontroller.php
@@ -83,7 +83,7 @@ class UserStoragesController extends StoragesController {
return new DataResponse(
array(
'message' => (string)$this->l10n->t('Admin-only storage backend "%s"', [
- $storage->getBackend()->getClass()
+ $storage->getBackend()->getIdentifier()
])
),
Http::STATUS_UNPROCESSABLE_ENTITY
@@ -108,8 +108,8 @@ class UserStoragesController extends StoragesController {
* Create an external storage entry.
*
* @param string $mountPoint storage mount point
- * @param string $backendClass backend class name
- * @param string $authMechanismClass authentication mechanism class
+ * @param string $backend backend identifier
+ * @param string $authMechanism authentication mechanism identifier
* @param array $backendOptions backend-specific options
* @param array $mountOptions backend-specific mount options
*
@@ -119,15 +119,15 @@ class UserStoragesController extends StoragesController {
*/
public function create(
$mountPoint,
- $backendClass,
- $authMechanismClass,
+ $backend,
+ $authMechanism,
$backendOptions,
$mountOptions
) {
$newStorage = $this->createStorage(
$mountPoint,
- $backendClass,
- $authMechanismClass,
+ $backend,
+ $authMechanism,
$backendOptions,
$mountOptions
);
@@ -154,8 +154,8 @@ class UserStoragesController extends StoragesController {
*
* @param int $id storage id
* @param string $mountPoint storage mount point
- * @param string $backendClass backend class name
- * @param string $authMechanismClass authentication mechanism class
+ * @param string $backend backend identifier
+ * @param string $authMechanism authentication mechanism identifier
* @param array $backendOptions backend-specific options
* @param array $mountOptions backend-specific mount options
*
@@ -166,15 +166,15 @@ class UserStoragesController extends StoragesController {
public function update(
$id,
$mountPoint,
- $backendClass,
- $authMechanismClass,
+ $backend,
+ $authMechanism,
$backendOptions,
$mountOptions
) {
$storage = $this->createStorage(
$mountPoint,
- $backendClass,
- $authMechanismClass,
+ $backend,
+ $authMechanism,
$backendOptions,
$mountOptions
);