summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2006-12-11 16:45:17 +0000
committerDries Buytaert <dries@buytaert.net>2006-12-11 16:45:17 +0000
commitf6259ad36c8644be8895c9779755df7b3b2d006c (patch)
treeae41a8658f7a2bc0ec58e63ae736a3ce1fef1071 /includes
parent161a856ab8a4b1e50fcf0f3da3eca0875ca3ee20 (diff)
downloadbrdo-f6259ad36c8644be8895c9779755df7b3b2d006c.tar.gz
brdo-f6259ad36c8644be8895c9779755df7b3b2d006c.tar.bz2
- Patch #91592 by ChrisKennedy: avoid scanning hidden files and directories.
Diffstat (limited to 'includes')
-rw-r--r--includes/file.inc8
1 files changed, 5 insertions, 3 deletions
diff --git a/includes/file.inc b/includes/file.inc
index a6702cac8..b24076b1f 100644
--- a/includes/file.inc
+++ b/includes/file.inc
@@ -602,8 +602,10 @@ function file_download() {
/**
- * Finds all files that match a given mask in a given
- * directory.
+ * Finds all files that match a given mask in a given 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
* 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)) {
while ($file = readdir($handle)) {
- if (!in_array($file, $nomask)) {
+ if (!in_array($file, $nomask) && $file[0] != '.') {
if (is_dir("$dir/$file") && $recurse) {
$files = array_merge($files, file_scan_directory("$dir/$file", $mask, $nomask, $callback, $recurse, $key, $min_depth, $depth + 1));
}