--- C:/Dokumente und Einstellungen/alexander.schroeder/Desktop/speedup/drupal-6.8/includes/file.inc	Mon Oct 20 10:42:31 2008
+++ C:/Dokumente und Einstellungen/alexander.schroeder/Desktop/speedup/drupal-6.8/includes/Kopie von file.inc	Fri Dec 19 11:50:38 2008
@@ -848,6 +848,15 @@
   return drupal_not_found();
 }
 
+function cached_is_dir($dir)
+{
+    global $file_inc__is_dir_cache;
+    if (!isset($file_inc__is_dir_cache[$dir]))
+    {
+        $file_inc__is_dir_cache[$dir]=is_dir($dir);
+    }
+    return $file_inc__is_dir_cache[$dir];
+}
 
 /**
  * Finds all files that match a given mask in a given directory.
@@ -885,10 +894,10 @@
   $key = (in_array($key, array('filename', 'basename', 'name')) ? $key : 'filename');
   $files = array();
 
-  if (is_dir($dir) && $handle = opendir($dir)) {
+  if (cached_is_dir($dir) && $handle = opendir($dir)) {
     while (FALSE !== ($file = readdir($handle))) {
       if (!in_array($file, $nomask) && $file[0] != '.') {
-        if (is_dir("$dir/$file") && $recurse) {
+        if (cached_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);
         }
