WordPress.org

Make WordPress Core

Changeset 12997


Ignore:
Timestamp:
02/07/10 01:12:29 (4 years ago)
Author:
dd32
Message:

Fix recursive chmod for WP_Filesystem. Props reaperhulk for FtpExt. Fixes #11261

Location:
trunk/wp-admin/includes
Files:
3 edited

Legend:

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

    r12741 r12997  
    136136        $file = trailingslashit($file); 
    137137        $filelist = $this->dirlist($file); 
    138         foreach ($filelist as $filename) 
     138        foreach ( (array)$filelist as $filename => $filemeta) 
    139139            $this->chmod($file . $filename, $mode, $recursive); 
    140140 
  • trunk/wp-admin/includes/class-wp-filesystem-ftpext.php

    r12733 r12997  
    155155        } 
    156156 
    157         if ( ! $recursive || ! $this->is_dir($file) ) { 
    158             if ( ! function_exists('ftp_chmod') ) 
    159                 return @ftp_site($this->link, sprintf('CHMOD %o %s', $mode, $file)); 
    160             return @ftp_chmod($this->link, $mode, $file); 
    161         } 
    162         //Is a directory, and we want recursive 
    163         $filelist = $this->dirlist($file); 
    164         foreach ( $filelist as $filename ) { 
    165             $this->chmod($file . '/' . $filename, $mode, $recursive); 
    166         } 
    167         return true; 
     157        // chmod any sub-objects if recursive. 
     158        if ( $recursive && $this->is_dir($file) ) { 
     159            $filelist = $this->dirlist($file); 
     160            foreach ( (array)$filelist as $filename => $filemeta ) 
     161                $this->chmod($file . '/' . $filename, $mode, $recursive); 
     162        } 
     163 
     164        // chmod the file or directory 
     165        if ( ! function_exists('ftp_chmod') ) 
     166            return @ftp_site($this->link, sprintf('CHMOD %o %s', $mode, $file)); 
     167        return @ftp_chmod($this->link, $mode, $file); 
    168168    } 
    169169    function chown($file, $owner, $recursive = false ) { 
  • trunk/wp-admin/includes/class-wp-filesystem-ftpsockets.php

    r12723 r12997  
    165165        } 
    166166 
    167         if ( ! $recursive || ! $this->is_dir($file) ) { 
    168             return $this->ftp->chmod($file, $mode); 
    169         } 
    170  
    171         //Is a directory, and we want recursive 
    172         $filelist = $this->dirlist($file); 
    173         foreach ( $filelist as $filename ) 
    174             $this->chmod($file . '/' . $filename, $mode, $recursive); 
    175  
    176         return true; 
     167        // chmod any sub-objects if recursive. 
     168        if ( $recursive && $this->is_dir($file) ) { 
     169            $filelist = $this->dirlist($file); 
     170            foreach ( (array)$filelist as $filename => $filemeta ) 
     171                $this->chmod($file . '/' . $filename, $mode, $recursive); 
     172        } 
     173 
     174        // chmod the file or directory 
     175        return $this->ftp->chmod($file, $mode); 
    177176    } 
    178177 
Note: See TracChangeset for help on using the changeset viewer.