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:
Andrew Ozz 2023-02-03 01:59:15 +00:00
parent 47172a2c65
commit d5f8d02445
4 changed files with 35 additions and 14 deletions

View File

@ -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 * @since 2.5.0
* *
* @param string $source Path to the source file. * @param string $source Path to the source file or directory.
* @param string $destination Path to the destination file. * @param string $destination Path to the destination file or directory.
* @param bool $overwrite Optional. Whether to overwrite the destination file if it exists. * @param bool $overwrite Optional. Whether to overwrite the destination if it exists.
* Default false. * Default false.
* @return bool True on success, false on failure. * @return bool True on success, false on failure.
*/ */

View File

@ -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 * @since 2.5.0
* *
* @param string $source Path to the source file. * @param string $source Path to the source file or directory.
* @param string $destination Path to the destination file. * @param string $destination Path to the destination file or directory.
* @param bool $overwrite Optional. Whether to overwrite the destination file if it exists. * @param bool $overwrite Optional. Whether to overwrite the destination if it exists.
* Default false. * Default false.
* @return bool True on success, false on failure. * @return bool True on success, false on failure.
*/ */

View File

@ -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 * @since 2.7.0
* *
* @param string $source Path to the source file. * @param string $source Path to the source file or directory.
* @param string $destination Path to the destination file. * @param string $destination Path to the destination file or directory.
* @param bool $overwrite Optional. Whether to overwrite the destination file if it exists. * @param bool $overwrite Optional. Whether to overwrite the destination if it exists.
* Default false. * Default false.
* @return bool True on success, false on failure. * @return bool True on success, false on failure.
*/ */
public function move( $source, $destination, $overwrite = false ) { public function move( $source, $destination, $overwrite = false ) {
if ( $this->exists( $destination ) ) { if ( $this->exists( $destination ) ) {
if ( $overwrite ) { 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' ); $this->delete( $destination, false, 'f' );
} else { } else {
// If we're not overwriting, the rename will fail, so return early. // If we're not overwriting, the rename will fail, so return early.

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @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. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.