From 0c4e12aed8dfec6a8e42696cc67e85a6d1d39c74 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 19 Feb 2006 21:43:18 +0000 Subject: - Patch #47919 by ma3vrck and Thomas: improved error handling/reporting. --- includes/database.mysqli.inc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'includes') diff --git a/includes/database.mysqli.inc b/includes/database.mysqli.inc index d9cbb5180..91a05142f 100644 --- a/includes/database.mysqli.inc +++ b/includes/database.mysqli.inc @@ -41,7 +41,8 @@ function db_connect($url) { $connection = mysqli_init(); @mysqli_real_connect($connection, $url['host'], $url['user'], $url['pass'], substr($url['path'], 1), $url['port'], NULL, MYSQLI_CLIENT_FOUND_ROWS); - if (mysqli_connect_errno() == 2003) { + // Find all database connection errors and error 1045 for access denied for user account + if (mysqli_connect_errno() >= 2000 || mysqli_connect_errno() == 1045) { drupal_maintenance_theme(); drupal_set_title('Unable to connect to database server'); print theme('maintenance_page', '

This either means that the username and password information in your settings.php file is incorrect or we can\'t contact the MySQL database server through the mysqli libraries. This could also mean your hosting provider\'s database server is down.

@@ -56,7 +57,7 @@ function db_connect($url) {

For more help, see the Installation and upgrading handbook. If you are unsure what these terms mean you should probably contact your hosting provider.

'); exit; } - else if (mysqli_connect_errno() == 1044) { + else if (mysqli_connect_errno() > 0) { drupal_maintenance_theme(); drupal_set_title('Unable to select database'); print theme('maintenance_page', '

We were able to connect to the MySQL database server (which means your username and password are okay) but not able to select the database.

-- cgit v1.2.3