[wp-trac] [WordPress Trac] #11261: method chmod in class-wp-filesystem-ftpext doesn't work in recursive mode

WordPress Trac wp-trac at lists.automattic.com
Wed Nov 25 13:56:05 UTC 2009


#11261: method chmod in class-wp-filesystem-ftpext doesn't work in recursive mode
--------------------------+-------------------------------------------------
 Reporter:  G.Hue         |       Owner:                                               
     Type:  defect (bug)  |      Status:  new                                          
 Priority:  normal        |   Milestone:  Unassigned                                   
Component:  General       |     Version:  2.8.4                                        
 Severity:  normal        |    Keywords:  ftpext, chmod, class-wp-filesystem-ftpext.php
--------------------------+-------------------------------------------------
 The following code doesn't work when recursive mode is used :
 File wp-admin\includes\class-wp-filesystem-ftpext.php
 Line 142


 {{{
 function chmod($file, $mode = false, $recursive = false) {
                 if( ! $mode )
                         $mode = $this->permission;
                 if( ! $mode )
                         return false;
                 if ( ! $this->exists($file) && ! $this->is_dir($file) )
                         return false;
                 if ( ! $recursive || ! $this->is_dir($file) ) {
                         if ( ! function_exists('ftp_chmod') ){
                                 return @ftp_site($this->link,
 sprintf('CHMOD %o %s', $mode, $file));
                         }
                         echo "@ftp_chmod(_$this->link, $mode, $file);";
                         return @ftp_chmod($this->link, $mode, $file);
                 }

                 //Is a directory, and we want recursive
                 $filelist = $this->dirlist($file);
                 foreach($filelist as $filename){
                         $this->chmod($file . '/' . $filename, $mode,
 $recursive);
                 }
                 return true;
         }
 }}}

 No chmod is apply on the directory. Chmod is apply only on subfiles (and
 subdirectories but the same problem appear...)

 $this->dirlist return an array of array. On this case:

 {{{
 $this->chmod($file . '/' . $filename, $mode, $recursive);
 }}}

 $filename is an array, not the filename. It can't work.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11261>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list