Index: install.php
===================================================================
RCS file: /cvs/drupal/drupal/install.php,v
retrieving revision 1.161
diff -u -p -r1.161 install.php
--- install.php	25 Mar 2009 16:40:51 -0000	1.161
+++ install.php	30 Mar 2009 22:43:44 -0000
@@ -180,7 +180,7 @@ function install_verify_settings() {
   global $db_prefix, $databases;
 
   // Verify existing settings (if any).
-  if (!empty($databases)) {
+  if (!empty($databases) && install_verify_pdo()) {
     // We need this because we want to run form_get_errors.
     include_once DRUPAL_ROOT . '/includes/form.inc';
 
@@ -197,6 +197,13 @@ function install_verify_settings() {
 }
 
 /**
+ * Verify PDO library.
+ */
+function install_verify_pdo() {
+  return extension_loaded('pdo');
+}
+
+/**
  * Configure and rewrite settings.php.
  */
 function install_change_settings($profile = 'default', $install_locale = '') {
Index: includes/install.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/install.inc,v
retrieving revision 1.86
diff -u -p -r1.86 install.inc
--- includes/install.inc	1 Mar 2009 09:32:17 -0000	1.86
+++ includes/install.inc	30 Mar 2009 22:43:44 -0000
@@ -209,6 +209,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.470
diff -u -p -r1.470 theme.inc
--- includes/theme.inc	22 Feb 2009 17:55:29 -0000	1.470
+++ includes/theme.inc	30 Mar 2009 22:43:46 -0000
@@ -455,7 +455,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()) {
       $result = db_query("SELECT * FROM {system} WHERE type = :theme", array(':theme' => 'theme'));
       foreach ($result as $theme) {
         if (file_exists($theme->filename)) {
Index: includes/theme.maintenance.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.maintenance.inc,v
retrieving revision 1.21
diff -u -p -r1.21 theme.maintenance.inc
--- includes/theme.maintenance.inc	24 Nov 2008 10:41:39 -0000	1.21
+++ includes/theme.maintenance.inc	30 Mar 2009 22:43:46 -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.
@@ -36,6 +35,8 @@ function _drupal_maintenance_theme() {
     $theme = 'minnelli';
   }
   else {
+    require_once DRUPAL_ROOT . '/includes/database/database.inc';
+
     // Load module basics (needed for hook invokes).
     $module_list['system']['filename'] = 'modules/system/system.module';
     $module_list['filter']['filename'] = 'modules/filter/filter.module';
Index: modules/system/system.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.install,v
retrieving revision 1.312
diff -u -p -r1.312 system.install
--- modules/system/system.install	17 Mar 2009 15:26:29 -0000	1.312
+++ modules/system/system.install	30 Mar 2009 22:43:46 -0000
@@ -92,6 +92,19 @@ function system_requirements($phase) {
       $requirements['php_memory_limit']['severity'] = REQUIREMENT_WARNING;
     }
   }
+  
+  // 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 DB version
   global $db_type;
