diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index a4ff757c8c..b35bbee697 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -295,6 +295,15 @@ class wpdb { */ var $real_escape = false; + /** + * Database Username + * + * @since 2.9.0 + * @access private + * @var string + */ + var $dbuser; + /** * Connects to the database server and selects a database * @@ -338,6 +347,8 @@ class wpdb { if ( defined('DB_COLLATE') ) $this->collate = DB_COLLATE; + $this->dbuser = $dbuser; + $this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword, true); if (!$this->dbh) { $this->bail(sprintf(/*WP_I18N_DB_CONN_ERROR*/" @@ -349,7 +360,7 @@ class wpdb {
  • Are you sure that the database server is running?
  • 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*/, $dbhost)); +"/*/WP_I18N_DB_CONN_ERROR*/, $dbhost), 'db_connect_fail'); return; } @@ -436,7 +447,7 @@ class wpdb {
  • Does the user %2$s have permission to use the %1$s database?
  • On some systems the name of your database is prefixed with your username, so it would be like username_%1$s. Could that be the problem?
  • -

    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.

    '/*/WP_I18N_DB_SELECT_DB*/, $db, DB_USER)); +

    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.

    '/*/WP_I18N_DB_SELECT_DB*/, $db, $this->dbuser), 'db_select_fail'); return; } } @@ -996,13 +1007,14 @@ class wpdb { * * @since 1.5.0 * - * @param string $message + * @param string $message The Error message + * @param string $error_code (optional) A Computer readable string to identify the error. * @return false|void */ - function bail($message) { + function bail($message, $error_code = '500') { if ( !$this->show_errors ) { if ( class_exists('WP_Error') ) - $this->error = new WP_Error('500', $message); + $this->error = new WP_Error($error_code, $message); else $this->error = $message; return false; @@ -1035,8 +1047,7 @@ class wpdb { * * @return bool True if collation is supported, false if version does not */ - function supports_collation() - { + function supports_collation() { return $this->has_cap( 'collation' ); }