Adding fix from davidpersson: sort not working for subdirectories in Folder::findRecursive

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8102 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2009-03-15 00:21:28 +00:00
parent e89bc0be10
commit 3748987599

View file

@ -212,17 +212,18 @@ class Folder extends Object {
*/
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;
}