Skip to content

Commit

Permalink
Switch to a recursive directory iterator for the file fetcher.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnbillion committed Mar 5, 2019
1 parent 72beadb commit 51a4706
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions inc/classes/iterator/files/class-base.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,14 @@ protected function get_files_in_path() {
}

if ( is_dir( $path_found ) ) {
$iterator = new \RecursiveIteratorIterator( new \RecursiveDirectoryIterator( $path_found ) );
$files = [];

$files = array_map( function( $item ) use ( $path_found ) {

return $path_found . '/' . $item;

}, scandir( $path_found ) );

foreach ( $iterator as $pointer ) {
if ( ! $pointer->isDir() ) {
$files[] = $pointer->getPathname();
}
}
} else {

$files = [ $path_found ];
Expand Down

0 comments on commit 51a4706

Please sign in to comment.