Landing page for auto upgrade. see #5560

git-svn-id: http://svn.automattic.com/wordpress/trunk@8597 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-08-09 03:20:16 +00:00
parent 33a187a61e
commit c0e5180448
2 changed files with 44 additions and 4 deletions

View File

@ -15,7 +15,7 @@ function core_update_footer( $msg = '' ) {
switch ( $cur->response ) {
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;
case 'upgrade' :
@ -39,7 +39,7 @@ function update_nag() {
return false;
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
$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'] );
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>";
}

View File

@ -44,6 +44,40 @@ function do_plugin_upgrade($plugin) {
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() {
global $wp_filesystem;
@ -118,7 +152,13 @@ wp_admin_css( 'colors', true );
}
echo "</body></html>";
} 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');
$parent_file = 'index.php';
require_once('admin-header.php');