mirror of
https://github.com/icewind1991/lockpick.git
synced 2026-06-03 09:14:08 +02:00
increase compatibility
This commit is contained in:
parent
577d704871
commit
b7195fb59d
1 changed files with 10 additions and 1 deletions
|
|
@ -31,6 +31,7 @@ use OCP\AppFramework\App;
|
||||||
use OCP\AppFramework\Bootstrap\IBootContext;
|
use OCP\AppFramework\Bootstrap\IBootContext;
|
||||||
use OCP\AppFramework\Bootstrap\IBootstrap;
|
use OCP\AppFramework\Bootstrap\IBootstrap;
|
||||||
use OCP\AppFramework\Bootstrap\IRegistrationContext;
|
use OCP\AppFramework\Bootstrap\IRegistrationContext;
|
||||||
|
use OCP\AppFramework\Utility\ITimeFactory;
|
||||||
use OCP\ICacheFactory;
|
use OCP\ICacheFactory;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
|
|
@ -49,7 +50,15 @@ class Application extends App implements IBootstrap {
|
||||||
/** @var \OC\Memcache\Factory $memcacheFactory */
|
/** @var \OC\Memcache\Factory $memcacheFactory */
|
||||||
$memcacheFactory = $c->get(ICacheFactory::class);
|
$memcacheFactory = $c->get(ICacheFactory::class);
|
||||||
$memcache = $memcacheFactory->createLocking('lock');
|
$memcache = $memcacheFactory->createLocking('lock');
|
||||||
$inner = new MemcacheLockingProvider($memcache, $ttl);
|
|
||||||
|
// hacky compatibility
|
||||||
|
$class = new \ReflectionClass(MemcacheLockingProvider::class);
|
||||||
|
if ($class->getConstructor()->getNumberOfParameters() === 2) {
|
||||||
|
$inner = new MemcacheLockingProvider($memcache, $ttl);
|
||||||
|
} else {
|
||||||
|
$timeFactory = $c->get(ITimeFactory::class);
|
||||||
|
$inner = new MemcacheLockingProvider($memcache, $timeFactory, $ttl);
|
||||||
|
}
|
||||||
return new DebugLockingProvider($inner, $c->get(IRequest::class), $c->get(TraceStore::class));
|
return new DebugLockingProvider($inner, $c->get(IRequest::class), $c->get(TraceStore::class));
|
||||||
}
|
}
|
||||||
return new NoopLockingProvider();
|
return new NoopLockingProvider();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue