WordPress.org

Make WordPress Core

Ticket #11639: 11639-update-core.diff

File 11639-update-core.diff, 1.6 KB (added by nacin, 5 years ago)
  • wp-admin/includes/update-core.php

     
    219219 
    220220        @set_time_limit( 300 ); 
    221221 
     222        $versions_file = $wp_filesystem->wp_content_dir() . 'upgrade/version-current.php'; 
     223        $result = $wp_filesystem->copy($from . '/wordpress/wp-includes/version.php', $versions_file); 
     224        if ( is_wp_error($result) ) { 
     225                $wp_filesystem->delete($from, true); 
     226                return $result; 
     227        } 
     228 
     229        $wp_filesystem->chmod($versions_file, FS_CHMOD_FILE); 
     230        require_once( WP_CONTENT_DIR . '/upgrade/version-current.php' ); 
     231        $wp_filesystem->delete($versions_file); 
     232 
    222233        $php_version    = phpversion(); 
    223234        $mysql_version  = $wpdb->db_version(); 
    224         $required_php_version = '4.3'; 
    225         $required_mysql_version = '4.1.2'; 
    226         $wp_version = '2.9'; 
    227235        $php_compat     = version_compare( $php_version, $required_php_version, '>=' ); 
    228236        $mysql_compat   = version_compare( $mysql_version, $required_mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' ); 
    229237 
     238        if ( !$mysql_compat || !$php_compat ) 
     239                $wp_filesystem->delete($from, true); 
     240 
    230241        if ( !$mysql_compat && !$php_compat ) 
    231242                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 ) ); 
    232243        elseif ( !$php_compat )