*/
var $postmeta;
+ /**
+ * WordPress Comment Metadata table
+ *
+ * @since 2.9
+ * @access public
+ * @var string
+ */
+ var $commentmeta;
+
/**
* WordPress User Metadata table
*
* @var array
*/
var $tables = array('users', 'usermeta', 'posts', 'categories', 'post2cat', 'comments', 'links', 'link2cat', 'options',
- 'postmeta', 'terms', 'term_taxonomy', 'term_relationships');
+ 'postmeta', 'terms', 'term_taxonomy', 'term_relationships', 'commentmeta');
+
+ /**
+ * List of deprecated WordPress tables
+ *
+ * @since 2.9.0
+ * @access private
+ * @var array
+ */
+ var $old_tables = array('categories', 'post2cat', 'link2cat');
+
/**
* Format specifiers for DB columns. Columns not listed here default to %s. Initialized in wp-settings.php.
*/
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
*
function __construct($dbuser, $dbpassword, $dbname, $dbhost) {
register_shutdown_function(array(&$this, "__destruct"));
- if ( defined('WP_DEBUG') and WP_DEBUG == true )
+ if ( WP_DEBUG )
$this->show_errors();
if ( defined('DB_CHARSET') )
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*/"
<li>Are you sure that the database server is running?</li>
</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>
-"/*/WP_I18N_DB_CONN_ERROR*/, $dbhost));
+"/*/WP_I18N_DB_CONN_ERROR*/, $dbhost), 'db_connect_fail');
return;
}
$this->ready = true;
- if ( $this->has_cap( 'collation' ) ) {
- if ( !empty($this->charset) ) {
- if ( function_exists('mysql_set_charset') ) {
- mysql_set_charset($this->charset, $this->dbh);
- $this->real_escape = true;
- } else {
- $collation_query = "SET NAMES '{$this->charset}'";
- if ( !empty($this->collate) )
- $collation_query .= " COLLATE '{$this->collate}'";
- $this->query($collation_query);
- }
+ if ( !empty($this->charset) ) {
+ if ( function_exists('mysql_set_charset') ) {
+ mysql_set_charset($this->charset, $this->dbh);
+ $this->real_escape = true;
+ } else {
+ $collation_query = "SET NAMES '{$this->charset}'";
+ if ( !empty($this->collate) )
+ $collation_query .= " COLLATE '{$this->collate}'";
+ $this->query($collation_query);
}
}
<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>
</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;
}
}
*
* @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;
function check_database_version()
{
global $wp_version;
- // Make sure the server has MySQL 4.0
- if ( version_compare($this->db_version(), '4.0.0', '<') )
- return new WP_Error('database_version',sprintf(__('<strong>ERROR</strong>: WordPress %s requires MySQL 4.0.0 or higher'), $wp_version));
+ // Make sure the server has MySQL 4.1.2
+ if ( version_compare($this->db_version(), '4.1.2', '<') )
+ return new WP_Error('database_version',sprintf(__('<strong>ERROR</strong>: WordPress %s requires MySQL 4.1.2 or higher'), $wp_version));
}
/**
*
* @return bool True if collation is supported, false if version does not
*/
- function supports_collation()
- {
+ function supports_collation() {
return $this->has_cap( 'collation' );
}