Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(workflows): Fix file systemtag cache #46388

Merged
merged 1 commit into from
Jul 10, 2024
Merged
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
30 changes: 9 additions & 21 deletions apps/workflowengine/lib/Check/FileSystemTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
namespace OCA\WorkflowEngine\Check;

use OC\Files\Storage\Wrapper\Wrapper;
use OC\Files\Storage\Wrapper\Jail;
use OCA\Files_Sharing\SharedStorage;
use OCA\WorkflowEngine\Entity\File;
use OCP\Files\Cache\ICache;
Expand Down Expand Up @@ -133,27 +133,15 @@ protected function getSystemTags() {
* @return int[]
*/
protected function getFileIds(ICache $cache, $path, $isExternalStorage) {
/** @psalm-suppress InvalidArgument */
if ($this->storage->instanceOfStorage(\OCA\GroupFolders\Mount\GroupFolderStorage::class)) {
// Special implementation for groupfolder since all groupfolders share the same storage
// id so add the group folder id in the cache key too.
$groupFolderStorage = $this->storage;
if ($this->storage instanceof Wrapper) {
$groupFolderStorage = $this->storage->getInstanceOfStorage(\OCA\GroupFolders\Mount\GroupFolderStorage::class);
}
if ($groupFolderStorage === null) {
throw new \LogicException('Should not happen: Storage is instance of GroupFolderStorage but no group folder storage found while unwrapping.');
}
/**
* @psalm-suppress UndefinedDocblockClass
* @psalm-suppress UndefinedInterfaceMethod
*/
$cacheId = $cache->getNumericStorageId() . '/' . $groupFolderStorage->getFolderId();
$cacheId = $cache->getNumericStorageId();
if ($this->storage->instanceOfStorage(Jail::class)) {
$absolutePath = $this->storage->getUnjailedPath($path);
} else {
$cacheId = $cache->getNumericStorageId();
$absolutePath = $path;
}
if (isset($this->fileIds[$cacheId][$path])) {
return $this->fileIds[$cacheId][$path];

if (isset($this->fileIds[$cacheId][$absolutePath])) {
Fixed Show fixed Hide fixed
return $this->fileIds[$cacheId][$absolutePath];
Fixed Show fixed Hide fixed
}

$parentIds = [];
Expand All @@ -168,7 +156,7 @@ protected function getFileIds(ICache $cache, $path, $isExternalStorage) {
$parentIds[] = $fileId;
}

$this->fileIds[$cacheId][$path] = $parentIds;
$this->fileIds[$cacheId][$absolutePath] = $parentIds;
Fixed Show fixed Hide fixed

return $parentIds;
}
Expand Down
Loading