Landing page for auto upgrade. see #5560

git-svn-id: https://develop.svn.wordpress.org/trunk@8597 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2008-08-09 03:20:16 +00:00
parent d48b376956
commit a5b9f74038
2 changed files with 44 additions and 4 deletions

View File

@ -15,7 +15,7 @@ function core_update_footer( $msg = '' ) {
switch ( $cur->response ) { switch ( $cur->response ) {
case 'development' : case 'development' :
return sprintf( '| '.__( 'You are using a development version (%1$s). Cool! Please <a href="%2$s">stay updated</a>.' ), $GLOBALS['wp_version'], wp_nonce_url('update.php?action=upgrade-core', 'upgrade-core')); return sprintf( '| '.__( 'You are using a development version (%1$s). Cool! Please <a href="%2$s">stay updated</a>.' ), $GLOBALS['wp_version'], 'update.php?action=upgrade-core');
break; break;
case 'upgrade' : case 'upgrade' :
@ -39,7 +39,7 @@ function update_nag() {
return false; return false;
if ( current_user_can('manage_options') ) if ( current_user_can('manage_options') )
$msg = sprintf( __('WordPress %1$s is available! <a href="%2$s">Please update now</a>.'), $cur->current, wp_nonce_url('update.php?action=upgrade-core', 'upgrade-core') ); $msg = sprintf( __('WordPress %1$s is available! <a href="%2$s">Please update now</a>.'), $cur->current, 'update.php?action=upgrade-core' );
else else
$msg = sprintf( __('WordPress %1$s is available! Please notify the site administrator.'), $cur->current ); $msg = sprintf( __('WordPress %1$s is available! Please notify the site administrator.'), $cur->current );
@ -53,7 +53,7 @@ function update_right_now_message() {
$msg = sprintf( __('This is WordPress version %s.'), $GLOBALS['wp_version'] ); $msg = sprintf( __('This is WordPress version %s.'), $GLOBALS['wp_version'] );
if ( isset( $cur->response ) && $cur->response == 'upgrade' && current_user_can('manage_options') ) if ( isset( $cur->response ) && $cur->response == 'upgrade' && current_user_can('manage_options') )
$msg .= " <a href='" . wp_nonce_url('update.php?action=upgrade-core', 'upgrade-core') . "' class='rbutton'>" . sprintf( __('Update to %s'), $cur->current ? $cur->current : __( 'Latest' ) ) . '</a>'; $msg .= " <a href='update.php?action=upgrade-core' class='rbutton'>" . sprintf( __('Update to %s'), $cur->current ? $cur->current : __( 'Latest' ) ) . '</a>';
echo "<span id='wp-version-message'>$msg</span>"; echo "<span id='wp-version-message'>$msg</span>";
} }

View File

@ -44,6 +44,40 @@ function do_plugin_upgrade($plugin) {
echo '</div>'; echo '</div>';
} }
function core_upgrade_preamble() {
$update = get_option('update_core');
echo '<div class="wrap">';
echo '<h2>' . __('Upgrade WordPress') . '</h2>';
if ( !isset($update->response) || 'latest' == $update->response ) {
_e('You have the latest version of WordPress. You do not need to upgrade.');
echo '</div>';
return;
}
if ( 'development' == $update->response ) {
$message = __('You are using a developmemt version of WordPress. You can upgrade to the latest nightly build automatically or download the nightly build and install it manually. Which would you like to do?');
$submit = __('Download nightly build');
} else {
$message = sprintf(__('You can upgrade to version %s automatically or download the nightly build and install it manually. Which would you like to do?'), $update->current);
$submit = sprintf(__('Download %s'), $update->current);
}
echo '<p>';
echo $message;
echo '</p>';
echo '<form id="post" method="post" action="update.php?action=do-core-upgrade" name="upgrade">';
wp_nonce_field('upgrade-core');
echo '<p>';
echo '<input id="upgrade" class="button" type="submit" value="' . __('Upgrade Automatically') . '" name="upgrade" />';
echo '<a href="' . $update->package . '" class="button">' . $submit . '</a>';
echo '</p>';
echo '</form>';
echo '</div>';
}
function do_core_upgrade() { function do_core_upgrade() {
global $wp_filesystem; global $wp_filesystem;
@ -118,7 +152,13 @@ wp_admin_css( 'colors', true );
} }
echo "</body></html>"; echo "</body></html>";
} elseif ( 'upgrade-core' == $_GET['action'] ) { } elseif ( 'upgrade-core' == $_GET['action'] ) {
//check_admin_referer('upgrade-core'); $title = __('Upgrade WordPress');
$parent_file = 'index.php';
require_once('admin-header.php');
core_upgrade_preamble();
include('admin-footer.php');
} elseif ( 'do-core-upgrade' ) {
check_admin_referer('upgrade-core');
$title = __('Upgrade WordPress'); $title = __('Upgrade WordPress');
$parent_file = 'index.php'; $parent_file = 'index.php';
require_once('admin-header.php'); require_once('admin-header.php');