summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-10-12 02:50:03 +0000
committerDries Buytaert <dries@buytaert.net>2010-10-12 02:50:03 +0000
commit738367593558ba170cb6d65dda35ec9230654bc3 (patch)
tree4a8025e4e16aba7be4aeee0ae179e6866cd12d94 /includes
parent563c673ea3b8977e9f739f7979acb62abcd78310 (diff)
downloadbrdo-738367593558ba170cb6d65dda35ec9230654bc3.tar.gz
brdo-738367593558ba170cb6d65dda35ec9230654bc3.tar.bz2
- Patch #818374 by Damien Tournoud, ksenzee, Dave Reid: add a requirements check error if PECL PDO is being used.
Diffstat (limited to 'includes')
-rw-r--r--includes/install.core.inc7
-rw-r--r--includes/update.inc11
2 files changed, 15 insertions, 3 deletions
diff --git a/includes/install.core.inc b/includes/install.core.inc
index f162bebce..db0951338 100644
--- a/includes/install.core.inc
+++ b/includes/install.core.inc
@@ -819,7 +819,12 @@ function install_verify_settings() {
* Verify PDO library.
*/
function install_verify_pdo() {
- return extension_loaded('pdo');
+ // PDO was moved to PHP core in 5.2.0, but the old extension (targeting 5.0
+ // and 5.1) is still available from PECL, and can still be built without
+ // errors. To verify that the correct version is in use, we check the
+ // PDO::ATTR_DEFAULT_FETCH_MODE constant, which is not available in the
+ // PECL extension.
+ return extension_loaded('pdo') && defined('PDO::ATTR_DEFAULT_FETCH_MODE');
}
/**
diff --git a/includes/update.inc b/includes/update.inc
index 492f62756..459dc0a54 100644
--- a/includes/update.inc
+++ b/includes/update.inc
@@ -113,16 +113,23 @@ function update_prepare_d7_bootstrap() {
// loaded. Bootstrapping to DRUPAL_BOOTSTRAP_DATABASE will result in a fatal
// error otherwise.
$message = '';
+ $pdo_link = 'http://drupal.org/requirements/pdo';
// Check that PDO is loaded.
if (!extension_loaded('pdo')) {
$message = '<h2>PDO is required!</h2><p>Drupal 7 requires PHP ' . DRUPAL_MINIMUM_PHP . ' or higher with the PHP Data Objects (PDO) extension enabled.</p>';
}
+ // The PDO::ATTR_DEFAULT_FETCH_MODE constant is not available in the PECL
+ // version of PDO.
+ elseif (!defined('PDO::ATTR_DEFAULT_FETCH_MODE')) {
+ $message = '<h2>The wrong version of PDO is installed!</h2><p>Drupal 7 requires the PHP Data Objects (PDO) extension from PHP core to be enabled. This system has the older PECL version installed.';
+ $pdo_link = 'http://drupal.org/requirements/pdo#pecl';
+ }
// Check that the correct driver is loaded for the database being updated.
elseif (!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) {
- print $message . '<p>See the <a href="http://drupal.org/requirements">system requirements page</a> for more information.</p>';
+ print $message . '<p>See the <a href="' . $pdo_link . '">system requirements page</a> for more information.</p>';
exit();
}