Ticket #3615: mysql-4-check.diff

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

Patch for 2.1

Line 
1Index: wp-admin/upgrade-functions.php
2===================================================================
3--- wp-admin/upgrade-functions.php      (revision 4770)
4+++ wp-admin/upgrade-functions.php      (working copy)
5@@ -11,6 +11,7 @@
6 function wp_install($blog_title, $user_name, $user_email, $public, $meta='') {
7        global $wp_rewrite;
8 
9+       wp_check_mysql_version();
10        wp_cache_flush();
11        make_db_current_silent();
12        populate_options();
13@@ -134,6 +135,7 @@
14        if ( $wp_db_version == $wp_current_db_version )
15                return;
16 
17+       wp_check_mysql_version();
18        wp_cache_flush();
19        make_db_current_silent();
20        upgrade_all();
21@@ -1081,4 +1083,13 @@
22        }
23 }
24 
25+function wp_check_mysql_version() {
26+       global $wp_version;
27+
28+       // Make sure the server has MySQL 4.0
29+       $mysql_version = preg_replace('|[^0-9\.]|', '', @mysql_get_server_info());
30+       if ( version_compare($mysql_version, '4.0.0', '<') )
31+               die(sprintf(__('<strong>ERROR</strong>: WordPress %s requires MySQL 4.0.0 or higher'), $wp_version));
32+}
33+
34 ?>