Permalink
Browse files

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
  • Loading branch information...
nacin
nacin committed Dec 8, 2010
1 parent 0a61447 commit 35b4860563ff49150fe7d82b2c683775d131d8e6
Showing with 9 additions and 3 deletions.
  1. +4 −2 wp-admin/setup-config.php
  2. +5 −1 wp-includes/wp-db.php
@@ -176,8 +176,10 @@ function display_header() {
// 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 = '<p class="step"><a href="setup-config.php?step=1" onclick="javascript:history.go(-1);return false;" class="button">Try Again</a></p>';
+ wp_die( $wpdb->error->get_error_message() . $back );
+ }
// Fetch or generate keys and salts.
$no_api = isset( $_POST['noapi'] );
View
@@ -1044,7 +1044,11 @@ function db_connect() {
<p>If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the <a href='http://wordpress.org/support/'>WordPress Support Forums</a>.</p>
"/*/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();
}

0 comments on commit 35b4860

Please sign in to comment.