Skip to content

Commit

Permalink
Fixed civix code as per totten/civix#207
Browse files Browse the repository at this point in the history
  • Loading branch information
adixon committed Mar 18, 2021
1 parent 6aef38a commit 294bb1b
Showing 1 changed file with 1 addition and 27 deletions.
28 changes: 1 addition & 27 deletions iats.civix.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,40 +221,14 @@ function _iats_civix_upgrader() {
* Search directory tree for files which match a glob pattern.
*
* Note: Dot-directories (like "..", ".git", or ".svn") will be ignored.
* Note: In Civi 4.3+, delegate to CRM_Utils_File::findFiles()
*
* @param string $dir base dir
* @param string $pattern , glob pattern, eg "*.txt"
*
* @return array
*/
function _iats_civix_find_files($dir, $pattern) {
if (is_callable(['CRM_Utils_File', 'findFiles'])) {
return CRM_Utils_File::findFiles($dir, $pattern);
}

$todos = [$dir];
$result = [];
while (!empty($todos)) {
$subdir = array_shift($todos);
foreach (_iats_civix_glob("$subdir/$pattern") as $match) {
if (!is_dir($match)) {
$result[] = $match;
}
}
if ($dh = opendir($subdir)) {
while (FALSE !== ($entry = readdir($dh))) {
$path = $subdir . DIRECTORY_SEPARATOR . $entry;
if ($entry[0] == '.') {
}
elseif (is_dir($path)) {
$todos[] = $path;
}
}
closedir($dh);
}
}
return $result;
return CRM_Utils_File::findFiles($dir, $pattern);
}

/**
Expand Down

0 comments on commit 294bb1b

Please sign in to comment.