WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/27/2008 05:55:24 PM (14 years ago)
Author:
ryan
Message:

Allow wp-content to exist outside of webroot. Props sambauers. see #6938

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/update.php

    r7547 r7999  
    160160        return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem->errors);
    161161
    162     //Get the Base folder
    163     $base = $wp_filesystem->get_base_dir();
     162    //Get the base plugin folder
     163    $base = $wp_filesystem->get_base_dir(WP_PLUGIN_DIR);
    164164   
    165165    if ( empty($base) )
     
    180180        return new WP_Error('download_failed', __('Download failed.'), $file->get_error_message());
    181181
    182     $working_dir = $base . 'wp-content/upgrade/' . basename($plugin, '.php');
     182    $working_dir = $wp_filesystem->get_base_dir(WP_CONTENT_DIR) . '/upgrade/' . basename($plugin, '.php');
    183183
    184184    // Clean up working directory
     
    206206    // Remove the existing plugin.
    207207    apply_filters('update_feedback', __('Removing the old version of the plugin'));
    208     $plugin_dir = dirname($base . PLUGINDIR . "/$plugin");
     208    $plugin_dir = dirname($base . "/$plugin");
    209209    $plugin_dir = trailingslashit($plugin_dir);
    210210   
    211211    // If plugin is in its own directory, recursively delete the directory.
    212     if ( strpos($plugin, '/') && $plugin_dir != $base . PLUGINDIR . '/' ) //base check on if plugin includes directory seperator AND that its not the root plugin folder
     212    if ( strpos($plugin, '/') && $plugin_dir != $base . '/' ) //base check on if plugin includes directory seperator AND that its not the root plugin folder
    213213        $deleted = $wp_filesystem->delete($plugin_dir, true);
    214214    else
    215         $deleted = $wp_filesystem->delete($base . PLUGINDIR . "/$plugin");
     215        $deleted = $wp_filesystem->delete($base . '/' . $plugin);
    216216
    217217    if ( !$deleted ) {
     
    222222    apply_filters('update_feedback', __('Installing the latest version'));
    223223    // Copy new version of plugin into place.
    224     if ( !copy_dir($working_dir, $base . PLUGINDIR) ) {
     224    if ( !copy_dir($working_dir, $base) ) {
    225225        //$wp_filesystem->delete($working_dir, true); //TODO: Uncomment? This DOES mean that the new files are available in the upgrade folder if it fails.
    226226        return new WP_Error('install_failed', __('Installation failed'));
Note: See TracChangeset for help on using the changeset viewer.