git-svn-id: http://svn.automattic.com/wordpress/trunk@10930 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
bd0cef4071
commit
ff657986ff
|
@ -169,7 +169,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
|
|||
}
|
||||
function getchmod($file) {
|
||||
$dir = $this->dirlist($file);
|
||||
return $this->getnumchmodfromh( $dir[basename($file)]['perms'] );
|
||||
return $dir[$file]['permsn'];
|
||||
}
|
||||
function group($file) {
|
||||
$dir = $this->dirlist($file);
|
||||
|
@ -187,9 +187,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
|
|||
return ftp_rename($this->link, $source, $destination);
|
||||
}
|
||||
|
||||
function delete($file ,$recursive = false ) {
|
||||
if ( empty($file) )
|
||||
return false;
|
||||
function delete($file,$recursive=false) {
|
||||
if ( $this->is_file($file) )
|
||||
return @ftp_delete($this->link, $file);
|
||||
if ( !$recursive )
|
||||
|
@ -323,12 +321,11 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
|
|||
}
|
||||
|
||||
function dirlist($path = '.', $incdot = false, $recursive = false) {
|
||||
|
||||
if ( substr($path, -1) !== '/') {
|
||||
$limit = basename($path);
|
||||
$path = trailingslashit(dirname($path));
|
||||
if( $this->is_file($path) ) {
|
||||
$limitFile = basename($path);
|
||||
$path = dirname($path) . '/';
|
||||
} else {
|
||||
$limit = false;
|
||||
$limitFile = false;
|
||||
}
|
||||
|
||||
$list = @ftp_rawlist($this->link, '-a ' . $path, false);
|
||||
|
@ -342,10 +339,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
|
|||
if ( empty($entry) )
|
||||
continue;
|
||||
|
||||
if ( '.' == $entry['name'] || '..' == $entry['name'] )
|
||||
continue;
|
||||
|
||||
if ( $limit && $entry['name'] != $limit )
|
||||
if ( '.' == $entry["name"] || '..' == $entry["name"] )
|
||||
continue;
|
||||
|
||||
$dirlist[ $entry['name'] ] = $entry;
|
||||
|
|
|
@ -186,7 +186,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
|
|||
|
||||
function getchmod($file) {
|
||||
$dir = $this->dirlist($file);
|
||||
return $this->getnumchmodfromh( $dir[basename($file)]['perms'] );
|
||||
return $dir[$file]['permsn'];
|
||||
}
|
||||
|
||||
function group($file) {
|
||||
|
@ -281,25 +281,21 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
|
|||
}
|
||||
|
||||
function dirlist($path = '.', $incdot = false, $recursive = false ) {
|
||||
|
||||
if ( substr($path, -1) !== '/') {
|
||||
$limit = basename($path);
|
||||
$path = trailingslashit(dirname($path));
|
||||
if( $this->is_file($path) ) {
|
||||
$limitFile = basename($path);
|
||||
$path = dirname($path) . '/';
|
||||
} else {
|
||||
$limit = false;
|
||||
$limitFile = false;
|
||||
}
|
||||
|
||||
$list = $this->ftp->dirlist($path);
|
||||
if( ! $list )
|
||||
return false;
|
||||
|
||||
if( empty($list) )
|
||||
return array();
|
||||
|
||||
$ret = array();
|
||||
foreach ( $list as $struc ) {
|
||||
if ( $limit && $struc['name'] != $limit )
|
||||
continue;
|
||||
|
||||
if ( 'd' == $struc['type'] ) {
|
||||
$struc['files'] = array();
|
||||
|
|
Loading…
Reference in New Issue