WP_Filesystem_SSH2::move() – Moves a file.

You appear to be a bot. Output may be restricted

Description

Moves a file.

Usage

$bool = WP_Filesystem_SSH2::move( $source, $destination, $overwrite );

Parameters

$source
( string ) required – Path to the source file.
$destination
( string ) required – Path to the destination file.
$overwrite
( bool ) optional – Optional. Whether to overwrite the destination file if it exists. Default false.

Returns

bool True on success, false on failure.

Source

File name: wordpress/wp-admin/includes/class-wp-filesystem-ssh2.php
Lines:

1 to 13 of 13
  public function move( $source, $destination, $overwrite = false ) {
    if ( $this->WP_Filesystem_SSH2::exists( $destination ) ) {
      if ( $overwrite ) {
        // We need to remove the destination file before we can rename the source.
        $this->WP_Filesystem_SSH2::delete( $destination, false, 'f' );
      } else {
        // If we're not overwriting, the rename will fail, so return early.
        return false;
      }
    }

    return ssh2_sftp_rename( $this->sftp_link, $source, $destination );
  }
 

 View on GitHub View on Trac