Revert FTP parts of [10919]. fixes #9535 see #9525

git-svn-id: https://develop.svn.wordpress.org/trunk@10930 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2009-04-14 17:16:44 +00:00
parent 3ae543cf47
commit 077e5b20e9
2 changed files with 12 additions and 22 deletions

View File

@ -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;

View File

@ -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();