diff --git a/core/includes/common.inc b/core/includes/common.inc
index c6a29b7..cd65ec1 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -5047,6 +5047,10 @@ function _drupal_bootstrap_full() {
     drupal_theme_initialize();
     module_invoke_all('init');
   }
+  if (variable_get('registry_rebuild') && !defined('MAINTENANCE_MODE')) {
+    registry_rebuild();
+    variable_del('registry_rebuild');
+  }
 }
 
 /**
diff --git a/core/includes/update.inc b/core/includes/update.inc
index 289d27a..6b58c83 100644
--- a/core/includes/update.inc
+++ b/core/includes/update.inc
@@ -19,6 +19,61 @@
 const REQUIRED_D7_SCHEMA_VERSION = '7069';
 
 /**
+ * Rebuilds the registry without a full bootstrap.
+ *
+ * This function rebuilds the registry without a full bootstrap, and without
+ * invoking hook_boot() or hook_init(). This can be useful when the registry
+ * holds incorrect or incomplete information, which prevents Drupal from
+ * being able to bootstrap fully.
+ */
+function update_rebuild_registry() {
+  require_once DRUPAL_ROOT . '/core/includes/common.inc';
+  require_once DRUPAL_ROOT . '/core/includes/registry.inc';
+
+  $connection_info = Database::getConnectionInfo();
+  $driver = $connection_info['default']['driver'];
+  require_once DRUPAL_ROOT . '/core/includes/database/query.inc';
+  require_once DRUPAL_ROOT . '/core/includes/database/select.inc';
+  require_once DRUPAL_ROOT . '/core/includes/database/' . $driver . '/query.inc';
+
+  // Get current list of modules and their files.
+  $modules = db_query("SELECT * FROM {system} WHERE type = 'module' AND status = 1")->fetchAll();
+  // Get the list of files we are going to parse.
+  $files = array();
+  foreach ($modules as $module) {
+    $dir = dirname($module->filename);
+
+    // Store the module directory for use in hook_registry_files_alter().
+    $module->dir = $dir;
+    $module->info = drupal_parse_info_file($module->dir . '/' . $module->name . '.info');
+    if (isset($module->info['files'])) {
+      // Add files for enabled modules to the registry.
+      foreach ($module->info['files'] as $file) {
+        $files["$dir/$file"] = array('module' => $module->name, 'weight' => $module->weight);
+      }
+    }
+  }
+  foreach (new RecursiveDirectoryIterator(DRUPAL_ROOT . '/core/includes') as $file) {
+    $filename = $file->getPathname();
+    if (substr($filename, -4) == '.inc') {
+      $files[$filename] = array('module' => '', 'weight' => 0);
+    }
+  }
+
+  $transaction = db_transaction();
+  try {
+    db_truncate('registry')->execute();
+    db_truncate('registry_file')->execute();
+    _registry_parse_files($files);
+  }
+  catch (Exception $e) {
+    $transaction->rollback();
+    throw $e;
+  }
+  variable_set('registry_rebuild', TRUE);
+}
+
+/**
  * Disable any items in the {system} table that are not core compatible.
  */
 function update_fix_compatibility() {
diff --git a/core/update.php b/core/update.php
index dd338a2..bf074a4 100644
--- a/core/update.php
+++ b/core/update.php
@@ -392,6 +392,8 @@ if (empty($op) && update_access_allowed()) {
   // stage, since the real requirements check happens further down.
   update_check_requirements(TRUE);
 
+  update_rebuild_registry();
+
   // Redirect to the update information page if all requirements were met.
   install_goto('core/update.php?op=info');
 }
