X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/699231ae09f7057a4d0000cdf32e50a3df6a04ca..8f374b7233bc2815ccc387e448d208c5434eb961:/wp-admin/includes/class-wp-filesystem-ftpext.php?ds=sidebyside diff --git a/wp-admin/includes/class-wp-filesystem-ftpext.php b/wp-admin/includes/class-wp-filesystem-ftpext.php index df4ce0ad..12280304 100644 --- a/wp-admin/includes/class-wp-filesystem-ftpext.php +++ b/wp-admin/includes/class-wp-filesystem-ftpext.php @@ -19,7 +19,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base { var $errors = null; var $options = array(); - function WP_Filesystem_FTPext($opt='') { + function __construct($opt='') { $this->method = 'ftpext'; $this->errors = new WP_Error(); @@ -183,22 +183,22 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base { $dir = $this->dirlist($file); return $dir[$file]['group']; } - function copy($source, $destination, $overwrite = false ) { + function copy($source, $destination, $overwrite = false, $mode = false) { if ( ! $overwrite && $this->exists($destination) ) return false; $content = $this->get_contents($source); if ( false === $content) return false; - return $this->put_contents($destination, $content); + return $this->put_contents($destination, $content, $mode); } function move($source, $destination, $overwrite = false) { return ftp_rename($this->link, $source, $destination); } - function delete($file, $recursive = false ) { + function delete($file, $recursive = false, $type = false) { if ( empty($file) ) return false; - if ( $this->is_file($file) ) + if ( 'f' == $type || $this->is_file($file) ) return @ftp_delete($this->link, $file); if ( !$recursive ) return @ftp_rmdir($this->link, $file); @@ -206,7 +206,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base { $filelist = $this->dirlist( trailingslashit($file) ); if ( !empty($filelist) ) foreach ( $filelist as $delete_file ) - $this->delete( trailingslashit($file) . $delete_file['name'], $recursive); + $this->delete( trailingslashit($file) . $delete_file['name'], $recursive, $delete_file['type'] ); return @ftp_rmdir($this->link, $file); } @@ -247,6 +247,10 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base { return false; } function mkdir($path, $chmod = false, $chown = false, $chgrp = false) { + $path = untrailingslashit($path); + if ( empty($path) ) + return false; + if ( !@ftp_mkdir($this->link, $path) ) return false; $this->chmod($path, $chmod); @@ -338,7 +342,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base { } $pwd = @ftp_pwd($this->link); - if ( ! @ftp_chdir($this->link, $path) ) // Cant change to folder = folder doesnt exist + if ( ! @ftp_chdir($this->link, $path) ) // Cant change to folder = folder doesn't exist return false; $list = @ftp_rawlist($this->link, '-a', false); @ftp_chdir($this->link, $pwd); @@ -383,5 +387,3 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base { ftp_close($this->link); } } - -?>