From 278e2dd3095b626c6acc413229cab59c39f45126 Mon Sep 17 00:00:00 2001 From: Steven Wittens Date: Thu, 20 Oct 2005 21:30:50 +0000 Subject: - Add maintenance-page error screens when the php module for the dbtype is not loaded (just showed a blank screen before) --- includes/database.mysql.inc | 9 +++++++++ includes/database.mysqli.inc | 9 +++++++++ includes/database.pgsql.inc | 9 +++++++++ 3 files changed, 27 insertions(+) (limited to 'includes') diff --git a/includes/database.mysql.inc b/includes/database.mysql.inc index 7b307a3c5..8f96dc3bb 100644 --- a/includes/database.mysql.inc +++ b/includes/database.mysql.inc @@ -21,6 +21,15 @@ * (e.g. your database and web server live on different machines). */ function db_connect($url) { + // Check if MySQL support is present in PHP + if (!function_exists('mysql_connect')) { + drupal_maintenance_theme(); + drupal_set_title('PHP MySQL support not enabled'); + print theme('maintenance_page', '

We were unable to use the MySQL database because the MySQL 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; + } + $url = parse_url($url); // Allow for non-standard MySQL port. diff --git a/includes/database.mysqli.inc b/includes/database.mysqli.inc index 779a4a909..f96f89659 100644 --- a/includes/database.mysqli.inc +++ b/includes/database.mysqli.inc @@ -21,6 +21,15 @@ * Note that mysqli does not support persistent connections. */ function db_connect($url) { + // Check if MySQLi support is present in PHP + if (!function_exists('mysqli_init')) { + drupal_maintenance_theme(); + drupal_set_title('PHP MySQL support not enabled'); + print theme('maintenance_page', '

We were unable to use the MySQL 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; + } + $url = parse_url($url); // Allow for non-standard MySQL port. diff --git a/includes/database.pgsql.inc b/includes/database.pgsql.inc index 4cfa74f82..89b693bab 100644 --- a/includes/database.pgsql.inc +++ b/includes/database.pgsql.inc @@ -21,6 +21,15 @@ * (e.g. your database and web server live on different machines). */ function db_connect($url) { + // Check if MySQL support is present in PHP + if (!function_exists('pg_connect')) { + drupal_maintenance_theme(); + drupal_set_title('PHP PostgreSQL support not enabled'); + print theme('maintenance_page', '

We were unable to use the PostgreSQL database because the PostgreSQL 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; + } + $url = parse_url($url); $conn_string = ' user='. $url['user'] .' dbname='. substr($url['path'], 1) .' password='. $url['pass'] . ' host=' . $url['host']; -- cgit v1.2.3