Index: install.php
===================================================================
RCS file: /cvs/drupal/drupal/install.php,v
retrieving revision 1.231
diff -u -p -r1.231 install.php
--- install.php	4 Jan 2010 23:08:34 -0000	1.231
+++ install.php	9 Jan 2010 12:25:22 -0000
@@ -791,7 +791,7 @@ function install_verify_settings() {
   global $db_prefix, $databases;
 
   // Verify existing settings (if any).
-  if (!empty($databases)) {
+  if (!empty($databases) && install_verify_pdo()) {
     $database = $databases['default']['default'];
     drupal_static_reset('conf_path');
     $settings_file = './' . conf_path(FALSE) . '/settings.php';
@@ -804,6 +804,13 @@ function install_verify_settings() {
 }
 
 /**
+ * Verify PDO library.
+ */
+function install_verify_pdo() {
+  return extension_loaded('pdo');
+}
+
+/**
  * Installation task; define a form to configure and rewrite settings.php.
  *
  * @param $form_state
Index: includes/install.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/install.inc,v
retrieving revision 1.121
diff -u -p -r1.121 install.inc
--- includes/install.inc	4 Jan 2010 21:31:52 -0000	1.121
+++ includes/install.inc	9 Jan 2010 12:25:22 -0000
@@ -208,6 +208,11 @@ function drupal_detect_baseurl($file = '
 function drupal_detect_database_types() {
   $databases = array();
 
+  // Initialize the database system if it has not been
+  // initialized yet. We do not initialize it earlier to make
+  // requirements check during the installation.
+  require_once DRUPAL_ROOT . '/includes/database/database.inc';
+
   // We define a driver as a directory in /includes/database that in turn
   // contains a database.inc file. That allows us to drop in additional drivers
   // without modifying the installer.
Index: includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.565
diff -u -p -r1.565 theme.inc
--- includes/theme.inc	9 Jan 2010 06:35:38 -0000	1.565
+++ includes/theme.inc	9 Jan 2010 12:25:23 -0000
@@ -571,7 +571,7 @@ function list_themes($refresh = FALSE) {
     $themes = array();
     // Extract from the database only when it is available.
     // Also check that the site is not in the middle of an install or update.
-    if (db_is_active() && !defined('MAINTENANCE_MODE')) {
+    if (!defined('MAINTENANCE_MODE') && db_is_active()) {
       foreach (system_list('theme') as $theme) {
         if (file_exists($theme->filename)) {
           $theme->info = unserialize($theme->info);
@@ -2266,7 +2266,7 @@ function template_preprocess(&$variables
   $variables['is_admin']            = FALSE;
   $variables['is_front']            = FALSE;
   $variables['logged_in']           = FALSE;
-  if ($variables['db_is_active'] = db_is_active()  && !defined('MAINTENANCE_MODE')) {
+  if ($variables['db_is_active'] = (!defined('MAINTENANCE_MODE')) && db_is_active()) {
     // Check for administrators.
     if (user_access('access administration pages')) {
       $variables['is_admin'] = TRUE;
Index: includes/theme.maintenance.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.maintenance.inc,v
retrieving revision 1.51
diff -u -p -r1.51 theme.maintenance.inc
--- includes/theme.maintenance.inc	7 Jan 2010 07:41:45 -0000	1.51
+++ includes/theme.maintenance.inc	9 Jan 2010 12:25:24 -0000
@@ -28,7 +28,6 @@ function _drupal_maintenance_theme() {
   require_once DRUPAL_ROOT . '/includes/unicode.inc';
   require_once DRUPAL_ROOT . '/includes/file.inc';
   require_once DRUPAL_ROOT . '/includes/module.inc';
-  require_once DRUPAL_ROOT . '/includes/database/database.inc';
   unicode_check();
 
   // Install and update pages are treated differently to prevent theming overrides.
@@ -39,6 +38,7 @@ function _drupal_maintenance_theme() {
     if (!db_is_active()) {
       // Because we are operating in a crippled environment, we need to
       // bootstrap just enough to allow hook invocations to work.
+      require_once DRUPAL_ROOT . '/includes/database/database.inc';
       $module_list['system']['filename'] = 'modules/system/system.module';
       module_list(TRUE, FALSE, FALSE, $module_list);
       drupal_load('module', 'system');
Index: modules/system/system.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.install,v
retrieving revision 1.436
diff -u -p -r1.436 system.install
--- modules/system/system.install	9 Jan 2010 02:51:09 -0000	1.436
+++ modules/system/system.install	9 Jan 2010 12:25:25 -0000
@@ -94,6 +94,19 @@ function system_requirements($phase) {
   else {
     $requirements['php_register_globals']['value'] = $t('Disabled');
   }
+  
+  // Test PDO library availability.
+  $requirements['pdo'] = array(
+    'title' => $t('PDO library'),
+  );
+  if (extension_loaded('pdo')) {
+    $requirements['pdo']['value'] = $t('Enabled');
+  }
+  else {
+    $requirements['pdo']['value'] = $t('Disabled');
+    $requirements['pdo']['severity'] = REQUIREMENT_ERROR;
+    $requirements['pdo']['description'] = $t('Your server does not have the PHP PDO extension enabled. See the <a href="@system_requirements">system requirements page</a> for more information.', array('@system_requirements' => 'http://drupal.org/requirements'));
+  }
 
   // Test PHP memory_limit
   $memory_limit = ini_get('memory_limit');
