Set error if there is a problem connecting to the DB. Props skeltoac and Potter_System. fixes #5495

git-svn-id: http://svn.automattic.com/wordpress/trunk@6426 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan
2007-12-20 02:10:09 +00:00
parent 4f92b64b2e
commit de5340b9f3
3 changed files with 21 additions and 2 deletions

View File

@@ -115,6 +115,7 @@ class wpdb {
<p>We were able to connect to the database server (which means your username and password is okay) but not able to select the <code>$db</code> database.</p>
<ul>
<li>Are you sure it exists?</li>
<li>Does the user <code>".DB_USER."</code> have permission to use the <code>$db</code> database?</li>
<li>On some systems the name of your database is prefixed with your username, so it would be like username_wordpress. Could that be the problem?</li>
</ul>
<p>If you don't know how to setup a database you should <strong>contact your host</strong>. If all else fails you may find help at the <a href='http://wordpress.org/support/'>WordPress Support Forums</a>.</p>");
@@ -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