From 32ae8ed0ac690b6c9bc49c104001cc62b09c0c19 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 19 Sep 2023 12:42:53 +0200 Subject: [PATCH] apply known mtime wrapper for external storages Signed-off-by: Robin Appelman --- .../lib/Config/ConfigAdapter.php | 28 +++++++------------ .../Files/Storage/Wrapper/KnownMtimeTest.php | 1 - 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/apps/files_external/lib/Config/ConfigAdapter.php b/apps/files_external/lib/Config/ConfigAdapter.php index 7f7c5e3e2ebc3..1b83688418c74 100644 --- a/apps/files_external/lib/Config/ConfigAdapter.php +++ b/apps/files_external/lib/Config/ConfigAdapter.php @@ -31,6 +31,7 @@ use OC\Files\Storage\FailedStorage; use OC\Files\Storage\Wrapper\Availability; +use OC\Files\Storage\Wrapper\KnownMtime; use OCA\Files_External\Lib\PersonalMount; use OCA\Files_External\Lib\StorageConfig; use OCA\Files_External\Service\UserGlobalStoragesService; @@ -40,29 +41,17 @@ use OCP\Files\Storage\IStorageFactory; use OCP\Files\StorageNotAvailableException; use OCP\IUser; +use Psr\Clock\ClockInterface; /** * Make the old files_external config work with the new public mount config api */ class ConfigAdapter implements IMountProvider { - - /** @var UserStoragesService */ - private $userStoragesService; - - /** @var UserGlobalStoragesService */ - private $userGlobalStoragesService; - - /** - * @param UserStoragesService $userStoragesService - * @param UserGlobalStoragesService $userGlobalStoragesService - */ public function __construct( - UserStoragesService $userStoragesService, - UserGlobalStoragesService $userGlobalStoragesService - ) { - $this->userStoragesService = $userStoragesService; - $this->userGlobalStoragesService = $userGlobalStoragesService; - } + private UserStoragesService $userStoragesService, + private UserGlobalStoragesService $userGlobalStoragesService, + private ClockInterface $clock, + ) {} /** * Process storage ready for mounting @@ -155,7 +144,10 @@ public function getMountsForUser(IUser $user, IStorageFactory $loader) { $this->userStoragesService, $storageConfig, $storageConfig->getId(), - $storage, + new KnownMtime([ + 'storage' => $storage, + 'clock' => $this->clock, + ]), '/' . $user->getUID() . '/files' . $storageConfig->getMountPoint(), null, $loader, diff --git a/tests/lib/Files/Storage/Wrapper/KnownMtimeTest.php b/tests/lib/Files/Storage/Wrapper/KnownMtimeTest.php index 9694fc7bc9977..0a1691f9e704a 100644 --- a/tests/lib/Files/Storage/Wrapper/KnownMtimeTest.php +++ b/tests/lib/Files/Storage/Wrapper/KnownMtimeTest.php @@ -10,7 +10,6 @@ use OC\Files\Storage\Temporary; use OC\Files\Storage\Wrapper\KnownMtime; -use OCP\Constants; use PHPUnit\Framework\MockObject\MockObject; use Psr\Clock\ClockInterface; use Test\Files\Storage\Storage;