Make WordPress Core

Changeset 22226


Ignore:
Timestamp:
10/14/2012 02:14:17 AM (12 years ago)
Author:
dd32
Message:

When upgrading a site to/from a Beta, alpha, or non-stable release, overwrite any existing bundled themes & plugins with the version from the release zip. See #21789

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/update-core.php

    r22054 r22226  
    620620    $required_mysql_version = '5.0';
    621621    $wp_version = '3.4';
     622    $old_wp_version = $GLOBALS['wp_version']; // The version of WordPress we're updating from
     623    $development_build = ( false !== strpos( $old_wp_version . $wp_version, '-' )  ); // a dash in the version indicates a Development release
    622624    $php_compat     = version_compare( $php_version, $required_php_version, '>=' );
    623625    if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) )
     
    684686    // Copy New bundled plugins & themes
    685687    // This gives us the ability to install new plugins & themes bundled with future versions of WordPress whilst avoiding the re-install upon upgrade issue.
     688    // $development_build controls us overwriting bundled themes and plugins when a non-stable release is being updated
    686689    if ( !is_wp_error($result) && ( ! defined('CORE_UPGRADE_SKIP_NEW_BUNDLED') || ! CORE_UPGRADE_SKIP_NEW_BUNDLED ) ) {
    687         $old_version = $GLOBALS['wp_version']; // $wp_version in local scope == new version
    688690        foreach ( (array) $_new_bundled_files as $file => $introduced_version ) {
    689             // If $introduced version is greater than what the site was previously running
    690             if ( version_compare($introduced_version, $old_version, '>') ) {
     691            // If a $development_build or if $introduced version is greater than what the site was previously running
     692            if ( $development_build || version_compare( $introduced_version, $old_wp_version, '>' ) ) {
    691693                $directory = ('/' == $file[ strlen($file)-1 ]);
    692694                list($type, $filename) = explode('/', $file, 2);
     
    700702
    701703                if ( ! $directory ) {
    702                     if ( $wp_filesystem->exists($dest . $filename) )
     704                    if ( ! $development_build && $wp_filesystem->exists( $dest . $filename ) )
    703705                        continue;
    704706
     
    706708                        $result = new WP_Error('copy_failed', __('Could not copy file.'), $dest . $filename);
    707709                } else {
    708                     if ( $wp_filesystem->is_dir($dest . $filename) )
     710                    if ( ! $development_build && $wp_filesystem->is_dir( $dest . $filename ) )
    709711                        continue;
    710712
Note: See TracChangeset for help on using the changeset viewer.