Merge pull request #28833 from nextcloud/backport/28774/stable20

[stable20] Do not cache file ids in FileSystemTags inside group folders
This commit is contained in:
John Molakvoæ 2021-09-14 18:07:01 +02:00 committed by GitHub
commit 607bdfd36d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View file

@ -127,8 +127,13 @@ class FileSystemTags implements ICheck, IFileCheck {
* @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];
}
@ -144,7 +149,9 @@ class FileSystemTags implements ICheck, IFileCheck {
$parentIds[] = $cache->getId($path);
}
$this->fileIds[$cacheId][$path] = $parentIds;
if ($shouldCacheFileIds) {
$this->fileIds[$cacheId][$path] = $parentIds;
}
return $parentIds;
}

View file

@ -46,6 +46,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 -->