WordPress.org

Make WordPress Core

Ticket #18467: 18467.alt.diff

File 18467.alt.diff, 4.8 KB (added by nacin, 6 years ago)
  • wp-admin/includes/class-wp-upgrader.php

     
    975975                $working_dir = $this->unpack_package( $download );
    976976                if ( is_wp_error($working_dir) )
    977977                        return $working_dir;
    978 
     978/*
    979979                // Copy update-core.php from the new version into place.
    980980                if ( !$wp_filesystem->copy($working_dir . '/wordpress/wp-admin/includes/update-core.php', $wp_dir . 'wp-admin/includes/update-core.php', true) ) {
    981981                        $wp_filesystem->delete($working_dir, true);
    982982                        return new WP_Error('copy_failed', $this->strings['copy_failed']);
    983983                }
    984984                $wp_filesystem->chmod($wp_dir . 'wp-admin/includes/update-core.php', FS_CHMOD_FILE);
    985 
     985*/
    986986                require(ABSPATH . 'wp-admin/includes/update-core.php');
    987987
    988988                return update_core($working_dir, $wp_dir);
  • wp-admin/includes/update-core.php

     
    374374        $maintenance_file = $to . '.maintenance';
    375375        $wp_filesystem->delete($maintenance_file);
    376376        $wp_filesystem->put_contents($maintenance_file, $maintenance_string, FS_CHMOD_FILE);
    377 
     377        $result = true;
     378/*
    378379        // Copy new versions of WP files into place.
    379380        $result = _copy_dir($from . $distro, $to, array('wp-content') );
    380 
     381*/
    381382        // Custom Content Directory needs updating now.
    382383        // Copy Languages
    383384        if ( !is_wp_error($result) && $wp_filesystem->is_dir($from . $distro . 'wp-content/languages') ) {
     
    465466
    466467        // Remove maintenance file, we're done.
    467468        $wp_filesystem->delete($maintenance_file);
     469
     470        // If we made it this far:
     471        do_action( '_core_updated_successfully', $wp_version );
    468472}
    469473
    470474/**
     
    525529/**
    526530 * Redirect to the About WordPress page after a successful upgrade.
    527531 *
    528  * This is a temporary function for the 3.3 upgrade only and will be removed in a later version.
    529  * 
     532 * This function is only needed when the existing install is older than 3.3.0.
     533 *
    530534 * @since 3.3.0
    531535 *
    532536 */
    533 function _redirect_to_about_wordpress() {
    534         // Only for WP version < 3.3.0
    535         if ( version_compare( $GLOBALS['wp_version'], '3.3.0', '>' ) )
    536                 return;
    537 ?>
     537function _redirect_to_about_wordpress( $wp_version ) {
     538        // Load the updated default text localization domain for new strings
     539        load_default_textdomain();
     540
     541        // See do_core_upgrade()
     542        show_message( __('WordPress updated successfully') );
     543        show_message( '<span class="hide-if-no-js">' . sprintf( __( 'Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%s">here</a>.' ), $wp_version, esc_url( admin_url( 'about.php?updated' ) ) ) . '</span>' );
     544        show_message( '<span class="hide-if-js">' . sprintf( __( 'Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.' ), $wp_version, esc_url( admin_url( 'about.php?updated' ) ) ) . '</span>' );
     545        echo '</div>';
     546        ?>
    538547<script type="text/javascript">
    539 window.location = '<?php echo admin_url( 'about.php?upgraded' ); ?>';
     548//window.location = '<?php echo admin_url( 'about.php?updated' ); ?>';
    540549</script>
    541 <?php
     550        <?php
     551
     552        // Include admin-footer.php and exit
     553        include(ABSPATH . 'wp-admin/admin-footer.php');
     554        exit();
    542555}
    543 
    544 add_action( 'admin_footer-update-core.php', '_redirect_to_about_wordpress' );
    545 ?>
     556add_action( '_core_updated_successfully', '_redirect_to_about_wordpress' );
  • wp-admin/update-core.php

     
    379379                if ('up_to_date' != $result->get_error_code() )
    380380                        show_message( __('Installation Failed') );
    381381        } else {
     382                // Essentially, this code is forever dead.
    382383                show_message( __('WordPress updated successfully') );
    383384                show_message( '<a href="' . esc_url( self_admin_url() ) . '">' . __('Go to Dashboard') . '</a>' );
    384385        }
  • wp-admin/about.php

     
    160160</div>
    161161
    162162<div class="return-to-dashboard">
    163         <?php if ( current_user_can( 'update_core' ) && isset( $_GET['upgraded'] ) ) : ?>
     163        <?php
     164        if ( current_user_can( 'update_core' ) && isset( $_GET['updated'] ) ) :
     165                if ( is_multisite() ) : ?>
     166        <a href="<?php echo esc_url( network_admin_url( 'update-core.php' ) ); ?>"><?php _e( 'Return to Updates' ); ?></a> |
     167        <?php else : ?>
    164168        <a href="<?php echo esc_url( admin_url( 'update-core.php' ) ); ?>"><?php _e( 'Return to Dashboard &rarr; Updates' ); ?></a> |
    165         <?php endif; ?>
     169        <?php
     170                endif;
     171        endif;
     172        ?>
    166173        <a href="<?php echo esc_url( admin_url() ); ?>"><?php _e( 'Go to Dashboard &rarr; Home' ); ?></a>
    167174</div>
    168175