]> source.dussan.org Git - nextcloud-server.git/commitdiff
optimize adding submount info to directory content 32079/head
authorRobin Appelman <robin@icewind.nl>
Fri, 22 Apr 2022 13:50:14 +0000 (15:50 +0200)
committerRobin Appelman <robin@icewind.nl>
Fri, 22 Apr 2022 13:50:14 +0000 (15:50 +0200)
no need to loop when we can do a hashtable lookup

Signed-off-by: Robin Appelman <robin@icewind.nl>
lib/private/Files/View.php

index 30dc5518be8730d5e3e367c696645db8059e3f4f..e49dc766c8840f0282aa2016186f8eed4e698244 100644 (file)
@@ -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;