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
This commit is contained in:
dd32 2011-08-28 03:51:35 +00:00
parent f1ac48873b
commit ea3a169b6f
2 changed files with 10 additions and 0 deletions

View File

@ -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;
}
}

View File

@ -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 {