WordPress.org

Make WordPress Core

Ticket #3615: mysql-4-check.diff

File mysql-4-check.diff, 982 bytes (added by markjaquith, 11 years ago)

Patch for 2.1

  • wp-admin/upgrade-functions.php

     
    1111function wp_install($blog_title, $user_name, $user_email, $public, $meta='') {
    1212        global $wp_rewrite;
    1313
     14        wp_check_mysql_version();
    1415        wp_cache_flush();
    1516        make_db_current_silent();
    1617        populate_options();
     
    134135        if ( $wp_db_version == $wp_current_db_version )
    135136                return;
    136137
     138        wp_check_mysql_version();
    137139        wp_cache_flush();
    138140        make_db_current_silent();
    139141        upgrade_all();
     
    10811083        }
    10821084}
    10831085
     1086function wp_check_mysql_version() {
     1087        global $wp_version;
     1088
     1089        // Make sure the server has MySQL 4.0
     1090        $mysql_version = preg_replace('|[^0-9\.]|', '', @mysql_get_server_info());
     1091        if ( version_compare($mysql_version, '4.0.0', '<') )
     1092                die(sprintf(__('<strong>ERROR</strong>: WordPress %s requires MySQL 4.0.0 or higher'), $wp_version));
     1093}
     1094
    10841095?>