Index: includes/module.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/module.inc,v
retrieving revision 1.167
diff -u -p -r1.167 module.inc
--- includes/module.inc	8 Nov 2009 09:31:10 -0000	1.167
+++ includes/module.inc	8 Nov 2009 18:32:24 -0000
@@ -63,11 +63,9 @@ function module_list($refresh = FALSE, $
       }
     }
     else {
-      // The module name (rather than the filename) is used as the fallback
-      // weighting in order to guarantee consistent behavior across different
-      // Drupal installations, which might have modules installed in different
-      // locations in the file system. The ordering here must also be
-      // consistent with the one used in module_implements().
+      // As this is the $refresh case, make sure that system_list() returns
+      // fresh data.
+      drupal_static_reset('system_list');
       if ($bootstrap) {
         $list = system_list('bootstrap');
       }
@@ -104,6 +102,11 @@ function system_list($type) {
 
   if (!isset($lists)) {
     $lists = array('bootstrap' => array(), 'module' => array(), 'theme' => array());
+    // The module name (rather than the filename) is used as the fallback
+    // weighting in order to guarantee consistent behavior across different
+    // Drupal installations, which might have modules installed in different
+    // locations in the file system. The ordering here must also be
+    // consistent with the one used in module_implements().
     $result = db_query("SELECT * FROM {system} WHERE status = 1 ORDER BY weight ASC, name ASC");
     foreach ($result as $record) {
       // Build a list of all enabled modules.
