diff --git a/modules/system/system.module b/modules/system/system.module
index 7d423ab..13e9ae5 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -2264,6 +2264,7 @@ function system_update_files_database(&$files, $type) {
         'type' => $type,
         'owner' => isset($file->owner) ? $file->owner : '',
         'info' => serialize($file->info),
+        'weight' => isset($file->weight) ? $file->weight : 0,
       ));
       $file->type = $type;
       $file->status = 0;
@@ -2375,6 +2376,11 @@ function _system_rebuild_module_data() {
       $module->info['scripts'] = _system_info_add_path($module->info['scripts'], $path);
     }
 
+    // Take over static module weight, if defined.
+    if (isset($module->info['weight'])) {
+      $module->weight = (int) $module->info['weight'];
+    }
+
     // Install profiles are hidden by default, unless explicitly specified
     // otherwise in the .info file.
     if ($key == $profile && !isset($modules[$key]->info['hidden'])) {
