Make WordPress Core


Ignore:
Timestamp:
08/09/2022 11:32:01 AM (2 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Rename the $file parameter to $path in some WP_Filesystem_* methods.

This aims to bring more clarity to the code, and applies to methods where the path can be a file or a directory:

  • WP_Filesystem_*::exists()
  • WP_Filesystem_*::is_writable()

Follow-up to [6779], [25560].

See #55647.

File:
1 edited

Legend:

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

    r53862 r53872  
    416416     *              and ftp_rawlist() to check for file existence.
    417417     *
    418      * @param string $file Path to file or directory.
    419      * @return bool Whether $file exists or not.
    420      */
    421     public function exists( $file ) {
    422         if ( $this->is_dir( $file ) ) {
     418     * @param string $path Path to file or directory.
     419     * @return bool Whether $path exists or not.
     420     */
     421    public function exists( $path ) {
     422        if ( $this->is_dir( $path ) ) {
    423423            return true;
    424424        }
    425425
    426         return ! empty( ftp_rawlist( $this->link, $file ) );
     426        return ! empty( ftp_rawlist( $this->link, $path ) );
    427427    }
    428428
     
    476476     * @since 2.5.0
    477477     *
    478      * @param string $file Path to file or directory.
    479      * @return bool Whether $file is writable.
    480      */
    481     public function is_writable( $file ) {
     478     * @param string $path Path to file or directory.
     479     * @return bool Whether $path is writable.
     480     */
     481    public function is_writable( $path ) {
    482482        return true;
    483483    }
Note: See TracChangeset for help on using the changeset viewer.