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.


git-svn-id: http://svn.automattic.com/wordpress/trunk@19524 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2011-12-01 04:38:51 +00:00
parent 94f091afb9
commit e209ce5948
3 changed files with 44 additions and 20 deletions

View File

@ -160,8 +160,10 @@ include( './admin-header.php' );
</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>

View File

@ -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;
}
/**
@ -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;
?>
<script type="text/javascript">
window.location = '<?php echo admin_url( 'about.php?upgraded' ); ?>';
</script>
<?php
}
function _redirect_to_about_wordpress( $wp_version ) {
// Load the updated default text localization domain for new strings
load_default_textdomain();
add_action( 'admin_footer-update-core.php', '_redirect_to_about_wordpress' );
?>
// 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?updated' ); ?>';
</script>
<?php
// 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' );

View File

@ -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() {