From c3783c9f3a3b90b7765e00749b088b418b2c14da Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 9 Aug 2022 11:33:10 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@53872 git-svn-id: http://core.svn.wordpress.org/trunk@53431 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-filesystem-base.php | 12 ++++++------ wp-admin/includes/class-wp-filesystem-direct.php | 16 ++++++++-------- wp-admin/includes/class-wp-filesystem-ftpext.php | 16 ++++++++-------- .../includes/class-wp-filesystem-ftpsockets.php | 16 ++++++++-------- wp-admin/includes/class-wp-filesystem-ssh2.php | 14 +++++++------- wp-includes/version.php | 2 +- 6 files changed, 38 insertions(+), 38 deletions(-) diff --git a/wp-admin/includes/class-wp-filesystem-base.php b/wp-admin/includes/class-wp-filesystem-base.php index 221f8b59f5..607915bfec 100644 --- a/wp-admin/includes/class-wp-filesystem-base.php +++ b/wp-admin/includes/class-wp-filesystem-base.php @@ -663,10 +663,10 @@ class WP_Filesystem_Base { * @since 2.5.0 * @abstract * - * @param string $file Path to file or directory. - * @return bool Whether $file exists or not. + * @param string $path Path to file or directory. + * @return bool Whether $path exists or not. */ - public function exists( $file ) { + public function exists( $path ) { return false; } @@ -715,10 +715,10 @@ class WP_Filesystem_Base { * @since 2.5.0 * @abstract * - * @param string $file Path to file or directory. - * @return bool Whether $file is writable. + * @param string $path Path to file or directory. + * @return bool Whether $path is writable. */ - public function is_writable( $file ) { + public function is_writable( $path ) { return false; } diff --git a/wp-admin/includes/class-wp-filesystem-direct.php b/wp-admin/includes/class-wp-filesystem-direct.php index 887ad4e715..e84dfed39f 100644 --- a/wp-admin/includes/class-wp-filesystem-direct.php +++ b/wp-admin/includes/class-wp-filesystem-direct.php @@ -399,11 +399,11 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base { * * @since 2.5.0 * - * @param string $file Path to file or directory. - * @return bool Whether $file exists or not. + * @param string $path Path to file or directory. + * @return bool Whether $path exists or not. */ - public function exists( $file ) { - return @file_exists( $file ); + public function exists( $path ) { + return @file_exists( $path ); } /** @@ -447,11 +447,11 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base { * * @since 2.5.0 * - * @param string $file Path to file or directory. - * @return bool Whether $file is writable. + * @param string $path Path to file or directory. + * @return bool Whether $path is writable. */ - public function is_writable( $file ) { - return @is_writable( $file ); + public function is_writable( $path ) { + return @is_writable( $path ); } /** diff --git a/wp-admin/includes/class-wp-filesystem-ftpext.php b/wp-admin/includes/class-wp-filesystem-ftpext.php index 92fb5d6bb4..056e7ecd9c 100644 --- a/wp-admin/includes/class-wp-filesystem-ftpext.php +++ b/wp-admin/includes/class-wp-filesystem-ftpext.php @@ -415,15 +415,15 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base { * @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. + * @param string $path Path to file or directory. + * @return bool Whether $path exists or not. */ - public function exists( $file ) { - if ( $this->is_dir( $file ) ) { + public function exists( $path ) { + if ( $this->is_dir( $path ) ) { return true; } - return ! empty( ftp_rawlist( $this->link, $file ) ); + return ! empty( ftp_rawlist( $this->link, $path ) ); } /** @@ -475,10 +475,10 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base { * * @since 2.5.0 * - * @param string $file Path to file or directory. - * @return bool Whether $file is writable. + * @param string $path Path to file or directory. + * @return bool Whether $path is writable. */ - public function is_writable( $file ) { + public function is_writable( $path ) { return true; } diff --git a/wp-admin/includes/class-wp-filesystem-ftpsockets.php b/wp-admin/includes/class-wp-filesystem-ftpsockets.php index cb92656aad..f88166c209 100644 --- a/wp-admin/includes/class-wp-filesystem-ftpsockets.php +++ b/wp-admin/includes/class-wp-filesystem-ftpsockets.php @@ -417,15 +417,15 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base { * @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. + * @param string $path Path to file or directory. + * @return bool Whether $path exists or not. */ - public function exists( $file ) { - if ( $this->is_dir( $file ) ) { + public function exists( $path ) { + if ( $this->is_dir( $path ) ) { return true; } - return is_numeric( $this->size( $file ) ); + return is_numeric( $this->size( $path ) ); } /** @@ -484,10 +484,10 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base { * * @since 2.5.0 * - * @param string $file Path to file or directory. - * @return bool Whether $file is writable. + * @param string $path Path to file or directory. + * @return bool Whether $path is writable. */ - public function is_writable( $file ) { + public function is_writable( $path ) { return true; } diff --git a/wp-admin/includes/class-wp-filesystem-ssh2.php b/wp-admin/includes/class-wp-filesystem-ssh2.php index 7032ae63d9..540ecb54fa 100644 --- a/wp-admin/includes/class-wp-filesystem-ssh2.php +++ b/wp-admin/includes/class-wp-filesystem-ssh2.php @@ -557,11 +557,11 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base { * * @since 2.7.0 * - * @param string $file Path to file or directory. - * @return bool Whether $file exists or not. + * @param string $path Path to file or directory. + * @return bool Whether $path exists or not. */ - public function exists( $file ) { - return file_exists( $this->sftp_path( $file ) ); + public function exists( $path ) { + return file_exists( $this->sftp_path( $path ) ); } /** @@ -605,10 +605,10 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base { * * @since 2.7.0 * - * @param string $file Path to file or directory. - * @return bool Whether $file is writable. + * @param string $path Path to file or directory. + * @return bool Whether $path is writable. */ - public function is_writable( $file ) { + public function is_writable( $path ) { // PHP will base its writable checks on system_user === file_owner, not ssh_user === file_owner. return true; } diff --git a/wp-includes/version.php b/wp-includes/version.php index c3d86263bd..88f95015b8 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.1-alpha-53871'; +$wp_version = '6.1-alpha-53872'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.