WordPress.org

Make WordPress Core


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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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 ) {
Note: See TracChangeset for help on using the changeset viewer.