mirror of
https://github.com/nextcloud/server.git
synced 2024-09-14 00:02:46 +02:00
also improe cache ci for shared cache
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
7a91abb439
commit
e50c176428
@ -44,6 +44,7 @@ use OCP\Files\Cache\ICache;
|
||||
use OCP\Files\Config\IUserMountCache;
|
||||
use OCP\Files\Mount\IMountPoint;
|
||||
use OCP\Files\Storage\IStorage;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\IUser;
|
||||
|
||||
class CleaningDBConfig extends DBConfigService {
|
||||
@ -315,7 +316,7 @@ abstract class StoragesServiceTest extends \Test\TestCase {
|
||||
|
||||
// manually trigger storage entry because normally it happens on first
|
||||
// access, which isn't possible within this test
|
||||
$storageCache = new \OC\Files\Cache\Storage($rustyStorageId);
|
||||
$storageCache = new \OC\Files\Cache\Storage($rustyStorageId, true, \OC::$server->get(IDBConnection::class));
|
||||
|
||||
/** @var IUserMountCache $mountCache */
|
||||
$mountCache = \OC::$server->get(IUserMountCache::class);
|
||||
|
@ -28,12 +28,14 @@
|
||||
*/
|
||||
namespace OCA\Files_Sharing;
|
||||
|
||||
use OC\Files\Cache\CacheDependencies;
|
||||
use OC\Files\Cache\FailedCache;
|
||||
use OC\Files\Cache\Wrapper\CacheJail;
|
||||
use OC\Files\Search\SearchBinaryOperator;
|
||||
use OC\Files\Search\SearchComparison;
|
||||
use OC\Files\Storage\Wrapper\Jail;
|
||||
use OC\User\DisplayNameCache;
|
||||
use OCP\Files\Cache\ICache;
|
||||
use OCP\Files\Cache\ICacheEntry;
|
||||
use OCP\Files\Search\ISearchBinaryOperator;
|
||||
use OCP\Files\Search\ISearchComparison;
|
||||
@ -62,18 +64,19 @@ class Cache extends CacheJail {
|
||||
public function __construct(
|
||||
$storage,
|
||||
ICacheEntry $sourceRootInfo,
|
||||
DisplayNameCache $displayNameCache,
|
||||
CacheDependencies $dependencies,
|
||||
IShare $share
|
||||
) {
|
||||
$this->storage = $storage;
|
||||
$this->sourceRootInfo = $sourceRootInfo;
|
||||
$this->numericId = $sourceRootInfo->getStorageId();
|
||||
$this->displayNameCache = $displayNameCache;
|
||||
$this->displayNameCache = $dependencies->getDisplayNameCache();
|
||||
$this->share = $share;
|
||||
|
||||
parent::__construct(
|
||||
null,
|
||||
''
|
||||
'',
|
||||
$dependencies,
|
||||
);
|
||||
}
|
||||
|
||||
@ -98,7 +101,7 @@ class Cache extends CacheJail {
|
||||
return $this->sourceRootInfo->getPath();
|
||||
}
|
||||
|
||||
public function getCache() {
|
||||
public function getCache(): ICache {
|
||||
if (is_null($this->cache)) {
|
||||
$sourceStorage = $this->storage->getSourceStorage();
|
||||
if ($sourceStorage) {
|
||||
|
@ -32,6 +32,7 @@
|
||||
*/
|
||||
namespace OCA\Files_Sharing;
|
||||
|
||||
use OC\Files\Cache\CacheDependencies;
|
||||
use OC\Files\Cache\FailedCache;
|
||||
use OC\Files\Cache\NullWatcher;
|
||||
use OC\Files\Cache\Watcher;
|
||||
@ -40,7 +41,6 @@ use OC\Files\Storage\Common;
|
||||
use OC\Files\Storage\FailedStorage;
|
||||
use OC\Files\Storage\Home;
|
||||
use OC\Files\Storage\Wrapper\PermissionsMask;
|
||||
use OC\User\DisplayNameCache;
|
||||
use OC\User\NoUserException;
|
||||
use OCA\Files_External\Config\ExternalMountPoint;
|
||||
use OCP\Constants;
|
||||
@ -410,10 +410,10 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements ISharedSto
|
||||
return new FailedCache();
|
||||
}
|
||||
|
||||
$this->cache = new \OCA\Files_Sharing\Cache(
|
||||
$this->cache = new Cache(
|
||||
$storage,
|
||||
$sourceRoot,
|
||||
\OC::$server->get(DisplayNameCache::class),
|
||||
\OC::$server->get(CacheDependencies::class),
|
||||
$this->getShare()
|
||||
);
|
||||
return $this->cache;
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace OC\Files\Cache;
|
||||
|
||||
use OC\SystemConfig;
|
||||
use OC\User\DisplayNameCache;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use OCP\Files\IMimeTypeLoader;
|
||||
use OCP\FilesMetadata\IFilesMetadataManager;
|
||||
@ -18,6 +19,7 @@ class CacheDependencies {
|
||||
private SystemConfig $systemConfig,
|
||||
private LoggerInterface $logger,
|
||||
private IFilesMetadataManager $metadataManager,
|
||||
private DisplayNameCache $displayNameCache,
|
||||
) {
|
||||
}
|
||||
|
||||
@ -45,6 +47,10 @@ class CacheDependencies {
|
||||
return $this->logger;
|
||||
}
|
||||
|
||||
public function getDisplayNameCache(): DisplayNameCache {
|
||||
return $this->displayNameCache;
|
||||
}
|
||||
|
||||
public function getMetadataManager(): IFilesMetadataManager {
|
||||
return $this->metadataManager;
|
||||
}
|
||||
|
@ -28,8 +28,10 @@
|
||||
namespace OC\Files\Cache\Wrapper;
|
||||
|
||||
use OC\Files\Cache\Cache;
|
||||
use OC\Files\Cache\CacheDependencies;
|
||||
use OC\Files\Search\SearchBinaryOperator;
|
||||
use OC\Files\Search\SearchComparison;
|
||||
use OCP\Files\Cache\ICache;
|
||||
use OCP\Files\Cache\ICacheEntry;
|
||||
use OCP\Files\Search\ISearchBinaryOperator;
|
||||
use OCP\Files\Search\ISearchComparison;
|
||||
@ -45,12 +47,12 @@ class CacheJail extends CacheWrapper {
|
||||
protected $root;
|
||||
protected $unjailedRoot;
|
||||
|
||||
/**
|
||||
* @param ?\OCP\Files\Cache\ICache $cache
|
||||
* @param string $root
|
||||
*/
|
||||
public function __construct($cache, $root) {
|
||||
parent::__construct($cache);
|
||||
public function __construct(
|
||||
?ICache $cache,
|
||||
string $root,
|
||||
CacheDependencies $dependencies = null,
|
||||
) {
|
||||
parent::__construct($cache, $dependencies);
|
||||
$this->root = $root;
|
||||
|
||||
if ($cache instanceof CacheJail) {
|
||||
|
@ -30,33 +30,31 @@
|
||||
namespace OC\Files\Cache\Wrapper;
|
||||
|
||||
use OC\Files\Cache\Cache;
|
||||
use OC\Files\Cache\QuerySearchHelper;
|
||||
use OC\Files\Cache\CacheDependencies;
|
||||
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 {
|
||||
/**
|
||||
* @var \OCP\Files\Cache\ICache
|
||||
* @var ?ICache
|
||||
*/
|
||||
protected $cache;
|
||||
|
||||
/**
|
||||
* @param \OCP\Files\Cache\ICache $cache
|
||||
*/
|
||||
public function __construct($cache) {
|
||||
public function __construct(?ICache $cache, CacheDependencies $dependencies = null) {
|
||||
$this->cache = $cache;
|
||||
if ($cache instanceof Cache) {
|
||||
if (!$dependencies && $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);
|
||||
if (!$dependencies) {
|
||||
$dependencies = \OC::$server->get(CacheDependencies::class);
|
||||
}
|
||||
$this->mimetypeLoader = $dependencies->getMimeTypeLoader();
|
||||
$this->connection = $dependencies->getConnection();
|
||||
$this->querySearchHelper = $dependencies->getQuerySearchHelper();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user