Index: includes/bootstrap.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v
retrieving revision 1.378
diff -u -p -r1.378 bootstrap.inc
--- includes/bootstrap.inc	26 Apr 2010 21:27:09 -0000	1.378
+++ includes/bootstrap.inc	27 Apr 2010 01:03:41 -0000
@@ -1958,6 +1958,15 @@ function _drupal_bootstrap_database() {
     header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
     exit;
   }
+
+  // Redirect the user to the installation script if Drupal has not been
+  // installed yet (i.e., if no $databases array has been defined in the
+  // settings.php file) and we are not already installing.
+  if (empty($GLOBALS['databases']) && !drupal_installation_attempted()) {
+    include_once DRUPAL_ROOT . '/includes/install.inc';
+    install_goto('install.php');
+  }
+
   // Initialize the database system. Note that the connection
   // won't be initialized until it is actually requested.
   require_once DRUPAL_ROOT . '/includes/database/database.inc';
Index: includes/database/database.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/database/database.inc,v
retrieving revision 1.119
diff -u -p -r1.119 database.inc
--- includes/database/database.inc	26 Apr 2010 14:12:59 -0000	1.119
+++ includes/database/database.inc	27 Apr 2010 01:03:42 -0000
@@ -559,7 +559,6 @@ abstract class DatabaseConnection extend
       }
     }
     catch (PDOException $e) {
-      _db_check_install_needed();
       if ($options['throw_exception']) {
         // Add additional debug information.
         if ($query instanceof DatabaseStatementInterface) {
@@ -1408,8 +1407,6 @@ abstract class Database {
   final public static function parseConnectionInfo() {
     global $databases;
 
-    _db_check_install_needed();
-
     $database_info = is_array($databases) ? $databases : array();
     foreach ($database_info as $index => $info) {
       foreach ($database_info[$index] as $target => $value) {
@@ -1496,46 +1493,38 @@ abstract class Database {
     if (empty(self::$databaseInfo)) {
       self::parseConnectionInfo();
     }
-    try {
-      // If the requested database does not exist then it is an unrecoverable
-      // error.
-      if (!isset(self::$databaseInfo[$key])) {
-        throw new DatabaseConnectionNotDefinedException('The specified database connection is not defined: ' . $key);
-      }
 
-      if (!$driver = self::$databaseInfo[$key][$target]['driver']) {
-        throw new DatabaseDriverNotSpecifiedException('Driver not specified for this database connection: ' . $key);
-      }
+    // If the requested database does not exist then it is an unrecoverable
+    // error.
+    if (!isset(self::$databaseInfo[$key])) {
+      throw new DatabaseConnectionNotDefinedException('The specified database connection is not defined: ' . $key);
+    }
 
-      // We cannot rely on the registry yet, because the registry requires an
-      // open database connection.
-      $driver_class = 'DatabaseConnection_' . $driver;
-      require_once DRUPAL_ROOT . '/includes/database/' . $driver . '/database.inc';
-      $new_connection = new $driver_class(self::$databaseInfo[$key][$target]);
-      $new_connection->setTarget($target);
-
-      // If we have any active logging objects for this connection key, we need
-      // to associate them with the connection we just opened.
-      if (!empty(self::$logs[$key])) {
-        $new_connection->setLogger(self::$logs[$key]);
-      }
+    if (!$driver = self::$databaseInfo[$key][$target]['driver']) {
+      throw new DatabaseDriverNotSpecifiedException('Driver not specified for this database connection: ' . $key);
+    }
 
-      // We need to pass around the simpletest database prefix in the request
-      // and we put that in the user_agent header. The header HMAC was already
-      // validated in bootstrap.inc.
-      if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/^(simpletest\d+);/", $_SERVER['HTTP_USER_AGENT'], $matches)) {
-        $db_prefix_string = is_array($db_prefix) ? $db_prefix['default'] : $db_prefix;
-        $db_prefix = $db_prefix_string . $matches[1];
-      }
-      return $new_connection;
+    // We cannot rely on the registry yet, because the registry requires an
+    // open database connection.
+    $driver_class = 'DatabaseConnection_' . $driver;
+    require_once DRUPAL_ROOT . '/includes/database/' . $driver . '/database.inc';
+    $new_connection = new $driver_class(self::$databaseInfo[$key][$target]);
+    $new_connection->setTarget($target);
+
+    // If we have any active logging objects for this connection key, we need
+    // to associate them with the connection we just opened.
+    if (!empty(self::$logs[$key])) {
+      $new_connection->setLogger(self::$logs[$key]);
     }
-    catch (Exception $e) {
-      // It is extremely rare that an exception will be generated here other
-      // than when installing. We therefore intercept it and try the installer,
-      // passing on the exception otherwise.
-      _db_check_install_needed();
-      throw $e;
+
+    // We need to pass around the simpletest database prefix in the request
+    // and we put that in the user_agent header. The header HMAC was already
+    // validated in bootstrap.inc.
+    if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/^(simpletest\d+);/", $_SERVER['HTTP_USER_AGENT'], $matches)) {
+      $db_prefix_string = is_array($db_prefix) ? $db_prefix['default'] : $db_prefix;
+      $db_prefix = $db_prefix_string . $matches[1];
     }
+    return $new_connection;
   }
 
   /**
@@ -2900,17 +2889,3 @@ function db_ignore_slave() {
   }
 }
 
-/**
- * Redirects the user to the installation script.
- *
- * This will check if Drupal has not been installed yet (i.e., if no $databases
- * array has been defined in the settings.php file) and we are not already
- * installing. If both are true, the user is redirected to install.php.
- */
-function _db_check_install_needed() {
-  global $databases;
-  if (empty($databases) && !drupal_installation_attempted()) {
-    include_once DRUPAL_ROOT . '/includes/install.inc';
-    install_goto('install.php');
-  }
-}
Index: includes/database/pgsql/database.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/database/pgsql/database.inc,v
retrieving revision 1.36
diff -u -p -r1.36 database.inc
--- includes/database/pgsql/database.inc	7 Mar 2010 08:03:45 -0000	1.36
+++ includes/database/pgsql/database.inc	27 Apr 2010 01:03:42 -0000
@@ -90,7 +90,6 @@ class DatabaseConnection_pgsql extends D
       }
     }
     catch (PDOException $e) {
-      _db_check_install_needed();
       if ($options['throw_exception']) {
         // Add additional debug information.
         if ($query instanceof DatabaseStatementInterface) {
