From 5bcf37b7ffacba181212956eac85910f095adf07 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 8 Feb 2023 14:34:40 +0100 Subject: only fetch the data for mounts inside a folder when needed for most operations we don't actually care about any mounts inside a folder, only for metadata that needs to propagate across storage boundaries (size, etag, mtime) do we need all the submount info. By only loading this data when needed we can save a bunch of storage setup in a number of cases Signed-off-by: Robin Appelman --- lib/private/Files/View.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'lib/private/Files/View.php') diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index f79a992c773..456f804ee56 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -1412,11 +1412,7 @@ class View { if ($includeMountPoints and $data['mimetype'] === 'httpd/unix-directory') { //add the sizes of other mount points to the folder $extOnly = ($includeMountPoints === 'ext'); - $mounts = Filesystem::getMountManager()->findIn($path); - $info->setSubMounts(array_filter($mounts, function (IMountPoint $mount) use ($extOnly) { - $subStorage = $mount->getStorage(); - return !($extOnly && $subStorage instanceof \OCA\Files_Sharing\SharedStorage); - })); + $this->addSubMounts($info, $extOnly); } } @@ -1428,6 +1424,17 @@ class View { return false; } + /** + * Extend a FileInfo that was previously requested with `$includeMountPoints = false` to include the sub mounts + */ + public function addSubMounts(FileInfo $info, $extOnly = false): void { + $mounts = Filesystem::getMountManager()->findIn($info->getPath()); + $info->setSubMounts(array_filter($mounts, function (IMountPoint $mount) use ($extOnly) { + $subStorage = $mount->getStorage(); + return !($extOnly && $subStorage instanceof \OCA\Files_Sharing\SharedStorage); + })); + } + /** * get the content of a directory * -- cgit v1.2.3