Skip to content
Snippets Groups Projects
Unverified Commit aa0536b5 authored by Joas Schilling's avatar Joas Schilling Committed by GitHub
Browse files

Merge pull request #46409 from nextcloud/backport/46388/stable26

[stable26] fix(workflows): Fix file systemtag cache
parents 43fa5b6c fabea788
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,7 @@
*/
namespace OCA\WorkflowEngine\Check;
use OC\Files\Storage\Wrapper\Jail;
use OCA\Files_Sharing\SharedStorage;
use OCA\WorkflowEngine\Entity\File;
use OCP\Files\Cache\ICache;
......@@ -39,7 +40,6 @@ use OCP\SystemTag\ISystemTagObjectMapper;
use OCP\SystemTag\TagNotFoundException;
use OCP\WorkflowEngine\ICheck;
use OCP\WorkflowEngine\IFileCheck;
use OC\Files\Storage\Wrapper\Wrapper;
class FileSystemTags implements ICheck, IFileCheck {
use TFileCheck;
......@@ -154,27 +154,15 @@ class FileSystemTags implements ICheck, IFileCheck {
* @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();
} else {
$cacheId = $cache->getNumericStorageId();
if ($this->storage->instanceOfStorage(Jail::class)) {
$absolutePath = $this->storage->getUnjailedPath($path);
} else {
$absolutePath = $path;
}
if (isset($this->fileIds[$cacheId][$path])) {
return $this->fileIds[$cacheId][$path];
if (isset($this->fileIds[$cacheId][$absolutePath])) {
return $this->fileIds[$cacheId][$absolutePath];
}
$parentIds = [];
......@@ -189,7 +177,7 @@ class FileSystemTags implements ICheck, IFileCheck {
$parentIds[] = $fileId;
}
$this->fileIds[$cacheId][$path] = $parentIds;
$this->fileIds[$cacheId][$absolutePath] = $parentIds;
return $parentIds;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment