Opened 15 years ago
Closed 15 years ago
#11261 closed defect (bug) (fixed)
method chmod in WP_Filesystem doesn't work in recursive mode
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.0 | Priority: | normal |
Severity: | normal | Version: | 2.8.4 |
Component: | Filesystem API | Keywords: | has-patch |
Focuses: | Cc: |
Description
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.
Attachments (2)
Change History (10)
#1
@
15 years ago
- Component changed from General to Filesystem
- Keywords needs-patch added; ftpext chmod class-wp-filesystem-ftpext.php removed
- Milestone changed from Unassigned to 2.9
- Owner set to dd32
- Status changed from new to accepted
#3
@
15 years ago
- Summary changed from method chmod in class-wp-filesystem-ftpext doesn't work in recursive mode to method chmod in WP_Filesystem doesn't work in recursive mode
What should the settings on the directories be set to? ($mode & exec (browse) bits?)
#4
@
15 years ago
The attachment above is my attempt at fixing this bug. I reordered the logic so it checks to see if it's recursive and a directory first. It will then recursively call chmod (using the proper filename now).
Note: See
TracTickets for help on using
tickets.
See also #10889
Postponing to 3.0 since we don't have a patch.