aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2025-03-10 19:26:24 +0100
committerGitHub <noreply@github.com>2025-03-10 19:26:24 +0100
commit59cda8e9fb03143610b0afdd6eb32de403fc77fb (patch)
tree2e9fc2971b0c5f24e74412809df70bb888f78950
parenteb597917f6cf017bc9e5153eb5efb1308ccc5c68 (diff)
parent8edca98e8ed4ef7505f3416407a352253ce95a3b (diff)
downloadnextcloud-server-59cda8e9fb03143610b0afdd6eb32de403fc77fb.tar.gz
nextcloud-server-59cda8e9fb03143610b0afdd6eb32de403fc77fb.zip
Merge pull request #51296 from nextcloud/fileutils-files-by-user
fix: optimize FileUtils::getFilesByUser
-rw-r--r--core/Command/Info/FileUtils.php13
-rw-r--r--lib/private/Files/Node/Root.php4
2 files changed, 8 insertions, 9 deletions
diff --git a/core/Command/Info/FileUtils.php b/core/Command/Info/FileUtils.php
index df7dba175ba..5de5f5fcaa6 100644
--- a/core/Command/Info/FileUtils.php
+++ b/core/Command/Info/FileUtils.php
@@ -46,13 +46,12 @@ class FileUtils {
$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;
diff --git a/lib/private/Files/Node/Root.php b/lib/private/Files/Node/Root.php
index 1686051131d..d4ec241654b 100644
--- a/lib/private/Files/Node/Root.php
+++ b/lib/private/Files/Node/Root.php
@@ -522,9 +522,9 @@ class Root extends Folder implements IRootFolder {
$isDir = $info->getType() === FileInfo::TYPE_FOLDER;
$view = new View('');
if ($isDir) {
- return new Folder($this, $view, $path, $info, $parent);
+ return new Folder($this, $view, $fullPath, $info, $parent);
} else {
- return new File($this, $view, $path, $info, $parent);
+ return new File($this, $view, $fullPath, $info, $parent);
}
}
}