From 100baac8958556c7fe5f925e1771d6185dc1402d Mon Sep 17 00:00:00 2001 From: Gordon Heydon Date: Thu, 22 Apr 2010 20:18:26 -0700 Subject: [PATCH] * Fix up the patch to be in the right format --- includes/bootstrap.inc | 21 +++++++++++++++++++++ includes/database/database.inc | 21 +++------------------ includes/database/pgsql/database.inc | 2 +- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git includes/bootstrap.inc includes/bootstrap.inc index 1cf4c4d..40b4547 100644 --- includes/bootstrap.inc +++ includes/bootstrap.inc @@ -1955,6 +1955,12 @@ function _drupal_bootstrap_database() { header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'); exit; } + + // Redirect to install.php if PDO is not installed. + if (!extension_loaded('pdo')) { + _drupal_check_install_needed(); + } + // 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'; @@ -2733,3 +2739,18 @@ function _drupal_shutdown_function() { } } } + +/** + * 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 _drupal_check_install_needed() { + global $databases; + if (empty($databases) && !drupal_installation_attempted()) { + include_once DRUPAL_ROOT . '/includes/install.inc'; + install_goto('install.php'); + } +} diff --git includes/database/database.inc includes/database/database.inc index bef2676..e0b2412 100644 --- includes/database/database.inc +++ includes/database/database.inc @@ -559,7 +559,7 @@ abstract class DatabaseConnection extends PDO { } } catch (PDOException $e) { - _db_check_install_needed(); + _drupal_check_install_needed(); if ($options['throw_exception']) { // Add additional debug information. if ($query instanceof DatabaseStatementInterface) { @@ -1409,7 +1409,7 @@ abstract class Database { final public static function parseConnectionInfo() { global $databases; - _db_check_install_needed(); + _drupal_check_install_needed(); $database_info = is_array($databases) ? $databases : array(); foreach ($database_info as $index => $info) { @@ -1534,7 +1534,7 @@ abstract class Database { // 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(); + _drupal_check_install_needed(); throw $e; } } @@ -2902,18 +2902,3 @@ function db_ignore_slave() { $_SESSION['ignore_slave_server'] = REQUEST_TIME + $duration; } } - -/** - * 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'); - } -} diff --git includes/database/pgsql/database.inc includes/database/pgsql/database.inc index 6c5cd97..9013db1 100644 --- includes/database/pgsql/database.inc +++ includes/database/pgsql/database.inc @@ -90,7 +90,7 @@ class DatabaseConnection_pgsql extends DatabaseConnection { } } catch (PDOException $e) { - _db_check_install_needed(); + _drupal_check_install_needed(); if ($options['throw_exception']) { // Add additional debug information. if ($query instanceof DatabaseStatementInterface) { -- 1.6.6.1