Commit a89aa3b1 authored by webchick's avatar webchick
Browse files

#887288 by catch, David_Rothstein: Fixed Attempting to use update.php without...

#887288 by catch, David_Rothstein: Fixed Attempting to use update.php without having configured a database in settings.php results in incorrect/misleading error message
parent 748d7ea0
...@@ -125,7 +125,11 @@ function update_prepare_d7_bootstrap() { ...@@ -125,7 +125,11 @@ function update_prepare_d7_bootstrap() {
$pdo_link = 'http://drupal.org/requirements/pdo#pecl'; $pdo_link = 'http://drupal.org/requirements/pdo#pecl';
} }
// Check that the correct driver is loaded for the database being updated. // 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>'; $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) { if ($message) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment