Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r15590 r17926  
    2020         * constructor
    2121         *
    22          * @param mixed $arg ingored argument
    23          */
    24         function WP_Filesystem_Direct($arg) {
     22         * @param mixed $arg ignored argument
     23         */
     24        function __construct($arg) {
    2525                $this->method = 'direct';
    2626                $this->errors = new WP_Error();
    … …  
    194194        }
    195195
    196         function copy($source, $destination, $overwrite = false) {
     196        function copy($source, $destination, $overwrite = false, $mode = false) {
    197197                if ( ! $overwrite && $this->exists($destination) )
    198198                        return false;
    199199
    200                 return copy($source, $destination);
     200                $rtval = copy($source, $destination);
     201                if ( $mode )
     202                        $this->chmod($destination, $mode);
     203                return $rtval;
    201204        }
    202205
    … …  
    217220        }
    218221
    219         function delete($file, $recursive = false) {
     222        function delete($file, $recursive = false, $type = false) {
    220223                if ( empty($file) ) //Some filesystems report this as /, which can cause non-expected recursive deletion of all files in the filesystem.
    221224                        return false;
    222                 $file = str_replace('\\', '/', $file); //for win32, occasional problems deleteing files otherwise
    223 
    224                 if ( $this->is_file($file) )
     225                $file = str_replace('\\', '/', $file); //for win32, occasional problems deleting files otherwise
     226
     227                if ( 'f' == $type || $this->is_file($file) )
    225228                        return @unlink($file);
    226229                if ( ! $recursive && $this->is_dir($file) )
    … …  
    234237                if ( is_array($filelist) ) //false if no files, So check first.
    235238                        foreach ($filelist as $filename => $fileinfo)
    236                                 if ( ! $this->delete($file . $filename, $recursive) )
     239                                if ( ! $this->delete($file . $filename, $recursive, $fileinfo['type']) )
    237240                                        $retval = false;
    238241
Note: See TracChangeset for help on using the changeset viewer.