aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/Files
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2024-09-16 21:48:18 +0200
committerCôme Chilliet <91878298+come-nc@users.noreply.github.com>2024-09-23 09:46:44 +0200
commit94b0a0e86337ff9ec7592e1df5fb785286665884 (patch)
tree6bdf64ea82ada7d17a3d4467caf851a271eee4d2 /lib/public/Files
parentba41f32e3e5e0bdcfd7501da7088b417172e975f (diff)
downloadnextcloud-server-94b0a0e86337ff9ec7592e1df5fb785286665884.tar.gz
nextcloud-server-94b0a0e86337ff9ec7592e1df5fb785286665884.zip
fix: Move storage constructor to specific interface
That allows Wrappers to use DI and not care about the constructor Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/public/Files')
-rw-r--r--lib/public/Files/Storage/IConstructableStorage.php26
-rw-r--r--lib/public/Files/Storage/IStorage.php9
2 files changed, 27 insertions, 8 deletions
diff --git a/lib/public/Files/Storage/IConstructableStorage.php b/lib/public/Files/Storage/IConstructableStorage.php
new file mode 100644
index 00000000000..5801b78d0a6
--- /dev/null
+++ b/lib/public/Files/Storage/IConstructableStorage.php
@@ -0,0 +1,26 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+// use OCP namespace for all classes that are considered public.
+// This means that they should be used by apps instead of the internal Nextcloud classes
+
+namespace OCP\Files\Storage;
+
+/**
+ * Marks a storage as constructable. Allows to pass the storage as a string to a mounpoint and let it build the instance.
+ *
+ * @since 31.0.0
+ */
+interface IConstructableStorage {
+ /**
+ * $parameters is a free form array with the configuration options needed to construct the storage
+ *
+ * @since 31.0.0
+ */
+ public function __construct(array $parameters);
+}
diff --git a/lib/public/Files/Storage/IStorage.php b/lib/public/Files/Storage/IStorage.php
index 2016c273f91..2368e126bb7 100644
--- a/lib/public/Files/Storage/IStorage.php
+++ b/lib/public/Files/Storage/IStorage.php
@@ -23,17 +23,10 @@ use OCP\Files\InvalidPathException;
* All paths passed to the storage are relative to the storage and should NOT have a leading slash.
*
* @since 9.0.0
+ * @since 31.0.0 Moved the constructor to IConstructableStorage so that wrappers can use DI
*/
interface IStorage {
/**
- * $parameters is a free form array with the configuration options needed to construct the storage
- *
- * @param array $parameters
- * @since 9.0.0
- */
- public function __construct($parameters);
-
- /**
* Get the identifier for the storage,
* the returned id should be the same for every storage object that is created with the same parameters
* and two storage objects with the same id should refer to two storages that display the same files.