Skip to content

Commit

Permalink
Adding fix from davidpersson: sort not working for subdirectories in …
Browse files Browse the repository at this point in the history
…Folder::findRecursive

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8102 3807eeeb-6ff5-0310-8944-8be069107fe0
  • Loading branch information
phpnut committed Mar 15, 2009
1 parent e89bc0b commit 3748987
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cake/libs/folder.php
Expand Up @@ -212,17 +212,18 @@ function findRecursive($pattern = '.*', $sort = false) {
*/
function _findRecursive($pattern, $sort = false) {
list($dirs, $files) = $this->read($sort);

$found = array();

foreach ($files as $file) {
if (preg_match('/^' . $pattern . '$/i', $file)) {
$found[] = Folder::addPathElement($this->path, $file);
}
}
$start = $this->path;

foreach ($dirs as $dir) {
$this->cd(Folder::addPathElement($start, $dir));
$found = array_merge($found, $this->findRecursive($pattern));
$found = array_merge($found, $this->findRecursive($pattern, $sort));
}
return $found;
}
Expand Down

0 comments on commit 3748987

Please sign in to comment.