fs direct fixes from DD32. see #5586

git-svn-id: http://svn.automattic.com/wordpress/trunk@6920 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-02-20 00:15:55 +00:00
parent 5b696274a0
commit 1ff305a90c
2 changed files with 9 additions and 2 deletions

View File

@ -2,7 +2,9 @@
class WP_Filesystem_Direct{
var $permission = null;
var $errors = array();
function WP_Filesystem_Direct($arg){
$this->errors = new WP_Error();
$this->permission = umask();
}
function connect(){
@ -188,11 +190,16 @@ class WP_Filesystem_Direct{
function delete($file,$recursive=false){
$file = str_replace('\\','/',$file); //for win32, occasional problems deleteing files otherwise
if( $this->is_file($file) )
return @unlink($file);
if( !$recursive )
if( !$recursive && $this->is_dir($file) )
return @rmdir($file);
$filelist = $this->dirlist($file);
if( ! $filelist )
return true; //No files exist, Say we've deleted them
$retval = true;
foreach($filelist as $filename=>$fileinfo){

View File

@ -178,7 +178,7 @@ function wp_update_plugin($plugin, $feedback = '') {
$plugin_dir = dirname(ABSPATH . PLUGINDIR . "/$plugin");
// If plugin is in its own directory, recursively delete the directory.
if ( '.' != $plugin_dir )
if ( '.' != $plugin_dir && ABSPATH . PLUGINDIR != $plugin_dir )
$wp_filesystem->delete($plugin_dir, true);
apply_filters('update_feedback', __("Installing the latest version"));