WordPress.org

Make WordPress Core

Ticket #20437: upgrader_base_dirs_filter.patch

File upgrader_base_dirs_filter.patch, 867 bytes (added by usermrpapa, 2 years ago)
  • wp-admin/includes/class-wp-upgrader.php

     
    207207                        $source_files = array_keys( $wp_filesystem->dirlist($source) ); 
    208208 
    209209                //Protection against deleting files in any important base directories. 
    210                 if ( in_array( $destination, array(ABSPATH, WP_CONTENT_DIR, WP_PLUGIN_DIR, WP_CONTENT_DIR . '/themes') ) ) { 
     210                if ( in_array( $destination, apply_filters( 'upgrader_base_directories', array(ABSPATH, WP_CONTENT_DIR, WP_PLUGIN_DIR, WP_CONTENT_DIR . '/themes') ) ) ) { 
    211211                        $remote_destination = trailingslashit($remote_destination) . trailingslashit(basename($source)); 
    212212                        $destination = trailingslashit($destination) . trailingslashit(basename($source)); 
    213213                }