Make WordPress Core

Ticket #22501: class-wp-upgrader.get_theme_root.patch

File class-wp-upgrader.get_theme_root.patch, 2.5 KB (added by toscho, 12 years ago)

Replace fixed path with get_theme_root()

  • class-wp-upgrader.php

     
    9292                                        if ( ! $wp_filesystem->wp_plugins_dir() )
    9393                                                return new WP_Error('fs_no_plugins_dir', $this->strings['fs_no_plugins_dir']);
    9494                                        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() ) )
    9797                                                return new WP_Error('fs_no_themes_dir', $this->strings['fs_no_themes_dir']);
    9898                                        break;
    9999                                default:
     
    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, array(ABSPATH, WP_CONTENT_DIR, WP_PLUGIN_DIR, get_theme_root()) ) ) {
    211211                        $remote_destination = trailingslashit($remote_destination) . trailingslashit(basename($source));
    212212                        $destination = trailingslashit($destination) . trailingslashit(basename($source));
    213213                }
     
    715715                // Install the parent theme
    716716                $parent_result = $this->run( array(
    717717                        'package' => $api->download_link,
    718                         'destination' => WP_CONTENT_DIR . '/themes',
     718                        'destination' => get_theme_root(),
    719719                        'clear_destination' => false, //Do not overwrite files.
    720720                        'clear_working' => true
    721721                ) );
     
    749749
    750750                $options = array(
    751751                                                'package' => $package,
    752                                                 'destination' => WP_CONTENT_DIR . '/themes',
     752                                                'destination' => get_theme_root(),
    753753                                                'clear_destination' => false, //Do not overwrite files.
    754754                                                'clear_working' => true
    755755                                                );
     
    791791
    792792                $options = array(
    793793                                                'package' => $r['package'],
    794                                                 'destination' => WP_CONTENT_DIR . '/themes',
     794                                                'destination' => get_theme_root(),
    795795                                                'clear_destination' => true,
    796796                                                'clear_working' => true,
    797797                                                'hook_extra' => array(
     
    867867
    868868                        $options = array(
    869869                                                        'package' => $r['package'],
    870                                                         'destination' => WP_CONTENT_DIR . '/themes',
     870                                                        'destination' => get_theme_root(),
    871871                                                        'clear_destination' => true,
    872872                                                        'clear_working' => true,
    873873                                                        'hook_extra' => array(
     
    989989                        else
    990990                                return false;
    991991                }
    992                 return wp_get_theme( $theme, WP_CONTENT_DIR . '/themes/' );
     992                return wp_get_theme( $theme, get_theme_root() . '/' );
    993993        }
    994994
    995995}