- Patch #91592 by ChrisKennedy: avoid scanning hidden files and directories.
parent
161a856ab8
commit
f6259ad36c
|
@ -602,8 +602,10 @@ function file_download() {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds all files that match a given mask in a given
|
* Finds all files that match a given mask in a given directory.
|
||||||
* directory.
|
* Directories and files beginning with a period are excluded; this
|
||||||
|
* prevents hidden files and directories (such as SVN working directories)
|
||||||
|
* from being scanned.
|
||||||
*
|
*
|
||||||
* @param $dir
|
* @param $dir
|
||||||
* The base directory for the scan.
|
* The base directory for the scan.
|
||||||
|
@ -637,7 +639,7 @@ function file_scan_directory($dir, $mask, $nomask = array('.', '..', 'CVS'), $ca
|
||||||
|
|
||||||
if (is_dir($dir) && $handle = opendir($dir)) {
|
if (is_dir($dir) && $handle = opendir($dir)) {
|
||||||
while ($file = readdir($handle)) {
|
while ($file = readdir($handle)) {
|
||||||
if (!in_array($file, $nomask)) {
|
if (!in_array($file, $nomask) && $file[0] != '.') {
|
||||||
if (is_dir("$dir/$file") && $recurse) {
|
if (is_dir("$dir/$file") && $recurse) {
|
||||||
$files = array_merge($files, file_scan_directory("$dir/$file", $mask, $nomask, $callback, $recurse, $key, $min_depth, $depth + 1));
|
$files = array_merge($files, file_scan_directory("$dir/$file", $mask, $nomask, $callback, $recurse, $key, $min_depth, $depth + 1));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue