From b16b6f8a3127be46893d16602cbfaa231d817994 Mon Sep 17 00:00:00 2001 From: dd32 Date: Sun, 28 Aug 2011 05:51:38 +0000 Subject: [PATCH] Only clean up the uploaded files after a successful (or failed) install. Allows files to persist past the FTP credential screen. See #18182 git-svn-id: http://svn.automattic.com/wordpress/trunk@18616 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-upgrader.php | 9 +++++---- wp-admin/update.php | 10 ++++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/wp-admin/includes/class-wp-upgrader.php b/wp-admin/includes/class-wp-upgrader.php index 32e74c0ecd..2ab5e002a1 100644 --- a/wp-admin/includes/class-wp-upgrader.php +++ b/wp-admin/includes/class-wp-upgrader.php @@ -399,9 +399,13 @@ class Plugin_Upgrader extends WP_Upgrader { 'hook_extra' => array() )); + if ( ! $this->result || is_wp_error($this->result) ) + return $this->result; + // Force refresh of plugin update information delete_site_transient('update_plugins'); + return true; } function upgrade($plugin) { @@ -646,10 +650,7 @@ class Theme_Upgrader extends WP_Upgrader { // Force refresh of theme update information delete_site_transient('update_themes'); - if ( empty($result['destination_name']) ) - return false; - else - return $result['destination_name']; + return true; } function upgrade($theme) { diff --git a/wp-admin/update.php b/wp-admin/update.php index cbaee95859..a37f05060a 100644 --- a/wp-admin/update.php +++ b/wp-admin/update.php @@ -138,9 +138,10 @@ if ( isset($_GET['action']) ) { $type = 'upload'; //Install plugin type, From Web or an Upload. $upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) ); - $upgrader->install( $file_upload->package ); + $result = $upgrader->install( $file_upload->package ); - $file_upload->cleanup(); + if ( $result || is_wp_error($result) ) + $file_upload->cleanup(); include(ABSPATH . 'wp-admin/admin-footer.php'); @@ -242,9 +243,10 @@ if ( isset($_GET['action']) ) { $type = 'upload'; //Install plugin type, From Web or an Upload. $upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) ); - $upgrader->install( $file_upload->package ); + $result = $upgrader->install( $file_upload->package ); - $file_upload->cleanup(); + if ( $result || is_wp_error($result) ) + $file_upload->cleanup(); include(ABSPATH . 'wp-admin/admin-footer.php');