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