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>
This commit is contained in:
Robin Appelman 2022-04-22 15:50:14 +02:00
parent 9a76f06eca
commit 9f0ba3adc2
No known key found for this signature in database
GPG key ID: 42B69D8A64526EFB

View 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;