Index: install.php
===================================================================
RCS file: /cvs/drupal/drupal/install.php,v
retrieving revision 1.119
diff -u -p -r1.119 install.php
--- install.php	26 May 2008 17:12:54 -0000	1.119
+++ install.php	15 Jun 2008 03:40:16 -0000
@@ -416,7 +416,7 @@ function install_settings_form_submit($f
  * Find all .profile files.
  */
 function install_find_profiles() {
-  return file_scan_directory('./profiles', '\.profile$', array('.', '..', 'CVS'), 0, TRUE, 'name', 0);
+  return file_scan_directory('./profiles', '\.profile$', '(\.\.?|CVS)$', 0, TRUE, 'name', 0);
 }
 
 /**
@@ -483,7 +483,7 @@ function install_select_profile_form(&$f
  * Find all .po files for the current profile.
  */
 function install_find_locales($profilename) {
-  $locales = file_scan_directory('./profiles/' . $profilename . '/translations', '\.po$', array('.', '..', 'CVS'), 0, FALSE);
+  $locales = file_scan_directory('./profiles/' . $profilename . '/translations', '\.po$', '(\.\.?|CVS)$', 0, FALSE);
   array_unshift($locales, (object) array('name' => 'en'));
   return $locales;
 }
Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.771
diff -u -p -r1.771 common.inc
--- includes/common.inc	9 Jun 2008 08:11:44 -0000	1.771
+++ includes/common.inc	15 Jun 2008 03:40:17 -0000
@@ -1887,7 +1887,7 @@ function _drupal_load_stylesheet($matche
  * Delete all cached CSS files.
  */
 function drupal_clear_css_cache() {
-  file_scan_directory(file_create_path('css'), '.*', array('.', '..', 'CVS'), 'file_delete', TRUE);
+  file_scan_directory(file_create_path('css'), '.*', '(\.\.?|CVS)$', 'file_delete', TRUE);
 }
 
 /**
@@ -2255,7 +2255,7 @@ function drupal_build_js_cache($files, $
  * Delete all cached JS files.
  */
 function drupal_clear_js_cache() {
-  file_scan_directory(file_create_path('js'), '.*', array('.', '..', 'CVS'), 'file_delete', TRUE);
+  file_scan_directory(file_create_path('js'), '.*', '(\.\.?|CVS)$', 'file_delete', TRUE);
   variable_set('javascript_parsed', array());
 }
 
@@ -2623,7 +2623,7 @@ function drupal_system_listing($mask, $d
 
   // Get current list of items
   foreach ($searchdir as $dir) {
-    $files = array_merge($files, file_scan_directory($dir, $mask, array('.', '..', 'CVS'), 0, TRUE, $key, $min_depth));
+    $files = array_merge($files, file_scan_directory($dir, $mask, '(\.\.?|CVS)$', 0, TRUE, $key, $min_depth));
   }
 
   return $files;
Index: includes/file.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/file.inc,v
retrieving revision 1.125
diff -u -p -r1.125 file.inc
--- includes/file.inc	26 May 2008 17:12:54 -0000	1.125
+++ includes/file.inc	15 Jun 2008 03:40:17 -0000
@@ -896,7 +896,7 @@ function file_download() {
  * @param $mask
  *   The regular expression of the files to find.
  * @param $nomask
- *   An array of files/directories to ignore.
+ *   The regular expression of the files to ignore.
  * @param $callback
  *   The callback function to call for each match.
  * @param $recurse
@@ -917,13 +917,13 @@ function file_download() {
  *   "path", "basename", and "name" members corresponding to the
  *   matching files.
  */
-function file_scan_directory($dir, $mask, $nomask = array('.', '..', 'CVS'), $callback = 0, $recurse = TRUE, $key = 'filename', $min_depth = 0, $depth = 0) {
+function file_scan_directory($dir, $mask, $nomask = '(\.\.?|CVS)$', $callback = 0, $recurse = TRUE, $key = 'filename', $min_depth = 0, $depth = 0) {
   $key = (in_array($key, array('filename', 'basename', 'name')) ? $key : 'filename');
   $files = array();
 
   if (is_dir($dir) && $handle = opendir($dir)) {
     while (false !== ($file = readdir($handle))) {
-      if (!in_array($file, $nomask) && $file[0] != '.') {
+      if (!ereg($nomask, $file) && $file[0] != '.') {
         if (is_dir("$dir/$file") && $recurse) {
           // 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);
Index: includes/locale.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/locale.inc,v
retrieving revision 1.176
diff -u -p -r1.176 locale.inc
--- includes/locale.inc	26 May 2008 17:12:54 -0000	1.176
+++ includes/locale.inc	15 Jun 2008 03:40:17 -0000
@@ -2453,7 +2453,7 @@ function locale_batch_by_language($langc
     // with names ending with $langcode.po. This allows for filenames
     // like node-module.de.po to let translators use small files and
     // be able to import in smaller chunks.
-    $files = array_merge($files, file_scan_directory(dirname($component->filename) . '/translations', '(^|\.)' . $langcode . '\.po$', array('.', '..', 'CVS'), 0, FALSE));
+    $files = array_merge($files, file_scan_directory(dirname($component->filename) . '/translations', '(^|\.)' . $langcode . '\.po$', '(\.\.?|CVS)$', 0, FALSE));
     $components[] = $component->name;
   }
 
@@ -2485,7 +2485,7 @@ function locale_batch_by_component($comp
         // as $langcode.po or with names ending with $langcode.po. This allows
         // for filenames like node-module.de.po to let translators use small
         // files and be able to import in smaller chunks.
-        $files = array_merge($files, file_scan_directory(dirname($component->filename) . '/translations', '(^|\.)(' . $language_list . ')\.po$', array('.', '..', 'CVS'), 0, FALSE));
+        $files = array_merge($files, file_scan_directory(dirname($component->filename) . '/translations', '(^|\.)(' . $language_list . ')\.po$','(\.\.?|CVS)$' , 0, FALSE));
       }
     }
     return _locale_batch_build($files, $finished);
