Skip to content

Commit

Permalink
Finalize the code which redirects to about.php after a core update. O…
Browse files Browse the repository at this point in the history
…nly triggers on update-core.php in case wp_update_core() is called in a different context.

props ocean90 for initial patch. fixes #18467.


git-svn-id: http://svn.automattic.com/wordpress/trunk@19524 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
nacin committed Dec 1, 2011
1 parent 94f091a commit e209ce5
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 18 deletions.
6 changes: 4 additions & 2 deletions wp-admin/about.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,10 @@
</div>

<div class="return-to-dashboard">
<?php if ( current_user_can( 'update_core' ) && isset( $_GET['upgraded'] ) ) : ?>
<a href="<?php echo esc_url( admin_url( 'update-core.php' ) ); ?>"><?php _e( 'Return to Dashboard &rarr; Updates' ); ?></a> |
<?php if ( current_user_can( 'update_core' ) && isset( $_GET['updated'] ) ) : ?>
<a href="<?php echo esc_url( network_admin_url( 'update-core.php' ) ); ?>"><?php
is_multisite() ? _e( 'Return to Updates' ) : _e( 'Return to Dashboard &rarr; Updates' );
?></a> |
<?php endif; ?>
<a href="<?php echo esc_url( admin_url() ); ?>"><?php _e( 'Go to Dashboard &rarr; Home' ); ?></a>
</div>
Expand Down
37 changes: 25 additions & 12 deletions wp-admin/includes/update-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,11 @@ function update_core($from, $to) {

// Remove maintenance file, we're done.
$wp_filesystem->delete($maintenance_file);

// If we made it this far:
do_action( '_core_updated_successfully', $wp_version );

return $wp_version;
}

/**
Expand Down Expand Up @@ -525,21 +530,29 @@ function _copy_dir($from, $to, $skip_list = array() ) {
/**
* Redirect to the About WordPress page after a successful upgrade.
*
* This is a temporary function for the 3.3 upgrade only and will be removed in a later version.
*
* This function is only needed when the existing install is older than 3.3.0.
*
* @since 3.3.0
*
*/
function _redirect_to_about_wordpress() {
// Only for WP version < 3.3.0
if ( version_compare( $GLOBALS['wp_version'], '3.3.0', '>' ) )
return;
?>
function _redirect_to_about_wordpress( $wp_version ) {
// Load the updated default text localization domain for new strings
load_default_textdomain();

// See do_core_upgrade()
show_message( __('WordPress updated successfully') );
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>' );
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>' );
echo '</div>';
?>
<script type="text/javascript">
window.location = '<?php echo admin_url( 'about.php?upgraded' ); ?>';
window.location = '<?php echo admin_url( 'about.php?updated' ); ?>';
</script>
<?php
}
<?php

add_action( 'admin_footer-update-core.php', '_redirect_to_about_wordpress' );
?>
// Include admin-footer.php and exit
include(ABSPATH . 'wp-admin/admin-footer.php');
exit();
}
if ( version_compare( $GLOBALS['wp_version'], '3.3', '<' ) && 'update-core.php' == $pagenow )
add_action( '_core_updated_successfully', '_redirect_to_about_wordpress' );
17 changes: 13 additions & 4 deletions wp-admin/update-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -378,11 +378,20 @@ function do_core_upgrade( $reinstall = false ) {
show_message($result);
if ('up_to_date' != $result->get_error_code() )
show_message( __('Installation Failed') );
} else {
show_message( __('WordPress updated successfully') );
show_message( '<a href="' . esc_url( self_admin_url() ) . '">' . __('Go to Dashboard') . '</a>' );
echo '</div>';
return;
}
echo '</div>';

show_message( __('WordPress updated successfully') );
show_message( __('WordPress updated successfully') );
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>' );
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>' );
?>
</div>
<script type="text/javascript">
//window.location = '<?php echo admin_url( 'about.php?upgraded' ); ?>';
</script>
<?php
}

function do_dismiss_core_update() {
Expand Down

0 comments on commit e209ce5

Please sign in to comment.