[wp-trac] [WordPress Trac] #57604: Docs: Document directory support in `FTP/SSH2` filesystem `::move()` methods.
WordPress Trac
noreply at wordpress.org
Thu Feb 2 04:22:08 UTC 2023
#57604: Docs: Document directory support in `FTP/SSH2` filesystem `::move()`
methods.
----------------------------+-----------------------
Reporter: costdev | Owner: costdev
Type: enhancement | Status: assigned
Priority: normal | Milestone: 6.2
Component: Filesystem API | Version: 2.5
Severity: normal | Keywords: has-patch
Focuses: docs |
----------------------------+-----------------------
This is a follow-up to #57375.
With directory support added to `WP_Filesystem_Direct::move()` in #57375,
we should update the documentation of the other filesystem `::move()`
methods to document their inherent directory support.
**WP_Filesystem_FTPext::move()**
`WP_Filesystem_FTPext::move()` calls
[https://www.php.net/manual/en/function.ftp-rename.php ftp_rename()] -
"Renames a file or a directory on the FTP server"
**WP_Filesystem_ftpsockets::move()**
`WP_Filesystem_ftpsockets::move()` calls [https://github.com/costdev
/wordpress-develop/blob/0412d30a33b0e630d2dc4a1657c539147991c8ac/src/wp-
admin/includes/class-ftp.php#L410 $this->ftp->rename] - Uses `RNFR/RNTO`
which work on files and directories.
**WP_Filesystem_SSH2::move()**
`WP_Filesystem_SSH2::move()` calls
[https://www.php.net/manual/en/function.ssh2-sftp-rename.php
ssh2_sftp_rename] Ultimately calls
[https://github.com/libssh2/libssh2/blob/bd9c65d68c4152ba0726f5588b4b611410972fbc/src/sftp.c#L2800
sftp_rename] (C).
While this states "Rename a file on the remote server", the "Removing and
Renaming Files" section at http://www.openssh.com/txt/draft-ietf-secsh-
filexfer-02.txt states:
Files (and directories) can be renamed using the SSH_FXP_RENAME message.
This is what libssh2's `sftp_rename` function uses:
[https://github.com/libssh2/libssh2/blob/bd9c65d68c4152ba0726f5588b4b611410972fbc/src/sftp.c#L2839
Ref] (C).
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57604>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list