Skip to content

Commit

Permalink
Merge pull request #28831 from nextcloud/backport/28774/stable21
Browse files Browse the repository at this point in the history
[stable21] Do not cache file ids in FileSystemTags inside group folders
  • Loading branch information
skjnldsv authored Sep 14, 2021
2 parents f26939b + 9983b14 commit 23c9afe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
11 changes: 9 additions & 2 deletions apps/workflowengine/lib/Check/FileSystemTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,13 @@ protected function getSystemTags() {
* @return int[]
*/
protected function getFileIds(ICache $cache, $path, $isExternalStorage) {
// TODO: Fix caching inside group folders
// Do not cache file ids inside group folders because multiple file ids might be mapped to
// the same combination of cache id + path.
$shouldCacheFileIds = !$this->storage
->instanceOfStorage(\OCA\GroupFolders\Mount\GroupFolderStorage::class);
$cacheId = $cache->getNumericStorageId();
if (isset($this->fileIds[$cacheId][$path])) {
if ($shouldCacheFileIds && isset($this->fileIds[$cacheId][$path])) {
return $this->fileIds[$cacheId][$path];
}

Expand All @@ -144,7 +149,9 @@ protected function getFileIds(ICache $cache, $path, $isExternalStorage) {
$parentIds[] = $cache->getId($path);
}

$this->fileIds[$cacheId][$path] = $parentIds;
if ($shouldCacheFileIds) {
$this->fileIds[$cacheId][$path] = $parentIds;
}

return $parentIds;
}
Expand Down
5 changes: 5 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@
<file name="build/stubs/xsl.php"/>
</stubs>
<issueHandlers>
<UndefinedClass>
<errorLevel type="suppress">
<referencedClass name="OCA\GroupFolders\Mount\GroupFolderStorage"/>
</errorLevel>
</UndefinedClass>
<UndefinedFunction>
<errorLevel type="suppress">
<!-- template functions: https://github.com/nextcloud/server/blob/6e8e34fef920a073118c22111f0f31eb3b3a91dc/lib/private/legacy/template/functions.php -->
Expand Down

0 comments on commit 23c9afe

Please sign in to comment.