Make WordPress Core

Changeset 6199


Ignore:
Timestamp:
10/06/2007 08:40:54 AM (19 years ago)
Author:
westi
Message:

Move all calls to mysql_ functions to withiWPDB so that t we don't expect any mysql stuff when we are using a custo$wpdb class. Fixes #5127
props ComputerGuru.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/schema.php

    r6178 r6199  
    44$charset_collate = '';
    55
    6 if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') ) {
     6if ( $wpdb->supports_collation() ) {
    77        if ( ! empty($wpdb->charset) )
    88                $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
  • trunk/wp-admin/includes/upgrade.php

    r6158 r6199  
    12401240
    12411241function wp_check_mysql_version() {
    1242         global $wp_version;
    1243 
    1244         // Make sure the server has MySQL 4.0
    1245         $mysql_version = preg_replace('|[^0-9\.]|', '', @mysql_get_server_info());
    1246         if ( version_compare($mysql_version, '4.0.0', '<') )
    1247                 die(sprintf(__('<strong>ERROR</strong>: WordPress %s requires MySQL 4.0.0 or higher'), $wp_version));
     1242        global $wpdb;
     1243        $result = $wpdb->check_database_version();
     1244        if ( is_wp_error( $result ) )
     1245                die( $result->get_error_message() );
    12481246}
    12491247
  • trunk/wp-includes/wp-db.php

    r6110 r6199  
    404404                wp_die($message);
    405405        }
     406        /**
     407         * Checks wether of not the database version is high enough to support the features WordPress uses
     408         * @global $wp_version
     409         */
     410        function check_database_version()
     411        {
     412                global $wp_version;
     413                // Make sure the server has MySQL 4.0
     414                $mysql_version = preg_replace('|[^0-9\.]|', '', @mysql_get_server_info());
     415                if ( version_compare($mysql_version, '4.0.0', '<') )
     416                        return new WP_Error('database_version',sprintf(__('<strong>ERROR</strong>: WordPress %s requires MySQL 4.0.0 or higher'), $wp_version));
     417        }
     418
     419        /**
     420         * This function is called when WordPress is generating the table schema to determine wether or not the current database
     421         * supports or needs the collation statements.
     422         */
     423        function supports_collation()
     424        {
     425                return ( version_compare(mysql_get_server_info(), '4.1.0', '>=') );
     426        }
    406427}
    407428
Note: See TracChangeset for help on using the changeset viewer.