Make WordPress Core

Changeset 19524


Ignore:
Timestamp:
12/01/2011 04:38:51 AM (13 years ago)
Author:
nacin
Message:

Finalize the code which redirects to about.php after a core update. Only triggers on update-core.php in case wp_update_core() is called in a different context.
props ocean90 for initial patch. fixes #18467.

Location:
trunk/wp-admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/about.php

    r19498 r19524  
    161161
    162162<div class="return-to-dashboard">
    163     <?php if ( current_user_can( 'update_core' ) && isset( $_GET['upgraded'] ) ) : ?>
    164     <a href="<?php echo esc_url( admin_url( 'update-core.php' ) ); ?>"><?php _e( 'Return to Dashboard &rarr; Updates' ); ?></a> |
     163    <?php if ( current_user_can( 'update_core' ) && isset( $_GET['updated'] ) ) : ?>
     164    <a href="<?php echo esc_url( network_admin_url( 'update-core.php' ) ); ?>"><?php
     165        is_multisite() ? _e( 'Return to Updates' ) : _e( 'Return to Dashboard &rarr; Updates' );
     166    ?></a> |
    165167    <?php endif; ?>
    166168    <a href="<?php echo esc_url( admin_url() ); ?>"><?php _e( 'Go to Dashboard &rarr; Home' ); ?></a>
  • trunk/wp-admin/includes/update-core.php

    r19442 r19524  
    466466    // Remove maintenance file, we're done.
    467467    $wp_filesystem->delete($maintenance_file);
     468
     469    // If we made it this far:
     470    do_action( '_core_updated_successfully', $wp_version );
     471
     472    return $wp_version;
    468473}
    469474
     
    526531 * Redirect to the About WordPress page after a successful upgrade.
    527532 *
    528  * This is a temporary function for the 3.3 upgrade only and will be removed in a later version.
    529  * 
     533 * This function is only needed when the existing install is older than 3.3.0.
     534 *
    530535 * @since 3.3.0
    531536 *
    532537 */
    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 ?>
     538function _redirect_to_about_wordpress( $wp_version ) {
     539    // Load the updated default text localization domain for new strings
     540    load_default_textdomain();
     541
     542    // See do_core_upgrade()
     543    show_message( __('WordPress updated successfully') );
     544    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>' );
     545    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>' );
     546    echo '</div>';
     547    ?>
    538548<script type="text/javascript">
    539 window.location = '<?php echo admin_url( 'about.php?upgraded' ); ?>';
     549window.location = '<?php echo admin_url( 'about.php?updated' ); ?>';
    540550</script>
    541 <?php
     551    <?php
     552
     553    // Include admin-footer.php and exit
     554    include(ABSPATH . 'wp-admin/admin-footer.php');
     555    exit();
    542556}
    543 
    544 add_action( 'admin_footer-update-core.php', '_redirect_to_about_wordpress' );
    545 ?>
     557if ( version_compare( $GLOBALS['wp_version'], '3.3', '<' ) && 'update-core.php' == $pagenow )
     558    add_action( '_core_updated_successfully', '_redirect_to_about_wordpress' );
  • trunk/wp-admin/update-core.php

    r19511 r19524  
    379379        if ('up_to_date' != $result->get_error_code() )
    380380            show_message( __('Installation Failed') );
    381     } else {
    382         show_message( __('WordPress updated successfully') );
    383         show_message( '<a href="' . esc_url( self_admin_url() ) . '">' . __('Go to Dashboard') . '</a>' );
    384     }
    385     echo '</div>';
     381        echo '</div>';
     382        return;
     383    }
     384
     385    show_message( __('WordPress updated successfully') );
     386    show_message( __('WordPress updated successfully') );
     387    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>.' ), $result, esc_url( admin_url( 'about.php?updated' ) ) ) . '</span>' );
     388    show_message( '<span class="hide-if-js">' . sprintf( __( 'Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.' ), $result, esc_url( admin_url( 'about.php?updated' ) ) ) . '</span>' );
     389    ?>
     390    </div>
     391    <script type="text/javascript">
     392    //window.location = '<?php echo admin_url( 'about.php?upgraded' ); ?>';
     393    </script>
     394    <?php
    386395}
    387396
Note: See TracChangeset for help on using the changeset viewer.