From 58bf1c792747cf7e6f3c291daf17563ed15e37cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Hojtsy?= Date: Wed, 19 Dec 2007 13:03:16 +0000 Subject: #178523 by scor, JirkaRybka, keith.smith: user facing errors should contain text for users, not text for developers; still keeping some debug information, if display_errors is turned on on the server --- includes/database.mysqli.inc | 39 +++------------------------------------ 1 file changed, 3 insertions(+), 36 deletions(-) (limited to 'includes/database.mysqli.inc') diff --git a/includes/database.mysqli.inc b/includes/database.mysqli.inc index 9c00b3e9d..d6fd3aeda 100644 --- a/includes/database.mysqli.inc +++ b/includes/database.mysqli.inc @@ -58,11 +58,7 @@ function db_version() { function db_connect($url) { // Check if MySQLi support is present in PHP if (!function_exists('mysqli_init') && !extension_loaded('mysqli')) { - drupal_maintenance_theme(); - drupal_set_title('PHP MySQLi support not enabled'); - print theme('maintenance_page', '

We were unable to use the MySQLi database because the MySQLi extension for PHP is not installed. Check your PHP.ini to see how you can enable it.

-

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; + _db_error_page('Unable to use the MySQLi database because the MySQLi extension for PHP is not installed. Check your php.ini to see how you can enable it.'); } $url = parse_url($url); @@ -85,37 +81,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); - // 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_header('HTTP/1.1 503 Service Unavailable'); - drupal_set_title('Unable to connect to database server'); - print theme('maintenance_page', '

If you still have to install Drupal, proceed to the installation page.

-

If you have already finished installing Drupal, this either means that the username and password information in your settings.php file is incorrect or that we can\'t connect to the MySQL database server. This could mean your hosting provider\'s database server is down.

-

The MySQL error was: '. theme('placeholder', mysqli_connect_error()) .'.

-

Currently, the username is '. theme('placeholder', $url['user']) .' and the database server is '. theme('placeholder', $url['host']) .'.

- -

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() > 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.

-

The MySQL error was: '. theme('placeholder', mysqli_connect_error()) .'.

-

Currently, the database is '. theme('placeholder', substr($url['path'], 1)) .'. The username is '. theme('placeholder', $url['user']) .' and the database server is '. theme('placeholder', $url['host']) .'.

- -

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; + if (mysqli_connect_errno() > 0) { + _db_error_page(mysqli_connect_error()); } /* Force UTF-8 */ -- cgit v1.2.3