aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files/Storage
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/private/Files/Storage
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/private/Files/Storage')
-rw-r--r--lib/private/Files/Storage/Common.php3
-rw-r--r--lib/private/Files/Storage/StorageFactory.php5
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php
index b6f14321f61..a9721c30d77 100644
--- a/lib/private/Files/Storage/Common.php
+++ b/lib/private/Files/Storage/Common.php
@@ -21,6 +21,7 @@ use OCP\Files\ForbiddenException;
use OCP\Files\GenericFileException;
use OCP\Files\IFilenameValidator;
use OCP\Files\InvalidPathException;
+use OCP\Files\Storage\IConstructableStorage;
use OCP\Files\Storage\ILockingStorage;
use OCP\Files\Storage\IStorage;
use OCP\Files\Storage\IWriteStreamStorage;
@@ -41,7 +42,7 @@ use Psr\Log\LoggerInterface;
* Some \OC\Files\Storage\Common methods call functions which are first defined
* in classes which extend it, e.g. $this->stat() .
*/
-abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage {
+abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, IConstructableStorage {
use LocalTempFileTrait;
protected ?Cache $cache = null;
diff --git a/lib/private/Files/Storage/StorageFactory.php b/lib/private/Files/Storage/StorageFactory.php
index 590425f5b64..f194228d3c8 100644
--- a/lib/private/Files/Storage/StorageFactory.php
+++ b/lib/private/Files/Storage/StorageFactory.php
@@ -8,8 +8,10 @@
namespace OC\Files\Storage;
use OCP\Files\Mount\IMountPoint;
+use OCP\Files\Storage\IConstructableStorage;
use OCP\Files\Storage\IStorage;
use OCP\Files\Storage\IStorageFactory;
+use Psr\Log\LoggerInterface;
class StorageFactory implements IStorageFactory {
/**
@@ -62,6 +64,9 @@ class StorageFactory implements IStorageFactory {
* @return IStorage
*/
public function getInstance(IMountPoint $mountPoint, $class, $arguments) {
+ if (!($class instanceof IConstructableStorage)) {
+ \OCP\Server::get(LoggerInterface::class)->warning('Building a storage not implementing IConstructableStorage is deprecated since 31.0.0', ['class' => $class]);
+ }
return $this->wrap($mountPoint, new $class($arguments));
}