mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Include 'hidden' directories in filesystem dirlist by default, props dd32, fixes #10774
git-svn-id: https://develop.svn.wordpress.org/trunk@11934 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -322,29 +322,34 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
|
||||
return $this->delete($path, $recursive);
|
||||
}
|
||||
|
||||
function dirlist($path, $incdot = false, $recursive = false) {
|
||||
function dirlist($path, $include_hidden = true, $recursive = false) {
|
||||
if ( $this->is_file($path) ) {
|
||||
$limitFile = basename($path);
|
||||
$limit_file = basename($path);
|
||||
$path = dirname($path);
|
||||
} else {
|
||||
$limitFile = false;
|
||||
$limit_file = false;
|
||||
}
|
||||
|
||||
if ( ! $this->is_dir($path) )
|
||||
return false;
|
||||
|
||||
$ret = array();
|
||||
$dir = @dir('ssh2.sftp://' . $this->sftp_link .'/' . ltrim($path, '/') );
|
||||
|
||||
if ( ! $dir )
|
||||
return false;
|
||||
|
||||
while (false !== ($entry = $dir->read()) ) {
|
||||
$struc = array();
|
||||
$struc['name'] = $entry;
|
||||
|
||||
if ( '.' == $struc['name'] || '..' == $struc['name'] )
|
||||
continue; //Do not care about these folders.
|
||||
if ( '.' == $struc['name'][0] && !$incdot)
|
||||
|
||||
if ( ! $include_hidden && '.' == $struc['name'][0] )
|
||||
continue;
|
||||
if ( $limitFile && $struc['name'] != $limitFile)
|
||||
|
||||
if ( $limit_file && $struc['name'] != $limit_file )
|
||||
continue;
|
||||
|
||||
$struc['perms'] = $this->gethchmod($path.'/'.$entry);
|
||||
@@ -360,7 +365,7 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
|
||||
|
||||
if ( 'd' == $struc['type'] ) {
|
||||
if ( $recursive )
|
||||
$struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive);
|
||||
$struc['files'] = $this->dirlist($path . '/' . $struc['name'], $include_hidden, $recursive);
|
||||
else
|
||||
$struc['files'] = array();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user