? .DS_Store
? sites/.DS_Store
? sites/all/.DS_Store
? sites/all/modules/.DS_Store
? sites/default/.DS_Store
? sites/default/files
? sites/default/private
? sites/default/settings.php
Index: includes/bootstrap.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v
retrieving revision 1.415
diff -u -p -r1.415 bootstrap.inc
--- includes/bootstrap.inc	17 Aug 2010 13:50:52 -0000	1.415
+++ includes/bootstrap.inc	23 Aug 2010 12:11:30 -0000
@@ -3025,3 +3025,46 @@ function _drupal_shutdown_function() {
     }
   }
 }
+
+
+/**
+ * Load required javascript and stylesheets for all enabled modules.
+ */
+function _module_load_attached() {
+  $_modules_attached_files = _module_load_attach_cache();
+  $final_stylesheets = array();
+  $final_scripts = array();
+
+  foreach ($_modules_attached_files as $module => $attached) {
+    // Add stylesheets used by this theme.
+    if (!empty($attached['stylesheets'])) {
+      foreach ($attached['stylesheets'] as $media => $stylesheets) {
+        foreach ($stylesheets as $name => $stylesheet) {
+          $final_stylesheets[$media][$name] = $stylesheet;
+        }
+      }
+    }
+
+    // And now add the stylesheets properly
+    foreach ($final_stylesheets as $media => $stylesheets) {
+      foreach ($stylesheets as $stylesheet) {
+        drupal_add_css($stylesheet, array('weight' => JS_DEFAULT, 'media' => $media, 'preprocess' => TRUE));
+      }
+    }
+
+    // Do basically the same as the above for scripts
+    $final_scripts = array();
+
+    // Add scripts used by this theme.
+    if (!empty($attached['scripts'])) {
+      foreach ($attached['scripts'] as $name => $script) {
+        $final_scripts[$name] = $script;
+      }
+    }
+
+    // Add scripts used by this theme.
+    foreach ($final_scripts as $script) {
+      drupal_add_js($script, array('weight' => JS_DEFAULT, 'preprocess' => TRUE));
+    }
+  }
+}
Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.1209
diff -u -p -r1.1209 common.inc
--- includes/common.inc	20 Aug 2010 01:17:51 -0000	1.1209
+++ includes/common.inc	23 Aug 2010 12:11:31 -0000
@@ -4601,6 +4601,9 @@ function _drupal_bootstrap_full() {
   if (!defined('MAINTENANCE_MODE') || MAINTENANCE_MODE != 'update') {
     module_invoke_all('init');
   }
+
+  // Load required javascript and stylesheets for all enabled modules.
+  _module_load_attached();
 }
 
 /**
Index: includes/module.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/module.inc,v
retrieving revision 1.197
diff -u -p -r1.197 module.inc
--- includes/module.inc	28 Jul 2010 01:46:59 -0000	1.197
+++ includes/module.inc	23 Aug 2010 12:11:31 -0000
@@ -934,3 +934,15 @@ function drupal_alter($type, &$data, &$c
   }
 }
 
+/**
+ *
+ */
+function _module_load_attach_cache() {
+  static $_modules_attached_files;
+
+  if (!isset($_modules_attached_files)) {
+    $cache = cache_get('modules_attached_files');
+    $_modules_attached_files = ($cache->data ? $cache->data : array());
+  }
+  return $_modules_attached_files;
+}
\ No newline at end of file
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.956
diff -u -p -r1.956 system.module
--- modules/system/system.module	22 Aug 2010 11:04:09 -0000	1.956
+++ modules/system/system.module	23 Aug 2010 12:11:32 -0000
@@ -2257,6 +2257,8 @@ function _system_rebuild_module_data() {
   $modules[$profile]->uri = 'profiles/' . $profile . '/' . $profile . '.profile';
   $modules[$profile]->filename = $profile . '.profile';
 
+  $modules_attached_files = array();
+
   // Install profile hooks are always executed last.
   $modules[$profile]->weight = 1000;
 
@@ -2300,7 +2302,33 @@ function _system_rebuild_module_data() {
     // modify the data in the .info files if necessary.
     $type = 'module';
     drupal_alter('system_info', $modules[$key]->info, $modules[$key], $type);
+
+    // Give the stylesheets proper path information.
+    $pathed_stylesheets = array();
+    if (isset($modules[$key]->info['stylesheets'])) {
+      foreach ($modules[$key]->info['stylesheets'] as $group => $stylesheets) {
+        foreach ($stylesheets as $stylesheet) {
+          $pathed_stylesheets[$group][$stylesheet] = dirname($modules[$key]->uri) . '/' . $stylesheet;
+        }
+      }
+    }
+    $modules[$key]->info['stylesheets'] = $pathed_stylesheets;
+
+    // Give the scripts proper path information.
+    $scripts = array();
+    if (isset($modules[$key]->info['scripts'])) {
+      foreach ($modules[$key]->info['scripts'] as $script) {
+        $scripts[$script] = dirname($modules[$key]->uri) . '/' . $script;
+      }
+    }
+    $modules[$key]->info['scripts'] = $scripts;
+
+    if (!empty($pathed_stylesheets) && !empty($scripts)) {
+      $modules_attached_files[$key] = array('stylesheets' => $pathed_stylesheets, 'scripts' => $scripts);
+    }
   }
+  // Cache the attached js and css so the files can be fastly loaded loading modules during bootstrap.
+  cache_set('modules_attached_files', $modules_attached_files);
 
   // The install profile is required, if it's a valid module.
   if (isset($modules[$profile])) {
