Docs: Document directory support in `FTP/SSH2` filesystem `::move()` methods.
Props: costdev, flixos90, audrasjb. Fixes: #57604. Built from https://develop.svn.wordpress.org/trunk@55205 git-svn-id: http://core.svn.wordpress.org/trunk@54738 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
47172a2c65
commit
d5f8d02445
|
@ -358,13 +358,20 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
|
|||
}
|
||||
|
||||
/**
|
||||
* Moves a file.
|
||||
* Moves a file or directory.
|
||||
*
|
||||
* After moving files or directories, OPcache will need to be invalidated.
|
||||
*
|
||||
* If moving a directory fails, `copy_dir()` can be used for a recursive copy.
|
||||
*
|
||||
* Use `move_dir()` for moving directories with OPcache invalidation and a
|
||||
* fallback to `copy_dir()`.
|
||||
*
|
||||
* @since 2.5.0
|
||||
*
|
||||
* @param string $source Path to the source file.
|
||||
* @param string $destination Path to the destination file.
|
||||
* @param bool $overwrite Optional. Whether to overwrite the destination file if it exists.
|
||||
* @param string $source Path to the source file or directory.
|
||||
* @param string $destination Path to the destination file or directory.
|
||||
* @param bool $overwrite Optional. Whether to overwrite the destination if it exists.
|
||||
* Default false.
|
||||
* @return bool True on success, false on failure.
|
||||
*/
|
||||
|
|
|
@ -368,13 +368,20 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
|
|||
}
|
||||
|
||||
/**
|
||||
* Moves a file.
|
||||
* Moves a file or directory.
|
||||
*
|
||||
* After moving files or directories, OPcache will need to be invalidated.
|
||||
*
|
||||
* If moving a directory fails, `copy_dir()` can be used for a recursive copy.
|
||||
*
|
||||
* Use `move_dir()` for moving directories with OPcache invalidation and a
|
||||
* fallback to `copy_dir()`.
|
||||
*
|
||||
* @since 2.5.0
|
||||
*
|
||||
* @param string $source Path to the source file.
|
||||
* @param string $destination Path to the destination file.
|
||||
* @param bool $overwrite Optional. Whether to overwrite the destination file if it exists.
|
||||
* @param string $source Path to the source file or directory.
|
||||
* @param string $destination Path to the destination file or directory.
|
||||
* @param bool $overwrite Optional. Whether to overwrite the destination if it exists.
|
||||
* Default false.
|
||||
* @return bool True on success, false on failure.
|
||||
*/
|
||||
|
|
|
@ -496,20 +496,27 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
|
|||
}
|
||||
|
||||
/**
|
||||
* Moves a file.
|
||||
* Moves a file or directory.
|
||||
*
|
||||
* After moving files or directories, OPcache will need to be invalidated.
|
||||
*
|
||||
* If moving a directory fails, `copy_dir()` can be used for a recursive copy.
|
||||
*
|
||||
* Use `move_dir()` for moving directories with OPcache invalidation and a
|
||||
* fallback to `copy_dir()`.
|
||||
*
|
||||
* @since 2.7.0
|
||||
*
|
||||
* @param string $source Path to the source file.
|
||||
* @param string $destination Path to the destination file.
|
||||
* @param bool $overwrite Optional. Whether to overwrite the destination file if it exists.
|
||||
* @param string $source Path to the source file or directory.
|
||||
* @param string $destination Path to the destination file or directory.
|
||||
* @param bool $overwrite Optional. Whether to overwrite the destination if it exists.
|
||||
* Default false.
|
||||
* @return bool True on success, false on failure.
|
||||
*/
|
||||
public function move( $source, $destination, $overwrite = false ) {
|
||||
if ( $this->exists( $destination ) ) {
|
||||
if ( $overwrite ) {
|
||||
// We need to remove the destination file before we can rename the source.
|
||||
// We need to remove the destination before we can rename the source.
|
||||
$this->delete( $destination, false, 'f' );
|
||||
} else {
|
||||
// If we're not overwriting, the rename will fail, so return early.
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.2-alpha-55204';
|
||||
$wp_version = '6.2-alpha-55205';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue