aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2023-08-15 16:44:23 +0200
committerRobin Appelman <robin@icewind.nl>2023-08-18 11:14:52 +0200
commit9ea03a9534c1d8c40c500d6d484c001ae66c5f9a (patch)
tree615ed48ba82e52e93b3b71a601abc547a1908e69
parentc7035eec05d40ec595135691cb00a25b452d655c (diff)
downloadnextcloud-server-9ea03a9534c1d8c40c500d6d484c001ae66c5f9a.tar.gz
nextcloud-server-9ea03a9534c1d8c40c500d6d484c001ae66c5f9a.zip
reuse dependencies from wrapped cache
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r--lib/private/Files/Cache/Wrapper/CacheWrapper.php14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/private/Files/Cache/Wrapper/CacheWrapper.php b/lib/private/Files/Cache/Wrapper/CacheWrapper.php
index 6479ea793b0..39a78f31343 100644
--- a/lib/private/Files/Cache/Wrapper/CacheWrapper.php
+++ b/lib/private/Files/Cache/Wrapper/CacheWrapper.php
@@ -33,8 +33,10 @@ use OC\Files\Cache\Cache;
use OC\Files\Cache\QuerySearchHelper;
use OCP\Files\Cache\ICache;
use OCP\Files\Cache\ICacheEntry;
+use OCP\Files\IMimeTypeLoader;
use OCP\Files\Search\ISearchOperator;
use OCP\Files\Search\ISearchQuery;
+use OCP\IDBConnection;
class CacheWrapper extends Cache {
/**
@@ -47,9 +49,15 @@ class CacheWrapper extends Cache {
*/
public function __construct($cache) {
$this->cache = $cache;
- $this->mimetypeLoader = \OC::$server->getMimeTypeLoader();
- $this->connection = \OC::$server->getDatabaseConnection();
- $this->querySearchHelper = \OC::$server->get(QuerySearchHelper::class);
+ if ($cache instanceof Cache) {
+ $this->mimetypeLoader = $cache->mimetypeLoader;
+ $this->connection = $cache->connection;
+ $this->querySearchHelper = $cache->querySearchHelper;
+ } else {
+ $this->mimetypeLoader = \OC::$server->get(IMimeTypeLoader::class);
+ $this->connection = \OC::$server->get(IDBConnection::class);
+ $this->querySearchHelper = \OC::$server->get(QuerySearchHelper::class);
+ }
}
protected function getCache() {