summaryrefslogtreecommitdiffstats
path: root/lib/private/Server.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Server.php')
-rw-r--r--lib/private/Server.php18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/private/Server.php b/lib/private/Server.php
index 6a1550f83e0..d947fa6f3e9 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -782,10 +782,20 @@ class Server extends ServerContainer implements IServerContainer {
$this->registerDeprecatedAlias('Search', ISearch::class);
$this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function ($c) {
- return new \OC\Security\RateLimiting\Backend\MemoryCache(
- $this->get(ICacheFactory::class),
- new \OC\AppFramework\Utility\TimeFactory()
- );
+ $cacheFactory = $c->get(ICacheFactory::class);
+ if ($cacheFactory->isAvailable()) {
+ $backend = new \OC\Security\RateLimiting\Backend\MemoryCacheBackend(
+ $this->get(ICacheFactory::class),
+ new \OC\AppFramework\Utility\TimeFactory()
+ );
+ } else {
+ $backend = new \OC\Security\RateLimiting\Backend\DatabaseBackend(
+ $c->get(IDBConnection::class),
+ new \OC\AppFramework\Utility\TimeFactory()
+ );
+ }
+
+ return $backend;
});
$this->registerAlias(\OCP\Security\ISecureRandom::class, SecureRandom::class);