The storage is not static anymore

Don't call twice $cache->getId

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
pull/30531/head
Carl Schwan 2022-01-07 17:55:02 +07:00
parent 1f392d666a
commit 0479fff37c
No known key found for this signature in database
GPG Key ID: 06B35D38387B67BE
1 changed files with 11 additions and 15 deletions

@ -140,22 +140,18 @@ class FileSystemTags implements ICheck, IFileCheck {
protected function getFileIds(ICache $cache, $path, $isExternalStorage) { protected function getFileIds(ICache $cache, $path, $isExternalStorage) {
/** @psalm-suppress InvalidArgument */ /** @psalm-suppress InvalidArgument */
if ($this->storage->instanceOfStorage(\OCA\GroupFolders\Mount\GroupFolderStorage::class)) { if ($this->storage->instanceOfStorage(\OCA\GroupFolders\Mount\GroupFolderStorage::class)) {
static $groupFolderStorage = null; // Special implementation for groupfolder since all groupfolders share the same storage
if ($groupFolderStorage === null) { // id so add the group folder id in the cache key too.
// Special implementation for groupfolder since all groupfolder chare the same storage $groupFolderStorage = $this->storage;
// so add the group folder id in the cache key too. $groupFolderStorageClass = \OCA\GroupFolders\Mount\GroupFolderStorage::class;
$groupFolderStorage = $this->storage; while ($groupFolderStorage->instanceOfStorage(Wrapper::class)) {
$groupFolderStoragClass = \OCA\GroupFolders\Mount\GroupFolderStorage::class; if ($groupFolderStorage instanceof $groupFolderStorageClass) {
while ($groupFolderStorage->instanceOfStorage(Wrapper::class)) { break;
if ($groupFolderStorage instanceof $groupFolderStoragClass) {
break;
}
/**
* @var Wrapper $sourceStorage
*/
$groupFolderStorage = $groupFolderStorage->getWrapperStorage();
} }
/** @var Wrapper $groupFolderStorage */
$groupFolderStorage = $groupFolderStorage->getWrapperStorage();
} }
/** @psalm-suppress UndefinedMethod */
$cacheId = $cache->getNumericStorageId() . '/' . $groupFolderStorage->getFolderId(); $cacheId = $cache->getNumericStorageId() . '/' . $groupFolderStorage->getFolderId();
} else { } else {
$cacheId = $cache->getNumericStorageId(); $cacheId = $cache->getNumericStorageId();
@ -173,7 +169,7 @@ class FileSystemTags implements ICheck, IFileCheck {
$fileId = $cache->getId($path); $fileId = $cache->getId($path);
if ($fileId !== -1) { if ($fileId !== -1) {
$parentIds[] = $cache->getId($path); $parentIds[] = $fileId;
} }
$this->fileIds[$cacheId][$path] = $parentIds; $this->fileIds[$cacheId][$path] = $parentIds;