Make WordPress Core


Ignore:
Timestamp:
03/04/2008 05:10:17 PM (17 years ago)
Author:
ryan
Message:

wp-fs fixes from DD32. see #5586

File:
1 edited

Legend:

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

    r7130 r7155  
    141141        return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem->errors);
    142142
     143    //Get the Base folder
     144    $base = $wp_filesystem->get_base_dir();
     145
    143146    // Get the URL to the zip file
    144147    $r = $current->response[ $plugin ];
     
    149152    // Download the package
    150153    $package = $r->package;
    151     apply_filters('update_feedback', __("Downloading update from $package"));
     154    apply_filters('update_feedback', sprintf(__("Downloading update from %s"), $package));
    152155    $file = download_url($package);
    153156
     
    156159
    157160    $name = basename($plugin, '.php');
    158     $working_dir = ABSPATH . 'wp-content/upgrade/' . $name;
     161    $working_dir = $base . 'wp-content/upgrade/' . $name;
    159162
    160163    // Clean up working directory
     
    176179    // Remove the existing plugin.
    177180    apply_filters('update_feedback', __("Removing the old version of the plugin"));
    178     $plugin_dir = dirname(ABSPATH . PLUGINDIR . "/$plugin");
     181    $plugin_dir = dirname($base . PLUGINDIR . "/$plugin");
     182    $plugin_dir = trailingslashit($plugin_dir);
    179183    // If plugin is in its own directory, recursively delete the directory.
    180     if ( '.' != $plugin_dir && ABSPATH . PLUGINDIR != $plugin_dir )
     184    if ( '.' != $plugin_dir && $base . PLUGINDIR != $plugin_dir )
    181185        $deleted = $wp_filesystem->delete($plugin_dir, true);
    182186    else
    183         $deleted = $wp_filesystem->delete(ABSPATH . PLUGINDIR . "/$plugin");
     187        $deleted = $wp_filesystem->delete($base . PLUGINDIR . "/$plugin");
    184188    if ( !$deleted ) {
    185189        $wp_filesystem->delete($working_dir, true);
     
    189193    apply_filters('update_feedback', __("Installing the latest version"));
    190194    // Copy new version of plugin into place.
    191     if ( !copy_dir($working_dir, ABSPATH . PLUGINDIR) ) {
     195    if ( !copy_dir($working_dir, $base . PLUGINDIR) ) {
    192196        //$wp_filesystem->delete($working_dir, true);
    193197        return new WP_Error('install_failed', __('Installation failed'));
Note: See TracChangeset for help on using the changeset viewer.