diff --git a/wp-admin/install.php b/wp-admin/install.php index 42f4ef1ca..545461f48 100644 --- a/wp-admin/install.php +++ b/wp-admin/install.php @@ -13,6 +13,7 @@ if (isset($_GET['step'])) $step = $_GET['step']; else $step = 0; +function display_header(){ header( 'Content-Type: text/html; charset=utf-8' ); ?> @@ -24,13 +25,17 @@ header( 'Content-Type: text/html; charset=utf-8' );

WordPress

+ '.__('Already Installed').'

'.__('You appear to have already installed WordPress. To reinstall please clear your old database tables first.').'

'); +if ( is_blog_installed() ) {display_header(); die('

'.__('Already Installed').'

'.__('You appear to have already installed WordPress. To reinstall please clear your old database tables first.').'

');} switch($step) { case 0: case 1: // in case people are directly linking to this + display_header(); ?>

ReadMe documentation at your leisure. Otherwise, just fill in the information below and you\'ll be on your way to using the most extendable and powerful personal publishing platform in the world.'), '../readme.html'); ?>

@@ -61,6 +66,9 @@ switch($step) { error) ) + wp_die($wpdb->error->get_error_message()); + display_header(); // Fill in the data we gathered $weblog_title = stripslashes($_POST['weblog_title']); $admin_email = stripslashes($_POST['admin_email']); diff --git a/wp-admin/setup-config.php b/wp-admin/setup-config.php index 86e7ceac1..91d74dd30 100644 --- a/wp-admin/setup-config.php +++ b/wp-admin/setup-config.php @@ -6,6 +6,7 @@ define('WPINC', 'wp-includes'); require_once('../wp-includes/compat.php'); require_once('../wp-includes/functions.php'); +require_once('../wp-includes/classes.php'); if (!file_exists('../wp-config-sample.php')) wp_die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.'); @@ -164,6 +165,9 @@ 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()); + $handle = fopen('../wp-config.php', 'w'); foreach ($configFile as $line_num => $line) { diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index 96c12b76e..a57764b42 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -115,6 +115,7 @@ class wpdb {

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

If you don't know how to setup a database you should contact your host. If all else fails you may find help at the WordPress Support Forums.

"); @@ -462,10 +463,16 @@ class wpdb { * @param string $message */ function bail($message) { // Just wraps errors in a nice header and footer - if ( !$this->show_errors ) + if ( !$this->show_errors ) { + if ( class_exists('WP_Error') ) + $this->error = new WP_Error('500', $message); + else + $this->error = $message; return false; + } wp_die($message); } + /** * Checks wether of not the database version is high enough to support the features WordPress uses * @global $wp_version