diff --git a/wp-admin/includes/class-wp-filesystem-direct.php b/wp-admin/includes/class-wp-filesystem-direct.php index f783bc574e..d698b20d99 100644 --- a/wp-admin/includes/class-wp-filesystem-direct.php +++ b/wp-admin/includes/class-wp-filesystem-direct.php @@ -271,7 +271,7 @@ class WP_Filesystem_Direct{ foreach($filelist as $filename=>$det){ if ( '/' == substr($filename,-1,1) ) $this->rmdir($path.'/'.$filename,$recursive); - @rmdir($entry); + @rmdir($filename); } return @rmdir($path); } @@ -333,4 +333,4 @@ class WP_Filesystem_Direct{ return; } } -?> \ No newline at end of file +?> diff --git a/wp-admin/includes/class-wp-filesystem-ftpext.php b/wp-admin/includes/class-wp-filesystem-ftpext.php index 89860272c5..a8a3585052 100644 --- a/wp-admin/includes/class-wp-filesystem-ftpext.php +++ b/wp-admin/includes/class-wp-filesystem-ftpext.php @@ -132,7 +132,7 @@ class WP_Filesystem_FTPext{ } function get_contents($file,$type='',$resumepos=0){ if( empty($type) ){ - $extension = substr(strrchr($filename, "."), 1); + $extension = substr(strrchr($file, "."), 1); $type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_ASCII; } $temp = tmpfile(); @@ -348,7 +348,7 @@ class WP_Filesystem_FTPext{ } function rmdir($path,$recursive=false){ if( ! $recursive ) - return @ftp_rmdir($this->link, $file); + return @ftp_rmdir($this->link, $path); //TODO: Recursive Directory delete, Have to delete files from the folder first. //$dir = $this->dirlist($path); diff --git a/wp-admin/includes/class-wp-filesystem-ftpsockets.php b/wp-admin/includes/class-wp-filesystem-ftpsockets.php index 1b4c121048..15ab390760 100644 --- a/wp-admin/includes/class-wp-filesystem-ftpsockets.php +++ b/wp-admin/includes/class-wp-filesystem-ftpsockets.php @@ -139,7 +139,7 @@ class WP_Filesystem_ftpsockets{ return false; if( empty($type) ){ - $extension = substr(strrchr($filename, "."), 1); + $extension = substr(strrchr($file, "."), 1); $type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_AUTOASCII; } $this->ftp->SetType($type); @@ -376,7 +376,7 @@ class WP_Filesystem_ftpsockets{ function rmdir($path,$recursive=false){ if( ! $recursive ) - return $this->ftp->rmdir($file); + return $this->ftp->rmdir($path); return $this->ftp->mdel($path); } diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php index 0ef2fb4ce6..4f5d96b7c8 100644 --- a/wp-admin/includes/file.php +++ b/wp-admin/includes/file.php @@ -231,7 +231,7 @@ function unzip_file($file, $to) { // Is the archive valid? if ( false == ($archive_files = $archive->extract(PCLZIP_OPT_EXTRACT_AS_STRING)) ) - return new WP_Error('incompatible_archive', __('Incompatible archive'), $archive->error_string); + return new WP_Error('incompatible_archive', __('Incompatible archive'), $archive->errorInfo(true)); if ( 0 == count($archive_files) ) return new WP_Error('empty_archive', __('Empty archive')); @@ -240,12 +240,9 @@ function unzip_file($file, $to) { $path = explode('/', $to); $tmppath = ''; for ( $j = 0; $j < count($path) - 1; $j++ ) { - $prevpath = $tmppath; $tmppath .= $path[$j] . '/'; - if ( ! $fs->is_dir($tmppath) ) { - //$fs->setDefaultPermissions( $fs->getchmod($tmppath) ); + if ( ! $fs->is_dir($tmppath) ) $fs->mkdir($tmppath, 0755); - } } foreach ($archive_files as $file) { diff --git a/wp-admin/includes/update.php b/wp-admin/includes/update.php index edfd0f7c59..461c93457f 100644 --- a/wp-admin/includes/update.php +++ b/wp-admin/includes/update.php @@ -127,7 +127,7 @@ function wp_plugin_update_row( $file ) { $r = $current->response[ $file ]; echo "
'.__('You do not have sufficient permissions to update plugins for this blog.').'
'); -function request_filesystem_credentials($form_post, $type = '') { +function request_filesystem_credentials($form_post, $type = '', $error = false) { if ( empty($type) ) $type = get_filesystem_method(); if ( 'direct' == $type ) return array(); - if ( !empty($_POST['password']) && !empty($_POST['username']) && !empty($_POST['hostname']) ) { + if ( ! $error && !empty($_POST['password']) && !empty($_POST['username']) && !empty($_POST['hostname']) ) { $credentials = array('hostname' => $_POST['hostname'], 'username' => $_POST['username'], 'password' => $_POST['password'], 'ssl' => $_POST['ssl']); $stored_credentials = $credentials; @@ -26,6 +26,9 @@ function request_filesystem_credentials($form_post, $type = '') { $ssl = ''; if ( $credentials = get_option('ftp_credentials') ) extract($credentials, EXTR_OVERWRITE); + if( $error ){ + echo '' . __('Error: There was an error connecting to the server, Please verify the settings are correct.') . '