Index: includes/module.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/module.inc,v
retrieving revision 1.139
diff -u -p -r1.139 module.inc
--- includes/module.inc	22 Feb 2009 17:55:29 -0000	1.139
+++ includes/module.inc	28 Mar 2009 22:38:14 -0000
@@ -97,6 +97,7 @@ function module_rebuild_cache() {
     'description' => '',
     'package' => 'Other',
     'version' => NULL,
+    'weight' => 0,
     'php' => DRUPAL_MINIMUM_PHP,
     'files' => array(),
   );
@@ -123,7 +124,8 @@ function module_rebuild_cache() {
         ->fields(array(
             'info' => serialize($files[$filepath]->info),
             'name' => $file->name,
-            'filename' => $file->filepath))
+            'filename' => $file->filepath,
+            'weight' => $file->info['weight']))
         ->condition('filename', $file->old_filepath)
         ->execute();
     }
@@ -136,6 +138,7 @@ function module_rebuild_cache() {
             'info' => serialize($files[$filepath]->info),
             'type' => 'module',
             'filename' => $file->filepath,
+            'weight' => $file->info['weight'],
             'status' => 0))
         ->execute();
     }
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.676
diff -u -p -r1.676 system.module
--- modules/system/system.module	25 Mar 2009 18:40:50 -0000	1.676
+++ modules/system/system.module	28 Mar 2009 22:38:19 -0000
@@ -1133,6 +1133,7 @@ function system_theme_default() {
     'scripts' => array('script.js'),
     'screenshot' => 'screenshot.png',
     'php' => DRUPAL_MINIMUM_PHP,
+    'weight' => 0,
   );
 }
 
@@ -1156,7 +1157,7 @@ function system_theme_data() {
       $theme->owner = '';
     }
 
-    db_query("INSERT INTO {system} (name, owner, info, type, filename, status) VALUES ('%s', '%s', '%s', '%s', '%s', %d)", $theme->name, $theme->owner, serialize($theme->info), 'theme', $theme->filename, isset($theme->status) ? $theme->status : 0);
+    db_query("INSERT INTO {system} (name, owner, info, type, filename, status, weight) VALUES ('%s', '%s', '%s', '%s', '%s', %d, %d)", $theme->name, $theme->owner, serialize($theme->info), 'theme', $theme->filename, isset($theme->status) ? $theme->status : 0, $theme->info['weight']);
   }
 
   return $themes;
