diff options
author | Robin Appelman <robin@icewind.nl> | 2022-04-22 15:50:14 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2022-04-22 15:50:14 +0200 |
commit | 9f0ba3adc223987125c49367b4eeb7558b16e367 (patch) | |
tree | 7952820e88af91c43c0537f75386e1d81cf0d21a | |
parent | 9a76f06ecadf05ef1d26bd735df1bea0dfb15d59 (diff) | |
download | nextcloud-server-9f0ba3adc223987125c49367b4eeb7558b16e367.tar.gz nextcloud-server-9f0ba3adc223987125c49367b4eeb7558b16e367.zip |
optimize adding submount info to directory content
no need to loop when we can do a hashtable lookup
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r-- | lib/private/Files/View.php | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index 30dc5518be8..e49dc766c88 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -1517,10 +1517,8 @@ class View { if ($pos = strpos($relativePath, '/')) { //mountpoint inside subfolder add size to the correct folder $entryName = substr($relativePath, 0, $pos); - foreach ($files as &$entry) { - if ($entry->getName() === $entryName) { - $entry->addSubEntry($rootEntry, $mountPoint); - } + if (isset($files[$entryName])) { + $files[$entryName]->addSubEntry($rootEntry, $mountPoint); } } else { //mountpoint in this folder, add an entry for it $rootEntry['name'] = $relativePath; |