Introduce ->mysql to allow drop-ins to declare themselves as MySQL and therefore allow minimum version checks to still apply. fixes #18176.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19060 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
935a533eb6
commit
6f9612f45c
|
@ -337,7 +337,10 @@ function update_core($from, $to) {
|
|||
$required_mysql_version = '5.0';
|
||||
$wp_version = '3.3';
|
||||
$php_compat = version_compare( $php_version, $required_php_version, '>=' );
|
||||
$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' );
|
||||
if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $this->is_mysql ) )
|
||||
$mysql_compat = true;
|
||||
else
|
||||
$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' );
|
||||
|
||||
if ( !$mysql_compat || !$php_compat )
|
||||
$wp_filesystem->delete($from, true);
|
||||
|
|
|
@ -45,7 +45,11 @@ function list_core_update( $update ) {
|
|||
$form_action = 'update-core.php?action=do-core-reinstall';
|
||||
} else {
|
||||
$php_compat = version_compare( $php_version, $update->php_version, '>=' );
|
||||
$mysql_compat = version_compare( $mysql_version, $update->mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' );
|
||||
if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) )
|
||||
$mysql_compat = true;
|
||||
else
|
||||
$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' );
|
||||
|
||||
if ( !$mysql_compat && !$php_compat )
|
||||
$message = sprintf( __('You cannot update because <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $update->current, $update->php_version, $update->mysql_version, $php_version, $mysql_version );
|
||||
elseif ( !$php_compat )
|
||||
|
|
|
@ -38,7 +38,10 @@ $step = (int) $step;
|
|||
$php_version = phpversion();
|
||||
$mysql_version = $wpdb->db_version();
|
||||
$php_compat = version_compare( $php_version, $required_php_version, '>=' );
|
||||
$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' );
|
||||
if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) )
|
||||
$mysql_compat = true;
|
||||
else
|
||||
$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' );
|
||||
|
||||
@header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
|
||||
?>
|
||||
|
|
|
@ -460,6 +460,20 @@ class wpdb {
|
|||
*/
|
||||
var $func_call;
|
||||
|
||||
/**
|
||||
* Whether MySQL is used as the database engine.
|
||||
*
|
||||
* Set in WPDB::db_connect() to true, by default. This is used when checking
|
||||
* against the required MySQL version for WordPress. Normally, a replacement
|
||||
* database drop-in (db.php) will skip these checks, but setting this to true
|
||||
* will force the checks to occur.
|
||||
*
|
||||
* @since 3.3.0
|
||||
* @access public
|
||||
* @var bool
|
||||
*/
|
||||
public $is_mysql = null;
|
||||
|
||||
/**
|
||||
* Connects to the database server and selects a database
|
||||
*
|
||||
|
@ -1015,6 +1029,9 @@ class wpdb {
|
|||
* @since 3.0.0
|
||||
*/
|
||||
function db_connect() {
|
||||
|
||||
$this->is_mysql = true;
|
||||
|
||||
if ( WP_DEBUG ) {
|
||||
$this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, true );
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue