WordPress.org

Make WordPress Core

Ticket #7600: 7600.diff

File 7600.diff, 2.3 KB (added by andy, 10 years ago)
  • wp-includes/update.php

     
    2323        if ( defined('WP_INSTALLING') )
    2424                return;
    2525
    26         global $wp_version;
     26        global $wp_version, $wpdb;
    2727        $php_version = phpversion();
    2828
    2929        $current = get_option( 'update_core' );
     
    4040        $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
    4141        $new_option->version_checked = $wp_version;
    4242
    43         $url = "http://api.wordpress.org/core/version-check/1.2/?version=$wp_version&php=$php_version&locale=$locale";
     43        if ( method_exists( $wpdb, 'db_version' ) )
     44                $mysql_version = preg_replace('/[^0-9.].*/', '', $wpdb->db_version($wpdb->users));
     45        else
     46                $mysql_version = 'N/A';
    4447
     48        $url = "http://api.wordpress.org/core/version-check/1.2/?version=$wp_version&php=$php_version&locale=$locale&mysql=$mysql_version";
     49
    4550        $options = array('timeout' => 3);
    4651        $options['headers'] = array(
    4752                'Content-Type' => 'application/x-www-form-urlencoded; charset=' . get_option('blog_charset'),
  • wp-includes/wp-db.php

     
    904904        {
    905905                global $wp_version;
    906906                // Make sure the server has MySQL 4.0
    907                 $mysql_version = preg_replace('|[^0-9\.]|', '', @mysql_get_server_info($this->dbh));
    908                 if ( version_compare($mysql_version, '4.0.0', '<') )
     907                if ( version_compare($this->db_version(), '4.0.0', '<') )
    909908                        return new WP_Error('database_version',sprintf(__('<strong>ERROR</strong>: WordPress %s requires MySQL 4.0.0 or higher'), $wp_version));
    910909        }
    911910
     
    920919         */
    921920        function supports_collation()
    922921        {
    923                 return ( version_compare(mysql_get_server_info($this->dbh), '4.1.0', '>=') );
     922                return ( version_compare($this->db_version(), '4.1.0', '>=') );
    924923        }
    925924
    926925        /**
     
    957956                return $caller;
    958957        }
    959958
     959        /**
     960         * The database version number
     961         * @return false|string false on failure, version number on success
     962         */
     963        function db_version() {
     964                return preg_replace('/[^0-9.].*/', '', mysql_get_server_info( $this->dbh ));
     965        }
    960966}
    961967
    962968if ( ! isset($wpdb) ) {