diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php index 0c82e21e30d47..1c66f3af8d2b0 100644 --- a/lib/private/Files/Cache/Scanner.php +++ b/lib/private/Files/Cache/Scanner.php @@ -96,7 +96,7 @@ public function __construct(\OC\Files\Storage\Storage $storage) { $this->storageId = $this->storage->getId(); $this->cache = $storage->getCache(); $this->cacheActive = !\OC::$server->getConfig()->getSystemValueBool('filesystem_cache_readonly', false); - $this->lockingProvider = \OC::$server->getLockingProvider(); + $this->lockingProvider = \OC::$server->get(ILockingProvider::class); $this->connection = \OC::$server->get(IDBConnection::class); } diff --git a/lib/private/Files/Utils/Scanner.php b/lib/private/Files/Utils/Scanner.php index 6348427cb3bf1..ae6a0a33d2b7c 100644 --- a/lib/private/Files/Utils/Scanner.php +++ b/lib/private/Files/Utils/Scanner.php @@ -50,6 +50,7 @@ use OCP\Files\Storage\IStorage; use OCP\Files\StorageNotAvailableException; use OCP\IDBConnection; +use OCP\Lock\ILockingProvider; use Psr\Log\LoggerInterface; /** @@ -100,7 +101,7 @@ public function __construct($user, $db, IEventDispatcher $dispatcher, LoggerInte $this->dispatcher = $dispatcher; $this->logger = $logger; // when DB locking is used, no DB transactions will be used - $this->useTransaction = !(\OC::$server->getLockingProvider() instanceof DBLockingProvider); + $this->useTransaction = !(\OC::$server->get(ILockingProvider::class) instanceof DBLockingProvider); } /** diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index c80b42134c4b7..36d7002a26908 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -106,7 +106,7 @@ public function __construct(string $root = '') { } $this->fakeRoot = $root; - $this->lockingProvider = \OC::$server->getLockingProvider(); + $this->lockingProvider = \OC::$server->get(ILockingProvider::class); $this->lockingEnabled = !($this->lockingProvider instanceof \OC\Lock\NoopLockingProvider); $this->userManager = \OC::$server->getUserManager(); $this->logger = \OC::$server->get(LoggerInterface::class); diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php index b9dd49d71fe28..c4e17fd3118f5 100644 --- a/tests/lib/Files/ViewTest.php +++ b/tests/lib/Files/ViewTest.php @@ -1388,7 +1388,7 @@ public function testWriteToReadUnlockableFile($rootPath, $pathPrefix) { * Test that locks are on mount point paths instead of mount root */ public function testLockLocalMountPointPathInsteadOfStorageRoot() { - $lockingProvider = \OC::$server->getLockingProvider(); + $lockingProvider = \OC::$server->get(ILockingProvider::class); $view = new View('/testuser/files/'); $storage = new Temporary([]); Filesystem::mount($storage, [], '/'); @@ -1418,7 +1418,7 @@ public function testLockLocalMountPointPathInsteadOfStorageRoot() { * Test that locks are on mount point paths and also mount root when requested */ public function testLockStorageRootButNotLocalMountPoint() { - $lockingProvider = \OC::$server->getLockingProvider(); + $lockingProvider = \OC::$server->get(ILockingProvider::class); $view = new View('/testuser/files/'); $storage = new Temporary([]); Filesystem::mount($storage, [], '/'); @@ -1448,7 +1448,7 @@ public function testLockStorageRootButNotLocalMountPoint() { * Test that locks are on mount point paths and also mount root when requested */ public function testLockMountPointPathFailReleasesBoth() { - $lockingProvider = \OC::$server->getLockingProvider(); + $lockingProvider = \OC::$server->get(ILockingProvider::class); $view = new View('/testuser/files/'); $storage = new Temporary([]); Filesystem::mount($storage, [], '/'); diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php index db124bd6823f0..4ca0090176207 100644 --- a/tests/lib/TestCase.php +++ b/tests/lib/TestCase.php @@ -38,6 +38,7 @@ use OCP\IConfig; use OCP\IDBConnection; use OCP\IL10N; +use OCP\Lock\ILockingProvider; use OCP\Security\ISecureRandom; use Psr\Log\LoggerInterface; @@ -197,7 +198,7 @@ protected function tearDown(): void { // further cleanup $hookExceptions = \OC_Hook::$thrownExceptions; \OC_Hook::$thrownExceptions = []; - \OC::$server->getLockingProvider()->releaseAll(); + \OC::$server->get(ILockingProvider::class)->releaseAll(); if (!empty($hookExceptions)) { throw $hookExceptions[0]; } @@ -418,7 +419,7 @@ protected static function tearDownAfterClassCleanStrayHooks() { * Clean up the list of locks */ protected static function tearDownAfterClassCleanStrayLocks() { - \OC::$server->getLockingProvider()->releaseAll(); + \OC::$server->get(ILockingProvider::class)->releaseAll(); } /**