Fix recursive chmod for WP_Filesystem. Props reaperhulk for FtpExt. Fixes #11261
git-svn-id: https://develop.svn.wordpress.org/trunk@12997 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
d59cf38464
commit
bb80851161
@ -135,7 +135,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
|||||||
//Is a directory, and we want recursive
|
//Is a directory, and we want recursive
|
||||||
$file = trailingslashit($file);
|
$file = trailingslashit($file);
|
||||||
$filelist = $this->dirlist($file);
|
$filelist = $this->dirlist($file);
|
||||||
foreach ($filelist as $filename)
|
foreach ( (array)$filelist as $filename => $filemeta)
|
||||||
$this->chmod($file . $filename, $mode, $recursive);
|
$this->chmod($file . $filename, $mode, $recursive);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -154,17 +154,17 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! $recursive || ! $this->is_dir($file) ) {
|
// chmod any sub-objects if recursive.
|
||||||
if ( ! function_exists('ftp_chmod') )
|
if ( $recursive && $this->is_dir($file) ) {
|
||||||
return @ftp_site($this->link, sprintf('CHMOD %o %s', $mode, $file));
|
$filelist = $this->dirlist($file);
|
||||||
return @ftp_chmod($this->link, $mode, $file);
|
foreach ( (array)$filelist as $filename => $filemeta )
|
||||||
|
$this->chmod($file . '/' . $filename, $mode, $recursive);
|
||||||
}
|
}
|
||||||
//Is a directory, and we want recursive
|
|
||||||
$filelist = $this->dirlist($file);
|
// chmod the file or directory
|
||||||
foreach ( $filelist as $filename ) {
|
if ( ! function_exists('ftp_chmod') )
|
||||||
$this->chmod($file . '/' . $filename, $mode, $recursive);
|
return @ftp_site($this->link, sprintf('CHMOD %o %s', $mode, $file));
|
||||||
}
|
return @ftp_chmod($this->link, $mode, $file);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
function chown($file, $owner, $recursive = false ) {
|
function chown($file, $owner, $recursive = false ) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -164,16 +164,15 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! $recursive || ! $this->is_dir($file) ) {
|
// chmod any sub-objects if recursive.
|
||||||
return $this->ftp->chmod($file, $mode);
|
if ( $recursive && $this->is_dir($file) ) {
|
||||||
|
$filelist = $this->dirlist($file);
|
||||||
|
foreach ( (array)$filelist as $filename => $filemeta )
|
||||||
|
$this->chmod($file . '/' . $filename, $mode, $recursive);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Is a directory, and we want recursive
|
// chmod the file or directory
|
||||||
$filelist = $this->dirlist($file);
|
return $this->ftp->chmod($file, $mode);
|
||||||
foreach ( $filelist as $filename )
|
|
||||||
$this->chmod($file . '/' . $filename, $mode, $recursive);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function chown($file, $owner, $recursive = false ) {
|
function chown($file, $owner, $recursive = false ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user