| 1 | Index: wp-admin/includes/update-core.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-admin/includes/update-core.php (revision 12419) |
|---|
| 4 | +++ wp-admin/includes/update-core.php (working copy) |
|---|
| 5 | @@ -215,10 +215,26 @@ |
|---|
| 6 | * @return WP_Error|null WP_Error on failure, null on success. |
|---|
| 7 | */ |
|---|
| 8 | function update_core($from, $to) { |
|---|
| 9 | - global $wp_filesystem, $_old_files; |
|---|
| 10 | + global $wp_filesystem, $_old_files, $wpdb; |
|---|
| 11 | |
|---|
| 12 | @set_time_limit( 300 ); |
|---|
| 13 | |
|---|
| 14 | + $php_version = phpversion(); |
|---|
| 15 | + $php_compat = version_compare( $php_version, '4.3', '>=' ); |
|---|
| 16 | + $mysql_version = $wpdb->db_version; |
|---|
| 17 | + $mysql_compat = version_compare( $mysql_version, '4.1.2', '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' ); |
|---|
| 18 | + |
|---|
| 19 | + if ( !$mysql_compat || !$php_compat ) { |
|---|
| 20 | + $errors = new WP_Error(); |
|---|
| 21 | + if ( !$php_compat && !$mysql_compat ) |
|---|
| 22 | + $errors->add( 'php_mysql_not_compatible', sprintf( __('The update cannot be installed because WordPress requires PHP version 4.3 or higher and MySQL version 4.1.2 or higher. You are running PHP version %s and MySQL version %s.'), $php_version, $mysql_version ) ); |
|---|
| 23 | + elseif ( !$php_compat ) |
|---|
| 24 | + $errors->add( 'php_not_compatible', sprintf( __('The update cannot be installed because WordPress requires PHP version 4.3 or higher. You are running version %s.'), $php_version ) ); |
|---|
| 25 | + elseif ( !$mysql_compat ) |
|---|
| 26 | + $errors->add( 'mysql_not_compatible', sprintf( __('The update cannot be installed because WordPress requires MySQL version 4.1.2 or higher. You are running version %s.'), $mysql_version ) ); |
|---|
| 27 | + return $errors; |
|---|
| 28 | + } |
|---|
| 29 | + |
|---|
| 30 | // Sanity check the unzipped distribution |
|---|
| 31 | apply_filters('update_feedback', __('Verifying the unpacked files')); |
|---|
| 32 | if ( !$wp_filesystem->exists($from . '/wordpress/wp-settings.php') || !$wp_filesystem->exists($from . '/wordpress/wp-admin/admin.php') || |
|---|