- Timestamp:
- 02/03/2023 01:48:36 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-filesystem-direct.php
r53872 r55204 317 317 318 318 /** 319 * Moves a file. 319 * Moves a file or directory. 320 * 321 * After moving files or directories, OPcache will need to be invalidated. 322 * 323 * If moving a directory fails, `copy_dir()` can be used for a recursive copy. 324 * 325 * Use `move_dir()` for moving directories with OPcache invalidation and a 326 * fallback to `copy_dir()`. 320 327 * 321 328 * @since 2.5.0 … … 332 339 } 333 340 341 if ( $overwrite && $this->exists( $destination ) && ! $this->delete( $destination, true ) ) { 342 // Can't overwrite if the destination couldn't be deleted. 343 return false; 344 } 345 334 346 // Try using rename first. if that fails (for example, source is read only) try copy. 335 347 if ( @rename( $source, $destination ) ) { … … 337 349 } 338 350 339 if ( $this->copy( $source, $destination, $overwrite ) && $this->exists( $destination ) ) { 351 // Backward compatibility: Only fall back to `::copy()` for single files. 352 if ( $this->is_file( $source ) && $this->copy( $source, $destination, $overwrite ) && $this->exists( $destination ) ) { 340 353 $this->delete( $source ); 341 354
Note: See TracChangeset
for help on using the changeset viewer.