WordPress.org

Make WordPress Core


Ignore:
Timestamp:
12/01/2011 04:38:51 AM (9 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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' );
Note: See TracChangeset for help on using the changeset viewer.