Docs: Improve `@since` notes for some `WP_Filesystem_*` methods:

* `WP_Filesystem_FTPext::exists()`
* `WP_Filesystem_FTPext::size()`
* `WP_Filesystem_ftpsockets::exists()`

The `::exists()` methods were previously using the FTP `NLST` command, which works for directories, but is not intended to be applied to a file. This only worked most of the time due to many FTP servers being permissive and allowing to execute `NLST` on files, which cannot be guaranteed and appears to not be the case in newer versions of Pure-FTPd (1.0.48 or later).

With a recent change in [53860], both methods were updated for compatibility with RFC 959:

* Both methods check if the path is a directory that can be changed into (and therefore exists).
* `WP_Filesystem_FTPext` uses `ftp_rawlist()` (FTP `LIST` command) to check for file existence.
* `WP_Filesystem_ftpsockets` uses file size to check for file existence.

Reference: [https://www.ietf.org/rfc/rfc959.txt RFC 959: File Transfer Protocol (FTP)]

Follow-up to [6779], [11821], [25274], [33648], [34733], [35944], [35946], [53860].

See #51170.
Built from https://develop.svn.wordpress.org/trunk@53862


git-svn-id: http://core.svn.wordpress.org/trunk@53421 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2022-08-08 17:14:13 +00:00
parent 6e38153854
commit 7f0fc452b1
3 changed files with 7 additions and 5 deletions

View File

@ -412,8 +412,8 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
* Checks if a file or directory exists.
*
* @since 2.5.0
* @since 6.1.0 Rewrite using ftp_rawlist, uses 'LIST' on FTP server
* takes file path or directory path as parameter.
* @since 6.1.0 Uses WP_Filesystem_FTPext::is_dir() to check for directory existence
* and ftp_rawlist() to check for file existence.
*
* @param string $file Path to file or directory.
* @return bool Whether $file exists or not.
@ -510,7 +510,8 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
* Gets the file size (in bytes).
*
* @since 2.5.0
* @since 6.1.0 Update for proper return values.
* @since 6.1.0 Corrected the return value: while WP_Filesystem_Base::size()
* is documented to return false on failure, ftp_size() returns -1.
*
* @param string $file Path to file.
* @return int Size of the file in bytes on success, -1 on failure.

View File

@ -414,7 +414,8 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
* Checks if a file or directory exists.
*
* @since 2.5.0
* @since 6.1.0 Rewrite using file size.
* @since 6.1.0 Uses WP_Filesystem_ftpsockets::is_dir() to check for directory existence
* and file size to check for file existence.
*
* @param string $file Path to file or directory.
* @return bool Whether $file exists or not.

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.1-alpha-53861';
$wp_version = '6.1-alpha-53862';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.