diff --git a/src/_h5ai/private/php/core/class-context.php b/src/_h5ai/private/php/core/class-context.php index 5484f8f9c..076aca46a 100644 --- a/src/_h5ai/private/php/core/class-context.php +++ b/src/_h5ai/private/php/core/class-context.php @@ -183,7 +183,7 @@ public function get_items($href, $what) { $folder = Item::get($this, $this->to_path($href), $cache); // add content of subfolders - if ($what >= 2 && $folder !== null) { + if ($what >= 3 && $folder !== null) { foreach ($folder->get_content($cache) as $item) { $item->get_content($cache); } @@ -191,11 +191,16 @@ public function get_items($href, $what) { } // add content of this folder and all parent folders - while ($what >= 1 && $folder !== null) { + while ($what >= 2 && $folder !== null) { $folder->get_content($cache); $folder = $folder->get_parent($cache); } + // only add the requested folder (less fstat overhead) + if ($what == 1 && $folder !== null) { + $folder->get_content($cache); + } + uasort($cache, ['Item', 'cmp']); $result = []; foreach ($cache as $p => $item) {