bug #15803 [Finder] Exclude files based on path before applying the sorting (stof)
This PR was merged into the 2.3 branch.
Discussion
----------
[Finder] Exclude files based on path before applying the sorting
| Q | A
| ------------- | ---
| Bug fix? | yes (perf)
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
Sorting can be slow, so it is best to applied it after all filtering rules are applied instead of using a bigger list and filtering again after that.
This impacts only people using both the sorting and the name filtering (with ``->names()`` or ``notNames()``)
Commits
-------
e5bf0ab
Exclude files based on path before applying the sorting
This commit is contained in:
commit
306d88a1e3
@ -68,15 +68,15 @@ class PhpAdapter extends AbstractAdapter
|
|||||||
$iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
|
$iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->paths || $this->notPaths) {
|
||||||
|
$iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->sort) {
|
if ($this->sort) {
|
||||||
$iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
|
$iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
|
||||||
$iterator = $iteratorAggregate->getIterator();
|
$iterator = $iteratorAggregate->getIterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->paths || $this->notPaths) {
|
|
||||||
$iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $iterator;
|
return $iterator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user