]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/includes/class-wp-filesystem-ftpext.php
WordPress 3.4
[autoinstalls/wordpress.git] / wp-admin / includes / class-wp-filesystem-ftpext.php
index df4ce0ad502507acf86461687012d9731e693f3a..12280304721c792c4eb9888d981f2d21ccaf3437 100644 (file)
@@ -19,7 +19,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
        var $errors = null;
        var $options = array();
 
        var $errors = null;
        var $options = array();
 
-       function WP_Filesystem_FTPext($opt='') {
+       function __construct($opt='') {
                $this->method = 'ftpext';
                $this->errors = new WP_Error();
 
                $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'];
        }
                $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;
                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 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 ( 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);
                        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 )
                $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);
        }
 
                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) {
                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);
                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);
                }
 
                $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);
                        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);
        }
 }
                        ftp_close($this->link);
        }
 }
-
-?>