Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/files_sharing/lib/MountProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ public function getMountsFromSuperShares(
$newMaxValidatedShare = $maxValidatedShare;
$appConfig = Server::get(IAppConfig::class);
$cacheDependencies = Server::get(CacheDependencies::class);
$storagesCache = (Server::get(ICacheFactory::class))->createInMemory();

foreach ($superShares as $share) {
[$parentShare, $groupedShares] = $share;
Expand Down Expand Up @@ -293,6 +294,7 @@ public function getMountsFromSuperShares(
'shareManager' => $this->shareManager,
'appConfig' => $appConfig,
'cacheDependencies' => $cacheDependencies,
'storagesCache' => $storagesCache,
],
$loader,
$this->eventDispatcher,
Expand Down
19 changes: 19 additions & 0 deletions apps/files_sharing/lib/SharedStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,15 @@ class SharedStorage extends Jail implements LegacyISharedStorage, ISharedStorage
private static int $initDepth = 0;
private CacheDependencies $cacheDependencies;

private ?\OCP\ICache $storagesCache;

public function __construct(array $parameters) {
$this->ownerView = $parameters['ownerView'];
$this->logger = $parameters['logger'] ?? Server::get(LoggerInterface::class);
$this->appConfig = $parameters['appConfig'] ?? Server::get(IAppConfig::class);
$this->shareManager = $parameters['shareManager'] ?? Server::get(IShareManager::class);
$this->cacheDependencies = $parameters['cacheDependencies'] ?? Server::get(CacheDependencies::class);
$this->storagesCache = $parameters['storagesCache'] ?? null;

$this->superShare = $parameters['superShare'];
$this->groupedShares = $parameters['groupedShares'];
Expand Down Expand Up @@ -160,6 +163,21 @@ private function init() {
throw new \Exception('Maximum share depth reached');
}

$storageId = $this->superShare->getNodeCacheEntry()?->getStorageId();
if ($storageId !== null) {
/** @var IStorage $cachedStorage */
$cachedStorage = $this->storagesCache?->get((string)$storageId);
if ($cachedStorage !== null) {
$this->nonMaskedStorage = $cachedStorage;
$this->storage = new PermissionsMask([
'storage' => $cachedStorage,
'mask' => $this->superShare->getPermissions(),
]);
self::$initDepth--;
return;
}
}

/** @var IRootFolder $rootFolder */
$rootFolder = Server::get(IRootFolder::class);
$this->ownerUserFolder = $rootFolder->getUserFolder($this->superShare->getShareOwner());
Expand Down Expand Up @@ -192,6 +210,7 @@ private function init() {
'storage' => $this->nonMaskedStorage,
'mask' => $this->superShare->getPermissions(),
]);
$this->storagesCache?->set((string)$this->nonMaskedStorage->getCache()->getNumericStorageId(), $this->nonMaskedStorage);
}
} catch (NotFoundException $e) {
// original file not accessible or deleted, set FailedStorage
Expand Down
Loading