From 35b4860563ff49150fe7d82b2c683775d131d8e6 Mon Sep 17 00:00:00 2001 From: nacin Date: Wed, 8 Dec 2010 07:12:44 +0000 Subject: [PATCH] Don't improperly whitescreen on incorrect DB credentials during setup-config. Show error message with an opportunity to try again. fixes #15682. git-svn-id: http://svn.automattic.com/wordpress/trunk@16788 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/setup-config.php | 6 ++++-- wp-includes/wp-db.php | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/wp-admin/setup-config.php b/wp-admin/setup-config.php index 31604329b..244cdc45d 100644 --- a/wp-admin/setup-config.php +++ b/wp-admin/setup-config.php @@ -176,8 +176,10 @@ switch($step) { // We'll fail here if the values are no good. require_wp_db(); - if ( !empty($wpdb->error) ) - wp_die($wpdb->error->get_error_message()); + if ( ! empty( $wpdb->error ) ) { + $back = '

Try Again

'; + wp_die( $wpdb->error->get_error_message() . $back ); + } // Fetch or generate keys and salts. $no_api = isset( $_POST['noapi'] ); diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index 7814c9dde..c03deb1d3 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -1044,7 +1044,11 @@ class wpdb {

If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.

"/*/WP_I18N_DB_CONN_ERROR*/, $this->dbhost ), 'db_connect_fail' ); - //If show errors is disabled then we need to die anyway as we don't have a working DB connection + // If show errors is disabled then we need to die anyway as we don't have a working DB connection + // unless we're trying to test the initial connection, in which case setup-config.php will handle. + if ( defined( 'WP_SETUP_CONFIG' ) ) + return; + die(); }