mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Refactor OC\Server::getLockingProvider
Signed-off-by: Andrew Summers <18727110+summersab@users.noreply.github.com>
This commit is contained in:
parent
df1cd1ba7e
commit
45eb4a839d
5 changed files with 10 additions and 8 deletions
|
|
@ -96,7 +96,7 @@ class Scanner extends BasicEmitter implements IScanner {
|
|||
$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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ use OCP\Files\NotFoundException;
|
|||
use OCP\Files\Storage\IStorage;
|
||||
use OCP\Files\StorageNotAvailableException;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\Lock\ILockingProvider;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
|
|
@ -100,7 +101,7 @@ class Scanner extends PublicEmitter {
|
|||
$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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ class View {
|
|||
}
|
||||
|
||||
$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);
|
||||
|
|
|
|||
|
|
@ -1388,7 +1388,7 @@ class ViewTest extends \Test\TestCase {
|
|||
* 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 @@ class ViewTest extends \Test\TestCase {
|
|||
* 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 @@ class ViewTest extends \Test\TestCase {
|
|||
* 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, [], '/');
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ use OCP\Defaults;
|
|||
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 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase {
|
|||
// 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 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase {
|
|||
* Clean up the list of locks
|
||||
*/
|
||||
protected static function tearDownAfterClassCleanStrayLocks() {
|
||||
\OC::$server->getLockingProvider()->releaseAll();
|
||||
\OC::$server->get(ILockingProvider::class)->releaseAll();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue