Fix reinstall

git-svn-id: http://svn.automattic.com/wordpress/trunk@10166 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-12-10 07:59:05 +00:00
parent 6aa69d6500
commit 5b86bfc9c1
1 changed files with 14 additions and 4 deletions

View File

@ -19,6 +19,7 @@ function list_core_update( $update ) {
if ( !isset($update->response) || 'latest' == $update->response )
$current = true;
$submit = __('Upgrade Automatically');
$form_action = 'update-core.php?action=do-core-upgrade';
if ( 'development' == $update->response ) {
$message = __('You are using a development version of WordPress. You can upgrade to the latest nightly build automatically or download the nightly build and install it manually:');
$download = __('Download nightly build');
@ -26,6 +27,7 @@ function list_core_update( $update ) {
if ( $current ) {
$message = sprintf(__('You have the latest version of WordPress. You do not need to upgrade. However, if you want to re-install version %s, you can do so automatically or download the package and re-install manually:'), $version_string);
$submit = __('Re-install Automatically');
$form_action = 'update-core.php?action=do-core-reinstall';
} else {
$message = sprintf(__('You can upgrade to version %s automatically or download the package and install it manually:'), $version_string);
}
@ -35,7 +37,7 @@ function list_core_update( $update ) {
echo '<p>';
echo $message;
echo '</p>';
echo '<form method="post" action="update-core.php?action=do-core-upgrade" name="upgrade" class="upgrade">';
echo '<form method="post" action="' . $form_action . '" name="upgrade" class="upgrade">';
wp_nonce_field('upgrade-core');
echo '<p>';
echo '<input id="upgrade" class="button" type="submit" value="' . $submit . '" name="upgrade" />&nbsp;';
@ -129,7 +131,7 @@ function core_upgrade_preamble() {
*
* @return null
*/
function do_core_upgrade() {
function do_core_upgrade( $reinstall = false ) {
global $wp_filesystem;
$url = wp_nonce_url('update-core.php?action=do-core-upgrade', 'upgrade-core');
@ -159,6 +161,9 @@ function do_core_upgrade() {
return;
}
if ( $reinstall )
$update->response = 'reinstall';
$result = wp_update_core($update, 'show_message');
if ( is_wp_error($result) ) {
@ -199,7 +204,7 @@ if ( 'upgrade-core' == $action ) {
require_once('admin-header.php');
core_upgrade_preamble();
include('admin-footer.php');
} elseif ( 'do-core-upgrade' == $action ) {
} elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) {
check_admin_referer('upgrade-core');
$title = __('Upgrade WordPress');
$parent_file = 'tools.php';
@ -210,7 +215,12 @@ if ( 'upgrade-core' == $action ) {
elseif ( isset( $_POST['undismiss'] ) )
do_undismiss_core_update();
require_once('admin-header.php');
if ( 'do-core-reinstall' == $action )
$reinstall = true;
else
$reinstall = false;
if ( isset( $_POST['upgrade'] ) )
do_core_upgrade();
do_core_upgrade($reinstall);
include('admin-footer.php');
}?>