adding sort param to Folder::find() and findRecursive(), closes #1385

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5823 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2007-10-20 22:03:58 +00:00
parent cfc6a21316
commit 7a1ec65ee7

View file

@ -182,8 +182,8 @@ class Folder extends Object{
* @return array Files that match given pattern
* @access public
*/
function find($regexp_pattern = '.*') {
$data = $this->ls();
function find($regexp_pattern = '.*', $sort = false) {
$data = $this->read($sort, $exceptions);
if (!is_array($data)) {
return array();
@ -206,9 +206,9 @@ class Folder extends Object{
* @return array Files matching $pattern
* @access public
*/
function findRecursive($pattern = '.*') {
function findRecursive($pattern = '.*', $sort = false) {
$startsOn = $this->path;
$out = $this->_findRecursive($pattern);
$out = $this->_findRecursive($pattern, $sort);
$this->cd($startsOn);
return $out;
}
@ -219,8 +219,8 @@ class Folder extends Object{
* @return array Files matching pattern
* @access private
*/
function _findRecursive($pattern) {
list($dirs, $files) = $this->ls();
function _findRecursive($pattern, $sort = false) {
list($dirs, $files) = $this->read($sort, $exceptions);
$found = array();
foreach ($files as $file) {