Skip to content
Merged
Changes from 1 commit
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
Next Next commit
fix: optimize FileUtils::getFilesByUser
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed Mar 10, 2025
commit c5dc90dde9703714c1cf70626be3d77ce7a43596
13 changes: 6 additions & 7 deletions core/Command/Info/FileUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,12 @@ public function getFilesByUser(FileInfo $file): array {

$mounts = $this->userMountCache->getMountsForFileId($id);
$result = [];
foreach ($mounts as $mount) {
if (isset($result[$mount->getUser()->getUID()])) {
continue;
}

$userFolder = $this->rootFolder->getUserFolder($mount->getUser()->getUID());
$result[$mount->getUser()->getUID()] = $userFolder->getById($id);
foreach ($mounts as $cachedMount) {
$mount = $this->rootFolder->getMount($cachedMount->getMountPoint());
$cache = $mount->getStorage()->getCache();
$cacheEntry = $cache->get($id);
$node = $this->rootFolder->getNodeFromCacheEntryAndMount($cacheEntry, $mount);
$result[$cachedMount->getUser()->getUID()][] = $node;
}

return $result;
Expand Down