WP_Filesystem_SSH2::move() public WP 2.7.0
Moves a file.
{} Это метод класса: WP_Filesystem_SSH2{}
Хуков нет.
Возвращает
true/false. True on success, false on failure.
Использование
$WP_Filesystem_SSH2 = new WP_Filesystem_SSH2(); $WP_Filesystem_SSH2->move( $source, $destination, $overwrite );
- $source(строка) (обязательный)
- Path to the source file.
- $destination(строка) (обязательный)
- Path to the destination file.
- $overwrite(true/false)
- Whether to overwrite the destination file if it exists.
По умолчанию: false
Список изменений
С версии 2.7.0 | Введена. |
Код WP_Filesystem_SSH2::move() WP Filesystem SSH2::move WP 5.6.2
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.
$this->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 );
}