]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/includes/class-wp-filesystem-ftpext.php
WordPress 3.3.2-scripts
[autoinstalls/wordpress.git] / wp-admin / includes / class-wp-filesystem-ftpext.php
index df4ce0ad502507acf86461687012d9731e693f3a..79bacfbaa4d719fde8030e157902394192aaa235 100644 (file)
@@ -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);