WordPress.org

Make WordPress Core

Ticket #14955: 14955.diff

File 14955.diff, 1013 bytes (added by greuben, 7 years ago)
  • wp-admin/includes/theme.php

     
    8787        if ( is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code() )
    8888                return new WP_Error('fs_error', __('Filesystem error.'), $wp_filesystem->errors);
    8989
    90         //Get the base plugin folder
     90        //Get the base theme folder
    9191        $themes_dir = $wp_filesystem->wp_themes_dir();
    9292        if ( empty($themes_dir) )
    9393                return new WP_Error('fs_no_themes_dir', __('Unable to locate WordPress theme directory.'));
    9494
    9595        $themes_dir = trailingslashit( $themes_dir );
    9696        $theme_dir = trailingslashit($themes_dir . $template);
     97
     98        if ( file_exists( $theme_dir . '/uninstall.php' ) ) {
     99                define( 'WP_UNINSTALL_THEME', true );
     100                include( $theme_dir . '/uninstall.php' );
     101        }
     102        do_action( 'uninstall_theme', $theme_dir );
     103
    97104        $deleted = $wp_filesystem->delete($theme_dir, true);
    98105
    99106        if ( ! $deleted )