WordPress.org

Make WordPress Core

Ticket #14955: 14955.1.diff

File 14955.1.diff, 1.2 KB (added by obenland, 23 months ago)

Refreshed patch

  • wp-admin/includes/theme.php

     
    5555        if ( is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code() ) 
    5656                return new WP_Error('fs_error', __('Filesystem error.'), $wp_filesystem->errors); 
    5757 
    58         //Get the base plugin folder 
     58        //Get the base theme folder 
    5959        $themes_dir = $wp_filesystem->wp_themes_dir(); 
    6060        if ( empty($themes_dir) ) 
    6161                return new WP_Error('fs_no_themes_dir', __('Unable to locate WordPress theme directory.')); 
    6262 
    6363        $themes_dir = trailingslashit( $themes_dir ); 
    64         $theme_dir = trailingslashit($themes_dir . $stylesheet); 
    65         $deleted = $wp_filesystem->delete($theme_dir, true); 
     64        $theme_dir  = trailingslashit( $themes_dir . $stylesheet ); 
     65 
     66        if ( file_exists( $theme_dir . '/uninstall.php' ) ) { 
     67                define( 'WP_UNINSTALL_THEME', true ); 
     68                include( $theme_dir . '/uninstall.php' ); 
     69        } 
     70        do_action( 'uninstall_theme', $theme_dir ); 
     71 
     72        $deleted = $wp_filesystem->delete( $theme_dir, true ); 
    6673 
    6774        if ( ! $deleted ) 
    6875                return new WP_Error('could_not_remove_theme', sprintf(__('Could not fully remove the theme %s.'), $stylesheet) );