include mysql version in version check query string. Props andy. fixes #7600 for trunk

git-svn-id: http://svn.automattic.com/wordpress/trunk@8739 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-08-26 22:30:56 +00:00
parent e6640c911a
commit 562fda59a7
2 changed files with 16 additions and 5 deletions

View File

@ -23,7 +23,7 @@ function wp_version_check() {
if ( defined('WP_INSTALLING') )
return;
global $wp_version;
global $wp_version, $wpdb;
$php_version = phpversion();
$current = get_option( 'update_core' );
@ -40,7 +40,12 @@ function wp_version_check() {
$new_option->last_checked = time(); // this gets set whether we get a response or not, so if something is down or misconfigured it won't delay the page load for more than 3 seconds, twice a day
$new_option->version_checked = $wp_version;
$url = "http://api.wordpress.org/core/version-check/1.2/?version=$wp_version&php=$php_version&locale=$locale";
if ( method_exists( $wpdb, 'db_version' ) )
$mysql_version = preg_replace('/[^0-9.].*/', '', $wpdb->db_version($wpdb->users));
else
$mysql_version = 'N/A';
$url = "http://api.wordpress.org/core/version-check/1.2/?version=$wp_version&php=$php_version&locale=$locale&mysql=$mysql_version";
$options = array('timeout' => 3);
$options['headers'] = array(

View File

@ -904,8 +904,7 @@ class wpdb {
{
global $wp_version;
// Make sure the server has MySQL 4.0
$mysql_version = preg_replace('|[^0-9\.]|', '', @mysql_get_server_info($this->dbh));
if ( version_compare($mysql_version, '4.0.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));
}
@ -920,7 +919,7 @@ class wpdb {
*/
function supports_collation()
{
return ( version_compare(mysql_get_server_info($this->dbh), '4.1.0', '>=') );
return ( version_compare($this->db_version(), '4.1.0', '>=') );
}
/**
@ -968,6 +967,13 @@ class wpdb {
return $caller;
}
/**
* The database version number
* @return false|string false on failure, version number on success
*/
function db_version() {
return preg_replace('/[^0-9.].*/', '', mysql_get_server_info( $this->dbh ));
}
}
if ( ! isset($wpdb) ) {