From 94b0a0e86337ff9ec7592e1df5fb785286665884 Mon Sep 17 00:00:00 2001 From: Côme Chilliet Date: Mon, 16 Sep 2024 21:48:18 +0200 Subject: fix: Move storage constructor to specific interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit That allows Wrappers to use DI and not care about the constructor Signed-off-by: Côme Chilliet --- apps/files_external/lib/Config/ConfigAdapter.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'apps') diff --git a/apps/files_external/lib/Config/ConfigAdapter.php b/apps/files_external/lib/Config/ConfigAdapter.php index d0437432427..b2246226d33 100644 --- a/apps/files_external/lib/Config/ConfigAdapter.php +++ b/apps/files_external/lib/Config/ConfigAdapter.php @@ -15,11 +15,13 @@ use OCA\Files_External\Service\UserGlobalStoragesService; use OCA\Files_External\Service\UserStoragesService; use OCP\Files\Config\IMountProvider; use OCP\Files\ObjectStore\IObjectStore; +use OCP\Files\Storage\IConstructableStorage; use OCP\Files\Storage\IStorage; use OCP\Files\Storage\IStorageFactory; use OCP\Files\StorageNotAvailableException; use OCP\IUser; use Psr\Clock\ClockInterface; +use Psr\Log\LoggerInterface; /** * Make the old files_external config work with the new public mount config api @@ -62,6 +64,9 @@ class ConfigAdapter implements IMountProvider { */ private function constructStorage(StorageConfig $storageConfig): IStorage { $class = $storageConfig->getBackend()->getStorageClass(); + if (!$class instanceof IConstructableStorage) { + \OCP\Server::get(LoggerInterface::class)->warning('Building a storage not implementing IConstructableStorage is deprecated since 31.0.0', ['class' => $class]); + } $storage = new $class($storageConfig->getBackendOptions()); // auth mechanism should fire first -- cgit v1.2.3