Show DB errors if WP_DEBUG and if installing. see #5473

git-svn-id: http://svn.automattic.com/wordpress/trunk@6469 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2007-12-22 17:45:30 +00:00
parent 32c3c43307
commit e8241c6966
2 changed files with 10 additions and 5 deletions

View File

@ -66,9 +66,10 @@ switch($step) {
<?php <?php
break; break;
case 2: case 2:
if ( !empty($wpdb->error) ) if ( !empty($wpdb->error) )
wp_die($wpdb->error->get_error_message()); wp_die($wpdb->error->get_error_message());
display_header();
display_header();
// Fill in the data we gathered // Fill in the data we gathered
$weblog_title = stripslashes($_POST['weblog_title']); $weblog_title = stripslashes($_POST['weblog_title']);
$admin_email = stripslashes($_POST['admin_email']); $admin_email = stripslashes($_POST['admin_email']);
@ -82,8 +83,9 @@ switch($step) {
die(__('<strong>ERROR</strong>: that isn\'t a valid e-mail address. E-mail addresses look like: <code>username@example.com</code>')); die(__('<strong>ERROR</strong>: that isn\'t a valid e-mail address. E-mail addresses look like: <code>username@example.com</code>'));
} }
$result = wp_install($weblog_title, 'admin', $admin_email, $public); $wpdb->show_errors();
extract($result, EXTR_SKIP); $result = wp_install($weblog_title, 'admin', $admin_email, $public);
extract($result, EXTR_SKIP);
?> ?>
<h1><?php _e('Success!'); ?></h1> <h1><?php _e('Success!'); ?></h1>

View File

@ -55,6 +55,9 @@ class wpdb {
function __construct($dbuser, $dbpassword, $dbname, $dbhost) { function __construct($dbuser, $dbpassword, $dbname, $dbhost) {
register_shutdown_function(array(&$this, "__destruct")); register_shutdown_function(array(&$this, "__destruct"));
if ( defined('WP_DEBUG') and WP_DEBUG == true )
$this->show_errors();
if ( defined('DB_CHARSET') ) if ( defined('DB_CHARSET') )
$this->charset = DB_CHARSET; $this->charset = DB_CHARSET;