diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php index 5226803240904..314922261bdae 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 b7f6972ee1082..00a973da05c09 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 7181593931009..1356d0dac4b56 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -103,7 +103,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 2bf483df7d7f3..69dfece72d403 100644 --- a/tests/lib/Files/ViewTest.php +++ b/tests/lib/Files/ViewTest.php @@ -1387,7 +1387,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, [], '/'); @@ -1417,7 +1417,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, [], '/'); @@ -1447,7 +1447,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 f5fc9a6e8f2c4..d42adbd8bd47f 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; @@ -176,7 +177,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]; } @@ -395,7 +396,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(); } /**