diff options
author | Robin Appelman <robin@icewind.nl> | 2023-02-08 14:34:40 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2023-02-09 11:39:00 +0100 |
commit | 5bcf37b7ffacba181212956eac85910f095adf07 (patch) | |
tree | 7a444c6bd64bdceb34420fcc1c67a3bcba41e25c /lib/private/Files/View.php | |
parent | 7341d339eb7a1aa20c6b35e8edb40c1cd7946b96 (diff) | |
download | nextcloud-server-5bcf37b7ffacba181212956eac85910f095adf07.tar.gz nextcloud-server-5bcf37b7ffacba181212956eac85910f095adf07.zip |
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 <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files/View.php')
-rw-r--r-- | lib/private/Files/View.php | 17 |
1 files changed, 12 insertions, 5 deletions
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); } } @@ -1429,6 +1425,17 @@ class View { } /** + * 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 * * @param string $directory path under datadirectory |