Skip to content

Commit 81de305

Browse files
artongebackportbot[bot]
authored andcommitted
feat(scanner): enable use of a setting to disable DB transaction
while doing a files scan from storage, we may want not to use DB transactions enable the use of a setting for that define filescanner_no_transactions in system config to enable this (i.e. in config.php) Signed-off-by: Matthieu Gallien <[email protected]> Signed-off-by: Louis Chmn <[email protected]> [skip ci]
1 parent 24ae53b commit 81de305

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/private/Files/Utils/Scanner.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@
2727
use OCP\Files\NotFoundException;
2828
use OCP\Files\Storage\IStorage;
2929
use OCP\Files\StorageNotAvailableException;
30+
use OCP\IConfig;
3031
use OCP\IDBConnection;
3132
use OCP\Lock\ILockingProvider;
3233
use OCP\Lock\LockedException;
34+
use OCP\Server;
3335
use Psr\Log\LoggerInterface;
3436

3537
/**
@@ -79,8 +81,10 @@ public function __construct($user, $db, IEventDispatcher $dispatcher, LoggerInte
7981
$this->db = $db;
8082
$this->dispatcher = $dispatcher;
8183
$this->logger = $logger;
84+
/** @var IConfig $config */
85+
$config = Server::get(IConfig::class);
8286
// when DB locking is used, no DB transactions will be used
83-
$this->useTransaction = !(\OC::$server->get(ILockingProvider::class) instanceof DBLockingProvider);
87+
$this->useTransaction = !(\OC::$server->get(ILockingProvider::class) instanceof DBLockingProvider) && !$config->getSystemValueBool('filescanner_no_transactions', false);
8488
}
8589

8690
/**

0 commit comments

Comments
 (0)