Ticket #5586: 5586.diff
File 5586.diff, 2.8 KB (added by , 17 years ago) |
---|
-
wp-admin/includes/class-wp-filesystem-direct.php
2 2 3 3 class WP_Filesystem_Direct{ 4 4 var $permission = null; 5 var $errors = array(); 5 6 function WP_Filesystem_Direct($arg){ 7 $this->errors = new WP_Error(); 6 8 $this->permission = umask(); 7 9 } 8 10 function connect(){ … … 174 176 if( $overwrite && $this->exists($destination) ) 175 177 return false; 176 178 return copy($source,$destination); 177 } 179 } 178 180 179 181 function move($source,$destination,$overwrite=false){ 180 182 //Possible to use rename() … … 184 186 } else { 185 187 return false; 186 188 } 187 } 189 } 188 190 189 191 function delete($file,$recursive=false){ 190 192 $file = str_replace('\\','/',$file); //for win32, occasional problems deleteing files otherwise 193 191 194 if( $this->is_file($file) ) 192 195 return @unlink($file); 193 if( !$recursive ) 196 197 if( !$recursive && $this->is_dir($file) ) 194 198 return @rmdir($file); 199 195 200 $filelist = $this->dirlist($file); 201 if( ! $filelist ) 202 return true; //No files exist, Say we've deleted them 196 203 197 204 $retval = true; 198 205 foreach($filelist as $filename=>$fileinfo){ … … 206 213 207 214 function exists($file){ 208 215 return @file_exists($file); 209 } 216 } 210 217 211 218 function is_file($file){ 212 219 return @is_file($file); 213 } 220 } 214 221 215 222 function is_dir($path){ 216 223 return @is_dir($path); 217 } 224 } 218 225 219 226 function is_readable($file){ 220 227 return @is_readable($file); 221 } 228 } 222 229 223 230 function is_writable($file){ 224 231 return @is_writable($file); … … 226 233 227 234 function atime($file){ 228 235 return @fileatime($file); 229 } 236 } 230 237 231 238 function mtime($file){ 232 239 return @filemtime($file); 233 240 } 234 241 function size($file){ 235 242 return @filesize($file); 236 } 243 } 237 244 238 245 function touch($file,$time=0,$atime=0){ 239 246 if($time==0) … … 254 261 if( $chgrp ) 255 262 $this->chgrp($path,$chgrp); 256 263 return true; 257 } 264 } 258 265 259 266 function rmdir($path,$recursive=false){ 260 267 if( ! $recursive ) … … 320 327 $dir->close(); 321 328 unset($dir); 322 329 return $ret; 323 } 330 } 324 331 325 332 function __destruct(){ 326 333 return; -
wp-admin/includes/update.php
178 178 $plugin_dir = dirname(ABSPATH . PLUGINDIR . "/$plugin"); 179 179 180 180 // If plugin is in its own directory, recursively delete the directory. 181 if ( '.' != $plugin_dir )181 if ( '.' != $plugin_dir && ABSPATH . PLUGINDIR != $plugin_dir ) 182 182 $wp_filesystem->delete($plugin_dir, true); 183 183 184 184 apply_filters('update_feedback', __("Installing the latest version"));