Index: includes/update.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/update.inc,v
retrieving revision 1.77
diff -u -p -r1.77 update.inc
--- includes/update.inc	12 Oct 2010 02:50:03 -0000	1.77
+++ includes/update.inc	22 Oct 2010 02:34:38 -0000
@@ -86,21 +86,27 @@ function update_prepare_d7_bootstrap() {
   include_once DRUPAL_ROOT . '/includes/install.inc';
   drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
   global $databases, $db_url, $db_prefix, $update_rewrite_settings;
-  if (empty($databases) && !empty($db_url)) {
-    $databases = update_parse_db_url($db_url, $db_prefix);
-    // Record the fact that the settings.php file will need to be rewritten.
-    $update_rewrite_settings = TRUE;
+  if (empty($databases)) {
     $settings_file = conf_path() . '/settings.php';
-    $writable = drupal_verify_install_file($settings_file, FILE_EXIST|FILE_READABLE|FILE_WRITABLE);
-    $requirements = array(
-      'settings file' => array(
-        'title' => 'Settings file',
-        'value' => $writable ? 'The settings file is writable.' : 'The settings file is not writable.',
-        'severity' => $writable ? REQUIREMENT_OK : REQUIREMENT_ERROR,
-        'description' => $writable ? '' : 'Drupal requires write permissions to <em>' . $settings_file . '</em> during the update process. If you are unsure how to grant file permissions, consult the <a href="http://drupal.org/server-permissions">online handbook</a>.',
-      ),
-    );
-    update_extra_requirements($requirements);
+    if (!empty($db_url)) {
+      $databases = update_parse_db_url($db_url, $db_prefix);
+      // Record the fact that the settings.php file will need to be rewritten.
+      $update_rewrite_settings = TRUE;
+      $writable = drupal_verify_install_file($settings_file, FILE_EXIST|FILE_READABLE|FILE_WRITABLE);
+      $requirements = array(
+        'settings file' => array(
+          'title' => 'Settings file',
+          'value' => $writable ? 'The settings file is writable.' : 'The settings file is not writable.',
+          'severity' => $writable ? REQUIREMENT_OK : REQUIREMENT_ERROR,
+          'description' => $writable ? '' : 'Drupal requires write permissions to <em>' . $settings_file . '</em> during the update process. If you are unsure how to grant file permissions, consult the <a href="http://drupal.org/server-permissions">online handbook</a>.',
+        ),
+      );
+      update_extra_requirements($requirements);
+    }
+    else {
+      print 'There is no database connection information available in <em>' . $settings_file . '</em>. Follow the instructions in <a href="UPGRADE.txt">UPGRADE.txt</a> to proceed.';
+      exit();
+    }
   }
 
   // The new {blocked_ips} table is used in Drupal 7 to store a list of
@@ -125,7 +131,11 @@ function update_prepare_d7_bootstrap() {
     $pdo_link = 'http://drupal.org/requirements/pdo#pecl';
   }
   // Check that the correct driver is loaded for the database being updated.
-  elseif (!in_array($databases['default']['default']['driver'], PDO::getAvailableDrivers())) {
+  // If we have no driver information (for example, if someone tried to create
+  // the Drupal 7 $databases array themselves but did not do it correctly),
+  // this message will be confusing, so do not perform the check; instead, just
+  // let the database connection fail in the code that follows.
+  elseif (isset($databases['default']['default']['driver']) && !in_array($databases['default']['default']['driver'], PDO::getAvailableDrivers())) {
     $message = '<h2>A PDO database driver is required!</h2><p>You need to enable the PDO_' . strtoupper($databases['default']['default']['driver']) . ' database driver for PHP ' . DRUPAL_MINIMUM_PHP . ' or higher so that Drupal 7 can access the database.</p>';
   }
   if ($message) {
