Ticket #22501: class-wp-upgrader.get_theme_root.patch
File class-wp-upgrader.get_theme_root.patch, 2.5 KB (added by , 12 years ago) |
---|
-
class-wp-upgrader.php
92 92 if ( ! $wp_filesystem->wp_plugins_dir() ) 93 93 return new WP_Error('fs_no_plugins_dir', $this->strings['fs_no_plugins_dir']); 94 94 break; 95 case WP_CONTENT_DIR . '/themes':96 if ( ! $wp_filesystem->find_folder( WP_CONTENT_DIR . '/themes') )95 case get_theme_root(): 96 if ( ! $wp_filesystem->find_folder( get_theme_root() ) ) 97 97 return new WP_Error('fs_no_themes_dir', $this->strings['fs_no_themes_dir']); 98 98 break; 99 99 default: … … 207 207 $source_files = array_keys( $wp_filesystem->dirlist($source) ); 208 208 209 209 //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, array(ABSPATH, WP_CONTENT_DIR, WP_PLUGIN_DIR, get_theme_root()) ) ) { 211 211 $remote_destination = trailingslashit($remote_destination) . trailingslashit(basename($source)); 212 212 $destination = trailingslashit($destination) . trailingslashit(basename($source)); 213 213 } … … 715 715 // Install the parent theme 716 716 $parent_result = $this->run( array( 717 717 'package' => $api->download_link, 718 'destination' => WP_CONTENT_DIR . '/themes',718 'destination' => get_theme_root(), 719 719 'clear_destination' => false, //Do not overwrite files. 720 720 'clear_working' => true 721 721 ) ); … … 749 749 750 750 $options = array( 751 751 'package' => $package, 752 'destination' => WP_CONTENT_DIR . '/themes',752 'destination' => get_theme_root(), 753 753 'clear_destination' => false, //Do not overwrite files. 754 754 'clear_working' => true 755 755 ); … … 791 791 792 792 $options = array( 793 793 'package' => $r['package'], 794 'destination' => WP_CONTENT_DIR . '/themes',794 'destination' => get_theme_root(), 795 795 'clear_destination' => true, 796 796 'clear_working' => true, 797 797 'hook_extra' => array( … … 867 867 868 868 $options = array( 869 869 'package' => $r['package'], 870 'destination' => WP_CONTENT_DIR . '/themes',870 'destination' => get_theme_root(), 871 871 'clear_destination' => true, 872 872 'clear_working' => true, 873 873 'hook_extra' => array( … … 989 989 else 990 990 return false; 991 991 } 992 return wp_get_theme( $theme, WP_CONTENT_DIR . '/themes/' );992 return wp_get_theme( $theme, get_theme_root() . '/' ); 993 993 } 994 994 995 995 }