diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php index b067f70b8cb51..e06ad5586baa4 100644 --- a/lib/private/Files/Cache/Scanner.php +++ b/lib/private/Files/Cache/Scanner.php @@ -11,14 +11,16 @@ use OC\Files\Storage\Wrapper\Encryption; use OC\Files\Storage\Wrapper\Jail; use OC\Hooks\BasicEmitter; -use OC\SystemConfig; +use OC\Lock\DBLockingProvider; use OCP\Files\Cache\IScanner; use OCP\Files\ForbiddenException; use OCP\Files\NotFoundException; use OCP\Files\Storage\ILockingStorage; use OCP\Files\Storage\IReliableEtagStorage; +use OCP\IConfig; use OCP\IDBConnection; use OCP\Lock\ILockingProvider; +use OCP\Server; use Psr\Log\LoggerInterface; /** @@ -69,10 +71,10 @@ public function __construct(\OC\Files\Storage\Storage $storage) { $this->storage = $storage; $this->storageId = $this->storage->getId(); $this->cache = $storage->getCache(); - /** @var SystemConfig $config */ - $config = \OC::$server->get(SystemConfig::class); - $this->cacheActive = !$config->getValue('filesystem_cache_readonly', false); - $this->useTransactions = !$config->getValue('filescanner_no_transactions', false); + /** @var IConfig $config */ + $config = Server::get(IConfig::class); + $this->cacheActive = !$config->getSystemValueBool('filesystem_cache_readonly', false); + $this->useTransactions = !(Server::get(ILockingProvider::class) instanceof DBLockingProvider) && !$config->getSystemValueBool('filescanner_no_transactions', false); $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 e9ed351b27bcd..1134ffa6f6832 100644 --- a/lib/private/Files/Utils/Scanner.php +++ b/lib/private/Files/Utils/Scanner.php @@ -27,9 +27,11 @@ use OCP\Files\NotFoundException; use OCP\Files\Storage\IStorage; use OCP\Files\StorageNotAvailableException; +use OCP\IConfig; use OCP\IDBConnection; use OCP\Lock\ILockingProvider; use OCP\Lock\LockedException; +use OCP\Server; use Psr\Log\LoggerInterface; /** @@ -79,8 +81,10 @@ public function __construct($user, $db, IEventDispatcher $dispatcher, LoggerInte $this->db = $db; $this->dispatcher = $dispatcher; $this->logger = $logger; + /** @var IConfig $config */ + $config = Server::get(IConfig::class); // when DB locking is used, no DB transactions will be used - $this->useTransaction = !(\OC::$server->get(ILockingProvider::class) instanceof DBLockingProvider); + $this->useTransaction = !(Server::get(ILockingProvider::class) instanceof DBLockingProvider) && !$config->getSystemValueBool('filescanner_no_transactions', false); } /**