Proper DI for ILockingProvider

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2017-07-22 13:46:09 +02:00
parent 7f6a72b65d
commit 25c36be901
No known key found for this signature in database
GPG Key ID: F941078878347C0C
1 changed files with 3 additions and 1 deletions

View File

@ -113,6 +113,7 @@ use OCP\IServerContainer;
use OCP\ITempManager; use OCP\ITempManager;
use OCP\Contacts\ContactsMenu\IActionFactory; use OCP\Contacts\ContactsMenu\IActionFactory;
use OCP\IURLGenerator; use OCP\IURLGenerator;
use OCP\Lock\ILockingProvider;
use OCP\RichObjectStrings\IValidator; use OCP\RichObjectStrings\IValidator;
use OCP\Security\IContentSecurityPolicyManager; use OCP\Security\IContentSecurityPolicyManager;
use OCP\Share\IShareHelper; use OCP\Share\IShareHelper;
@ -785,7 +786,7 @@ class Server extends ServerContainer implements IServerContainer {
$factory = new $factoryClass($this); $factory = new $factoryClass($this);
return $factory->getLDAPProvider(); return $factory->getLDAPProvider();
}); });
$this->registerService('LockingProvider', function (Server $c) { $this->registerService(ILockingProvider::class, function (Server $c) {
$ini = $c->getIniWrapper(); $ini = $c->getIniWrapper();
$config = $c->getConfig(); $config = $c->getConfig();
$ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time'))); $ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time')));
@ -800,6 +801,7 @@ class Server extends ServerContainer implements IServerContainer {
} }
return new NoopLockingProvider(); return new NoopLockingProvider();
}); });
$this->registerAlias('LockingProvider', ILockingProvider::class);
$this->registerService(\OCP\Files\Mount\IMountManager::class, function () { $this->registerService(\OCP\Files\Mount\IMountManager::class, function () {
return new \OC\Files\Mount\Manager(); return new \OC\Files\Mount\Manager();