Changeset 7126 for trunk/wp-admin/includes/file.php
- Timestamp:
- 03/01/2008 09:20:23 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/file.php
r7058 r7126 238 238 $tmppath = ''; 239 239 for ( $j = 0; $j < count($path) - 1; $j++ ) { 240 $prevpath = $tmppath; 240 241 $tmppath .= $path[$j] . '/'; 241 242 if ( ! $fs->is_dir($tmppath) ) { 242 $fs->mkdir($tmppath); 243 } else { 244 $fs->setDefaultPermissions( $fs->getchmod($tmppath) ); 243 //$fs->setDefaultPermissions( $fs->getchmod($tmppath) ); 244 $fs->mkdir($tmppath, 0755); 245 245 } 246 246 } … … 254 254 $tmppath .= $path[$j] . '/'; 255 255 if ( ! $fs->is_dir($to . $tmppath) ) 256 $fs->mkdir($to . $tmppath); 256 if ( !$fs->mkdir($to . $tmppath, 0755) ) 257 return new WP_Error('mkdir_failed', __('Could not create directory')); 257 258 } 258 259 259 260 // We've made sure the folders are there, so let's extract the file now: 260 261 if ( ! $file['folder'] ) 261 $fs->put_contents( $to . $file['filename'], $file['content']); 262 } 262 if ( !$fs->put_contents( $to . $file['filename'], $file['content']) ) 263 return new WP_Error('copy_failed', __('Could not copy file')); 264 $fs->chmod($to . $file['filename'], 0644); 265 } 266 267 return true; 263 268 } 264 269 … … 272 277 273 278 foreach ( (array) $dirlist as $filename => $fileinfo ) { 274 if ( 'file' == $fileinfo['type'] ) { 275 $wp_filesystem->copy($from . $filename, $to . $filename, true); 276 } elseif ( 'folder' == $fileinfo['type'] ) { 277 $wp_filesystem->mkdir($to . $filename); 278 copy_dir($from . $filename, $to . $filename); 279 if ( 'f' == $fileinfo['type'] ) { 280 if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true) ) 281 return false; 282 $wp_filesystem->chmod($to . $filename, 0644); 283 } elseif ( 'd' == $fileinfo['type'] ) { 284 if ( !$wp_filesystem->mkdir($to . $filename, 0755) ) 285 return false; 286 if ( !copy_dir($from . $filename, $to . $filename) ) 287 return false; 279 288 } 280 289 } 290 291 return true; 281 292 } 282 293 … … 303 314 304 315 function get_filesystem_method() { 316 return 'ftpsockets'; 317 305 318 $tempFile = tempnam(get_temp_dir(), 'WPU'); 306 319 307 320 if ( getmyuid() == fileowner($tempFile) ) { 308 321 unlink($tempFile); 309 //return 'direct';322 return 'direct'; 310 323 } else { 311 324 unlink($tempFile);
Note: See TracChangeset
for help on using the changeset viewer.