Make WordPress Core


Ignore:
Timestamp:
08/08/2022 05:12:59 PM (2 years ago)
Author:
SergeyBiryukov
Message:

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: RFC 959: File Transfer Protocol (FTP)

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

See #51170.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php

    r53860 r53862  
    415415     *
    416416     * @since 2.5.0
    417      * @since 6.1.0 Rewrite using file size.
     417     * @since 6.1.0 Uses WP_Filesystem_ftpsockets::is_dir() to check for directory existence
     418     *              and file size to check for file existence.
    418419     *
    419420     * @param string $file Path to file or directory.
Note: See TracChangeset for help on using the changeset viewer.