Skip to content

Commit

Permalink
Merge branch 'fix_overhead'
Browse files Browse the repository at this point in the history
  • Loading branch information
glubsy committed Feb 9, 2021
2 parents 690d036 + ee707f5 commit d74d64a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/_h5ai/private/php/core/class-context.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,20 +192,25 @@ public function get_items($href, $what) {
$cache = [];
$folder = Item::get($this, $this->to_path($href), $cache);

// Add content of subfolders.
if ($what >= 2 && $folder !== null) {
// add content of subfolders
if ($what >= 3 && $folder !== null) {
foreach ($folder->get_content($cache) as $item) {
$item->get_content($cache);
}
$folder = $folder->get_parent($cache);
}

// Add content of this folder and all parent folders.
while ($what >= 1 && $folder !== null) {
// add content of this folder and all parent folders
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) {
Expand Down

0 comments on commit d74d64a

Please sign in to comment.