Commit bc12477e authored by Gábor Hojtsy's avatar Gábor Hojtsy
Browse files

#173664 by fractile81: fix order of precedence in file_scan_directory(), so...

#173664 by fractile81: fix order of precedence in file_scan_directory(), so subtheme files will really override parent theme files
parent d1c46ead
......@@ -887,9 +887,11 @@ function file_scan_directory($dir, $mask, $nomask = array('.', '..', 'CVS'), $ca
while ($file = readdir($handle)) {
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));
// Give priority to files in this folder by merging them in after any subdirectory files.
$files = array_merge(file_scan_directory("$dir/$file", $mask, $nomask, $callback, $recurse, $key, $min_depth, $depth + 1), $files);
}
elseif ($depth >= $min_depth && ereg($mask, $file)) {
// Always use this match over anything already set in $files with the same $$key.
$filename = "$dir/$file";
$basename = basename($file);
$name = substr($basename, 0, strrpos($basename, '.'));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment