Machine parseable db error codes. Props dd32. fixes #10293
git-svn-id: http://svn.automattic.com/wordpress/trunk@11865 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
70b537d3f2
commit
82946b9484
|
@ -295,6 +295,15 @@ class wpdb {
|
||||||
*/
|
*/
|
||||||
var $real_escape = false;
|
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
|
* Connects to the database server and selects a database
|
||||||
*
|
*
|
||||||
|
@ -338,6 +347,8 @@ class wpdb {
|
||||||
if ( defined('DB_COLLATE') )
|
if ( defined('DB_COLLATE') )
|
||||||
$this->collate = DB_COLLATE;
|
$this->collate = DB_COLLATE;
|
||||||
|
|
||||||
|
$this->dbuser = $dbuser;
|
||||||
|
|
||||||
$this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword, true);
|
$this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword, true);
|
||||||
if (!$this->dbh) {
|
if (!$this->dbh) {
|
||||||
$this->bail(sprintf(/*WP_I18N_DB_CONN_ERROR*/"
|
$this->bail(sprintf(/*WP_I18N_DB_CONN_ERROR*/"
|
||||||
|
@ -349,7 +360,7 @@ class wpdb {
|
||||||
<li>Are you sure that the database server is running?</li>
|
<li>Are you sure that the database server is running?</li>
|
||||||
</ul>
|
</ul>
|
||||||
<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>
|
<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*/, $dbhost));
|
"/*/WP_I18N_DB_CONN_ERROR*/, $dbhost), 'db_connect_fail');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -436,7 +447,7 @@ class wpdb {
|
||||||
<li>Does the user <code>%2$s</code> have permission to use the <code>%1$s</code> database?</li>
|
<li>Does the user <code>%2$s</code> have permission to use the <code>%1$s</code> database?</li>
|
||||||
<li>On some systems the name of your database is prefixed with your username, so it would be like <code>username_%1$s</code>. Could that be the problem?</li>
|
<li>On some systems the name of your database is prefixed with your username, so it would be like <code>username_%1$s</code>. Could that be the problem?</li>
|
||||||
</ul>
|
</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>'/*/WP_I18N_DB_SELECT_DB*/, $db, DB_USER));
|
<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>'/*/WP_I18N_DB_SELECT_DB*/, $db, $this->dbuser), 'db_select_fail');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -996,13 +1007,14 @@ class wpdb {
|
||||||
*
|
*
|
||||||
* @since 1.5.0
|
* @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
|
* @return false|void
|
||||||
*/
|
*/
|
||||||
function bail($message) {
|
function bail($message, $error_code = '500') {
|
||||||
if ( !$this->show_errors ) {
|
if ( !$this->show_errors ) {
|
||||||
if ( class_exists('WP_Error') )
|
if ( class_exists('WP_Error') )
|
||||||
$this->error = new WP_Error('500', $message);
|
$this->error = new WP_Error($error_code, $message);
|
||||||
else
|
else
|
||||||
$this->error = $message;
|
$this->error = $message;
|
||||||
return false;
|
return false;
|
||||||
|
@ -1035,8 +1047,7 @@ class wpdb {
|
||||||
*
|
*
|
||||||
* @return bool True if collation is supported, false if version does not
|
* @return bool True if collation is supported, false if version does not
|
||||||
*/
|
*/
|
||||||
function supports_collation()
|
function supports_collation() {
|
||||||
{
|
|
||||||
return $this->has_cap( 'collation' );
|
return $this->has_cap( 'collation' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue