Changeset 7155

Show
Ignore:
Timestamp:
03/04/08 17:10:17 (4 months ago)
Author:
ryan
Message:

wp-fs fixes from DD32. see #5586

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/includes/class-wp-filesystem-direct.php

    r7130 r7155  
    1414        $this->permission = $perm; 
    1515    } 
    16     function find_base_dir($base = '.'){ 
     16    function find_base_dir($base = '.', $echo = false){ 
    1717        return str_replace('\\','/',ABSPATH); 
    1818    } 
    19     function get_base_dir($base = '.'){ 
    20         return str_replace('\\','/',ABSPATH); 
     19    function get_base_dir($base = '.', $echo = false){ 
     20        return find_base_dir($base, $echo); 
    2121    } 
    2222    function get_contents($file){ 
  • trunk/wp-admin/includes/class-wp-filesystem-ftpext.php

    r7130 r7155  
    6363    function connect(){ 
    6464        if ( $this->options['ssl'] && function_exists('ftp_ssl_connect') ) { 
    65             $this->link = ftp_ssl_connect($this->options['hostname'], $this->options['port'],$this->timeout); 
     65            $this->link = @ftp_ssl_connect($this->options['hostname'], $this->options['port'],$this->timeout); 
    6666        } else { 
    67             $this->link = ftp_connect($this->options['hostname'], $this->options['port'],$this->timeout); 
     67            $this->link = @ftp_connect($this->options['hostname'], $this->options['port'],$this->timeout); 
    6868        } 
    6969 
     
    7373        } 
    7474 
    75         if ( ! ftp_login($this->link,$this->options['username'], $this->options['password']) ) { 
     75        if ( ! @ftp_login($this->link,$this->options['username'], $this->options['password']) ) { 
    7676            $this->errors->add('auth', sprintf(__('Username/Password incorrect for %s'), $this->options['username'])); 
    7777            return false; 
     
    120120        return $this->find_base_dir('/',$echo); 
    121121    } 
    122     function get_base_dir($base = '.'){ 
     122    function get_base_dir($base = '.', $echo=false){ 
    123123        if( empty($this->wp_base) ) 
    124             $this->wp_base = $this->find_base_dir($base); 
     124            $this->wp_base = $this->find_base_dir($base,$echo); 
    125125        return $this->wp_base; 
    126126    } 
     
    299299    function is_dir($path){ 
    300300        $cwd = $this->cwd(); 
    301         if ( @ftp_chdir($this->link, $path) ) { 
     301        @ftp_chdir($this->link, $path); 
     302        if ( $this->cwd() != $cwd ) { 
    302303            @ftp_chdir($this->link, $cwd); 
    303304            return true; 
     
    326327    } 
    327328    function mkdir($path,$chmod=false,$chown=false,$chgrp=false){ 
    328         if( !ftp_mkdir($this->link, $path) ) 
     329        if( !@ftp_mkdir($this->link, $path) ) 
    329330            return false; 
    330331        if( $chmod ) 
     
    338339    function rmdir($path,$recursive=false){ 
    339340        if( ! $recursive ) 
    340             return ftp_rmdir($this->link, $file); 
     341            return @ftp_rmdir($this->link, $file); 
    341342 
    342343        //TODO: Recursive Directory delete, Have to delete files from the folder first. 
  • trunk/wp-admin/includes/class-wp-filesystem-ftpsockets.php

    r7130 r7155  
    123123    } 
    124124 
    125     function get_base_dir($base = '.'){ 
     125    function get_base_dir($base = '.', $echo = false){ 
    126126        if( empty($this->wp_base) ) 
    127             $this->wp_base = $this->find_base_dir($base); 
     127            $this->wp_base = $this->find_base_dir($base, $echo); 
    128128        return $this->wp_base; 
    129129    } 
  • 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'));