Ticket #5586: 5586.diff

File 5586.diff, 2.8 kB (added by DD32, 5 months ago)
  • wp-admin/includes/class-wp-filesystem-direct.php

    old new  
    22 
    33class WP_Filesystem_Direct{ 
    44        var $permission = null; 
     5        var $errors = array(); 
    56        function WP_Filesystem_Direct($arg){ 
     7                $this->errors = new WP_Error(); 
    68                $this->permission = umask(); 
    79        } 
    810        function connect(){ 
     
    174176                if( $overwrite && $this->exists($destination) ) 
    175177                        return false; 
    176178                return copy($source,$destination); 
    177         } 
     179        } 
    178180 
    179181        function move($source,$destination,$overwrite=false){ 
    180182                //Possible to use rename() 
     
    184186                } else { 
    185187                        return false; 
    186188                } 
    187         } 
     189        } 
    188190 
    189191        function delete($file,$recursive=false){ 
    190192                $file = str_replace('\\','/',$file); //for win32, occasional problems deleteing files otherwise 
     193 
    191194                if( $this->is_file($file) ) 
    192195                        return @unlink($file); 
    193                 if( !$recursive ) 
     196 
     197                if( !$recursive && $this->is_dir($file) ) 
    194198                        return @rmdir($file); 
     199 
    195200                $filelist = $this->dirlist($file); 
     201                if( ! $filelist ) 
     202                        return true; //No files exist, Say we've deleted them 
    196203 
    197204                $retval = true; 
    198205                foreach($filelist as $filename=>$fileinfo){ 
     
    206213         
    207214        function exists($file){ 
    208215                return @file_exists($file); 
    209         } 
     216        } 
    210217 
    211218        function is_file($file){ 
    212219                return @is_file($file); 
    213         } 
     220        } 
    214221 
    215222        function is_dir($path){ 
    216223                return @is_dir($path); 
    217         } 
     224        } 
    218225 
    219226        function is_readable($file){ 
    220227                        return @is_readable($file); 
    221         } 
     228        } 
    222229 
    223230        function is_writable($file){ 
    224231                return @is_writable($file); 
     
    226233         
    227234        function atime($file){ 
    228235                return @fileatime($file); 
    229         } 
     236        } 
    230237 
    231238        function mtime($file){ 
    232239                return @filemtime($file); 
    233240        } 
    234241        function size($file){ 
    235242                return @filesize($file); 
    236         } 
     243        } 
    237244 
    238245        function touch($file,$time=0,$atime=0){ 
    239246                if($time==0) 
     
    254261                if( $chgrp ) 
    255262                        $this->chgrp($path,$chgrp); 
    256263                return true; 
    257         } 
     264        } 
    258265 
    259266        function rmdir($path,$recursive=false){ 
    260267                if( ! $recursive ) 
     
    320327                $dir->close(); 
    321328                unset($dir); 
    322329                return $ret; 
    323         } 
     330        } 
    324331 
    325332        function __destruct(){ 
    326333                return; 
  • wp-admin/includes/update.php

    old new  
    178178        $plugin_dir = dirname(ABSPATH . PLUGINDIR . "/$plugin"); 
    179179 
    180180        // If plugin is in its own directory, recursively delete the directory. 
    181         if ( '.' != $plugin_dir
     181        if ( '.' != $plugin_dir && ABSPATH . PLUGINDIR != $plugin_dir
    182182                $wp_filesystem->delete($plugin_dir, true); 
    183183 
    184184        apply_filters('update_feedback', __("Installing the latest version"));