From 3f059bff7c18424c6aa0c349fd53db990a29bccd Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Thu, 11 May 2017 19:23:45 +0000 Subject: [PATCH] Upgrade/Install: After [40394], rename `wp_disallow_file_mods()` to `wp_is_file_mod_allowed()`. This makes it more clear what this function is about. Props Mte90. Fixes #38673. git-svn-id: https://develop.svn.wordpress.org/trunk@40638 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-wp-automatic-updater.php | 2 +- src/wp-admin/includes/translation-install.php | 4 ++-- src/wp-includes/capabilities.php | 4 ++-- src/wp-includes/load.php | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/wp-admin/includes/class-wp-automatic-updater.php b/src/wp-admin/includes/class-wp-automatic-updater.php index 3922a0bf57..d23796b81d 100644 --- a/src/wp-admin/includes/class-wp-automatic-updater.php +++ b/src/wp-admin/includes/class-wp-automatic-updater.php @@ -31,7 +31,7 @@ class WP_Automatic_Updater { */ public function is_disabled() { // Background updates are disabled if you don't want file changes. - if ( wp_disallow_file_mods( 'automatic_updater' ) ) + if ( ! wp_is_file_mod_allowed( 'automatic_updater' ) ) return true; if ( wp_installing() ) diff --git a/src/wp-admin/includes/translation-install.php b/src/wp-admin/includes/translation-install.php index e65ec270f8..eafb8302c7 100644 --- a/src/wp-admin/includes/translation-install.php +++ b/src/wp-admin/includes/translation-install.php @@ -202,7 +202,7 @@ function wp_download_language_pack( $download ) { return $download; } - if ( wp_disallow_file_mods( 'download_language_pack' ) ) { + if ( ! wp_is_file_mod_allowed( 'download_language_pack' ) ) { return false; } @@ -245,7 +245,7 @@ function wp_download_language_pack( $download ) { * @return bool Returns true on success, false on failure. */ function wp_can_install_language_pack() { - if ( wp_disallow_file_mods( 'can_install_language_pack' ) ) { + if ( ! wp_is_file_mod_allowed( 'can_install_language_pack' ) ) { return false; } diff --git a/src/wp-includes/capabilities.php b/src/wp-includes/capabilities.php index abd872575e..f40345deb9 100644 --- a/src/wp-includes/capabilities.php +++ b/src/wp-includes/capabilities.php @@ -362,7 +362,7 @@ function map_meta_cap( $cap, $user_id ) { // Disallow the file editors. if ( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT ) $caps[] = 'do_not_allow'; - elseif ( wp_disallow_file_mods( 'capability_edit_themes' ) ) + elseif ( ! wp_is_file_mod_allowed( 'capability_edit_themes' ) ) $caps[] = 'do_not_allow'; elseif ( is_multisite() && ! is_super_admin( $user_id ) ) $caps[] = 'do_not_allow'; @@ -380,7 +380,7 @@ function map_meta_cap( $cap, $user_id ) { case 'update_core': // Disallow anything that creates, deletes, or updates core, plugin, or theme files. // Files in uploads are excepted. - if ( wp_disallow_file_mods( 'capability_update_core' ) ) { + if ( ! wp_is_file_mod_allowed( 'capability_update_core' ) ) { $caps[] = 'do_not_allow'; } elseif ( is_multisite() && ! is_super_admin( $user_id ) ) { $caps[] = 'do_not_allow'; diff --git a/src/wp-includes/load.php b/src/wp-includes/load.php index 2b375b3727..40ae81db0d 100644 --- a/src/wp-includes/load.php +++ b/src/wp-includes/load.php @@ -1099,14 +1099,14 @@ function is_wp_error( $thing ) { * @param string $context The usage context. * @return bool True if file modification is disallowed, false otherwise. */ -function wp_disallow_file_mods( $context ) { +function wp_is_file_mod_allowed( $context ) { /** * Filters whether file modifications are disallowed. * * @since 4.8.0 * - * @param bool $disllow_file_mods Whether file modifications are disallowed. - * @param string $context The usage context. + * @param bool $disallow_file_mods Whether file modifications are disallowed. + * @param string $context The usage context. */ - return apply_filters( 'disallow_file_mods' , defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS, $context ); + return apply_filters( 'disallow_file_mods', defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS, $context ); }