WordPress.org

Make WordPress Core

Ticket #44710: 44710.diff

File 44710.diff, 824 bytes (added by sanket.parmar, 2 years ago)
  • wp-admin/includes/class-wp-upgrader.php

     
    793793                if ( is_wp_error( $result ) ) {
    794794                        $this->skin->error( $result );
    795795                        $this->skin->feedback( 'process_failed' );
     796
     797                        // If it's a theme or plugin, delete the uploaded one from uploads directory.
     798                        if ( ! empty( $options['package'] ) && ! empty( $options['hook_extra']['type'] ) && ( 'plugin' === $options['hook_extra']['type'] || 'theme' === $options['hook_extra']['type'] ) ) {
     799
     800                                global $wp_filesystem;
     801
     802                                $wp_filesystem->delete( $options['package'] );
     803                        }
    796804                } else {
    797805                        // Installation succeeded.
    798806                        $this->skin->feedback( 'process_success' );