WordPress.org

Make WordPress Core

Ticket #17816: 17816.diff

File 17816.diff, 3.1 KB (added by dd32, 7 years ago)
  • wp-admin/includes/class-wp-upgrader.php

     
    915915                $wp_filesystem->chmod($wp_dir . 'wp-admin/includes/update-core.php', FS_CHMOD_FILE);
    916916
    917917                require(ABSPATH . 'wp-admin/includes/update-core.php');
     918                /*
     919                TODO (@dd32)
     920                @nacin, $development_update is to cause $new_bundled_items to be force-updated for development updates
     921                Is the following logic the only time needed? What about RC2->Final releases?
     922                */
     923                $development_update = ( 'development' == $current->response );
    918924
    919                 return update_core($working_dir, $wp_dir);
     925                return update_core($working_dir, $wp_dir, $development_update);
    920926        }
    921927
    922928}
  • wp-admin/includes/update-core.php

     
    277277
    278278$_new_bundled_files = array(
    279279'plugins/akismet/' => '2.0',
     280'plugins/hello.php' => '2.0',
    280281'themes/twentyten/' => '3.0',
    281 'themes/twentyeleven/' => '3.2'
     282'themes/twentyeleven/' => '3.2',
    282283);
    283284
    284285/**
     
    325326 *
    326327 * @param string $from New release unzipped path.
    327328 * @param string $to Path to old WordPress installation.
     329 * @param bool $development_update If this is a -dev update
    328330 * @return WP_Error|null WP_Error on failure, null on success.
    329331 */
    330 function update_core($from, $to) {
     332function update_core($from, $to, $development_update = false ) {
    331333        global $wp_filesystem, $_old_files, $_new_bundled_files, $wpdb;
    332334
    333335        @set_time_limit( 300 );
     
    401403        if ( !is_wp_error($result) && ( ! defined('CORE_UPGRADE_SKIP_NEW_BUNDLED') || ! CORE_UPGRADE_SKIP_NEW_BUNDLED ) ) {
    402404                $old_version = $GLOBALS['wp_version']; // $wp_version in local scope == new version
    403405                foreach ( (array) $_new_bundled_files as $file => $introduced_version ) {
    404                         // If $introduced version is greater than what the site was previously running
    405                         if ( version_compare($introduced_version, $old_version, '>') ) {
     406                        // If $introduced version is greater than what the site was previously running                 
     407                        if ( $development_update || version_compare($introduced_version, $old_version, '>') ) {
    406408                                $directory = ('/' == $file[ strlen($file)-1 ]);
    407409                                list($type, $filename) = explode('/', $file, 2);
    408410
     
    414416                                        continue;
    415417
    416418                                if ( ! $directory ) {
    417                                         if ( $wp_filesystem->exists($dest . $filename) )
    418                                                 continue;
    419 
    420419                                        if ( ! $wp_filesystem->copy($from . $distro . 'wp-content/' . $file, $dest . $filename, FS_CHMOD_FILE) )
    421420                                                $result = new WP_Error('copy_failed', __('Could not copy file.'), $dest . $filename);
    422421                                } else {
    423                                         if ( $wp_filesystem->is_dir($dest . $filename) )
    424                                                 continue;
    425 
    426422                                        $wp_filesystem->mkdir($dest . $filename, FS_CHMOD_DIR);
    427423                                        $_result = copy_dir( $from . $distro . 'wp-content/' . $file, $dest . $filename);
    428424                                        if ( is_wp_error($_result) ) //If a error occurs partway through this final step, keep the error flowing through, but keep process going.