WordPress.org

Make WordPress Core

Ticket #11464: 11464.10.diff

File 11464.10.diff, 3.6 KB (added by nacin, 8 years ago)
  • wp-admin/includes/update-core.php

     
    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                 return new WP_Error( '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 %1$s and MySQL version %2$s.'), $php_version, $mysql_version ) );
    229         elseif ( !$php_compat )
    230                 return new WP_Error( '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 ) );
    231         elseif ( !$mysql_compat )
    232                 return new WP_Error( '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 ) );
    233 
    234222        // Sanity check the unzipped distribution
    235223        apply_filters('update_feedback', __('Verifying the unpacked files'));
    236224        if ( !$wp_filesystem->exists($from . '/wordpress/wp-settings.php') || !$wp_filesystem->exists($from . '/wordpress/wp-admin/admin.php') ||
     
    239227                return new WP_Error('insane_distro', __('The update could not be unpacked') );
    240228        }
    241229
     230        include( $from . '/wordpress/wp-includes/version.php' );
     231        $php_version    = phpversion();
     232        $mysql_version  = $wpdb->db_version();
     233        $php_compat     = version_compare( $php_version, $required_php_version, '>=' );
     234        $mysql_compat   = version_compare( $mysql_version, $required_mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' );
     235
     236        if ( !$mysql_compat && !$php_compat )
     237                return new WP_Error( 'php_mysql_not_compatible', sprintf( __('The update cannot be installed because WordPress %1$s requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version ) );
     238        elseif ( !$php_compat )
     239                return new WP_Error( 'php_not_compatible', sprintf( __('The update cannot be installed because WordPress %1$s requires PHP version %2$s or higher. You are running version %3$s.'), $wp_version, $required_php_version, $php_version ) );
     240        elseif ( !$mysql_compat )
     241                return new WP_Error( 'mysql_not_compatible', sprintf( __('The update cannot be installed because WordPress %1$s requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version ) );
     242
    242243        apply_filters('update_feedback', __('Installing the latest version'));
    243244
    244245        // Create maintenance file to signal that we are upgrading
  • wp-includes/version.php

     
    3030 * @global string $manifest_version
    3131 */
    3232$manifest_version = '20090616';
     33
     34/**
     35 * Holds the required PHP version
     36 *
     37 * @global string $required_php_version
     38 */
     39$required_php_version = '4.3';
     40
     41/**
     42 * Holds the required MySQL version
     43 *
     44 * @global string $required_mysql_version
     45 */
     46$required_mysql_version = '4.1.2';
     47 No newline at end of file