Make WordPress Core


Ignore:
Timestamp:
02/07/2010 01:31:40 AM (14 years ago)
Author:
dd32
Message:

Reduce code duplication, Formatting cleanups, Reduce Chmod IO calls. See #10913 for excess IO calls.

File:
1 edited

Legend:

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

    r12997 r12998  
    117117     */
    118118    function chmod($file, $mode = false, $recursive = false) {
    119         if ( ! $this->exists($file) )
    120             return false;
    121 
    122119        if ( ! $mode ) {
    123120            if ( $this->is_file($file) )
     
    129126        }
    130127
    131         if ( ! $recursive )
    132             return @chmod($file, $mode);
    133         if ( ! $this->is_dir($file) )
     128        if ( ! $recursive || ! $this->is_dir($file) )
    134129            return @chmod($file, $mode);
    135130        //Is a directory, and we want recursive
     
    299294
    300295    function rmdir($path, $recursive = false) {
    301         //Currently unused and untested, Use delete() instead.
    302         if ( ! $recursive )
    303             return @rmdir($path);
    304         //recursive:
    305         $filelist = $this->dirlist($path);
    306         foreach ($filelist as $filename => $det) {
    307             if ( '/' == substr($filename, -1, 1) )
    308                 $this->rmdir($path . '/' . $filename, $recursive);
    309             @rmdir($filename);
    310         }
    311         return @rmdir($path);
     296        return $this->delete($path, $recursive);
    312297    }
    313298
Note: See TracChangeset for help on using the changeset viewer.