From ea3a169b6f03495f994eca33305e67bf324021c6 Mon Sep 17 00:00:00 2001 From: dd32 Date: Sun, 28 Aug 2011 03:51:35 +0000 Subject: [PATCH] Clean up Plugin/Theme uploads after successfully installing them. Restores pre-3.2 behaviour. See #18182 git-svn-id: http://svn.automattic.com/wordpress/trunk@18614 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-upgrader.php | 6 ++++++ wp-admin/update.php | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/wp-admin/includes/class-wp-upgrader.php b/wp-admin/includes/class-wp-upgrader.php index 532d027ba6..32e74c0ecd 100644 --- a/wp-admin/includes/class-wp-upgrader.php +++ b/wp-admin/includes/class-wp-upgrader.php @@ -1458,4 +1458,10 @@ class File_Upload_Upgrader { $this->package = $uploads['basedir'] . '/' . $this->filename; } } + + function cleanup() { + if ( file_exists($this->package) ) + return @unlink($this->package); + return true; + } } \ No newline at end of file diff --git a/wp-admin/update.php b/wp-admin/update.php index e529064eed..cbaee95859 100644 --- a/wp-admin/update.php +++ b/wp-admin/update.php @@ -140,6 +140,8 @@ if ( isset($_GET['action']) ) { $upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) ); $upgrader->install( $file_upload->package ); + $file_upload->cleanup(); + include(ABSPATH . 'wp-admin/admin-footer.php'); } elseif ( 'upgrade-theme' == $action ) { @@ -242,6 +244,8 @@ if ( isset($_GET['action']) ) { $upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) ); $upgrader->install( $file_upload->package ); + $file_upload->cleanup(); + include(ABSPATH . 'wp-admin/admin-footer.php'); } else {