Make WordPress Core

Ticket #11464: 11464.7.diff

File 11464.7.diff, 1.8 KB (added by caesarsgrunt, 15 years ago)
  • wp-admin/includes/update-core.php

     
    215215 * @return WP_Error|null WP_Error on failure, null on success.
    216216 */
    217217function update_core($from, $to) {
    218         global $wp_filesystem, $_old_files;
     218        global $wp_filesystem, $_old_files, $wpdb;
    219219
    220220        @set_time_limit( 300 );
    221221
     222        $php_version   = phpversion();
     223        $php_compat    = version_compare( $php_version, '4.3', '>=' );
     224        $mysql_version = $wpdb->db_version;
     225        $mysql_compat  = version_compare( $mysql_version, '4.1.2', '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' );
     226
     227        if ( !$mysql_compat || !$php_compat ) {
     228                $errors = new WP_Error();
     229                if ( !$php_compat && !$mysql_compat )
     230                        $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 ) );
     231                elseif ( !$php_compat )
     232                        $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 ) );
     233                elseif ( !$mysql_compat )
     234                        $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 ) );
     235                return $errors;
     236        }
     237
    222238        // Sanity check the unzipped distribution
    223239        apply_filters('update_feedback', __('Verifying the unpacked files'));
    224240        if ( !$wp_filesystem->exists($from . '/wordpress/wp-settings.php') || !$wp_filesystem->exists($from . '/wordpress/wp-admin/admin.php') ||