diff --git src/wp-admin/includes/class-wp-automatic-updater.php src/wp-admin/includes/class-wp-automatic-updater.php
index ea2d70c5ce..3922a0bf57 100644
|
|
|
class WP_Automatic_Updater { |
| 31 | 31 | */ |
| 32 | 32 | public function is_disabled() { |
| 33 | 33 | // Background updates are disabled if you don't want file changes. |
| 34 | | if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) |
| | 34 | if ( wp_disallow_file_mods( 'automatic_updater' ) ) |
| 35 | 35 | return true; |
| 36 | 36 | |
| 37 | 37 | if ( wp_installing() ) |
diff --git src/wp-admin/includes/dashboard.php src/wp-admin/includes/dashboard.php
index 40035f8ba3..b763d43263 100644
|
|
|
function wp_dashboard_primary() { |
| 1152 | 1152 | ) |
| 1153 | 1153 | ); |
| 1154 | 1154 | |
| 1155 | | if ( ( ! defined( 'DISALLOW_FILE_MODS' ) || ! DISALLOW_FILE_MODS ) && ( ! is_multisite() && is_blog_admin() && current_user_can( 'install_plugins' ) ) || ( is_network_admin() && current_user_can( 'manage_network_plugins' ) && current_user_can( 'install_plugins' ) ) ) { |
| | 1155 | if ( ( ! wp_disallow_file_mods( 'dashboard_widget' ) ) && ( ! is_multisite() && is_blog_admin() && current_user_can( 'install_plugins' ) ) || ( is_network_admin() && current_user_can( 'manage_network_plugins' ) && current_user_can( 'install_plugins' ) ) ) { |
| 1156 | 1156 | $feeds['plugins'] = array( |
| 1157 | 1157 | 'link' => '', |
| 1158 | 1158 | 'url' => array( |
diff --git src/wp-admin/includes/translation-install.php src/wp-admin/includes/translation-install.php
index ed86b15cc2..e65ec270f8 100644
|
|
|
function wp_download_language_pack( $download ) { |
| 202 | 202 | return $download; |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | | if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) { |
| | 205 | if ( wp_disallow_file_mods( 'download_language_pack' ) ) { |
| 206 | 206 | return false; |
| 207 | 207 | } |
| 208 | 208 | |
| … |
… |
function wp_download_language_pack( $download ) { |
| 245 | 245 | * @return bool Returns true on success, false on failure. |
| 246 | 246 | */ |
| 247 | 247 | function wp_can_install_language_pack() { |
| 248 | | if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) { |
| | 248 | if ( wp_disallow_file_mods( 'can_install_language_pack' ) ) { |
| 249 | 249 | return false; |
| 250 | 250 | } |
| 251 | 251 | |
diff --git src/wp-includes/capabilities.php src/wp-includes/capabilities.php
index 78cde1c2ee..964b0e6fda 100644
|
|
|
function map_meta_cap( $cap, $user_id ) { |
| 362 | 362 | // Disallow the file editors. |
| 363 | 363 | if ( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT ) |
| 364 | 364 | $caps[] = 'do_not_allow'; |
| 365 | | elseif ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) |
| | 365 | elseif ( wp_disallow_file_mods( 'capability_edit_themes' ) ) |
| 366 | 366 | $caps[] = 'do_not_allow'; |
| 367 | 367 | elseif ( is_multisite() && ! is_super_admin( $user_id ) ) |
| 368 | 368 | $caps[] = 'do_not_allow'; |
| … |
… |
function map_meta_cap( $cap, $user_id ) { |
| 380 | 380 | case 'update_core': |
| 381 | 381 | // Disallow anything that creates, deletes, or updates core, plugin, or theme files. |
| 382 | 382 | // Files in uploads are excepted. |
| 383 | | if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) { |
| | 383 | if ( wp_disallow_file_mods( 'capability_update_core' ) ) { |
| 384 | 384 | $caps[] = 'do_not_allow'; |
| 385 | 385 | } elseif ( is_multisite() && ! is_super_admin( $user_id ) ) { |
| 386 | 386 | $caps[] = 'do_not_allow'; |
diff --git src/wp-includes/load.php src/wp-includes/load.php
index 68ed0bd1ee..88d13619e4 100644
|
|
|
function wp_doing_ajax() { |
| 1072 | 1072 | function is_wp_error( $thing ) { |
| 1073 | 1073 | return ( $thing instanceof WP_Error ); |
| 1074 | 1074 | } |
| | 1075 | |
| | 1076 | /** |
| | 1077 | * Determines whether file modifications are disallowed. |
| | 1078 | * |
| | 1079 | * @since 4.8.0 |
| | 1080 | * |
| | 1081 | * @param string $context The usage context. |
| | 1082 | * @return bool True if file modification is disallowed, false otherwise. |
| | 1083 | */ |
| | 1084 | function wp_disallow_file_mods( $context ) { |
| | 1085 | /** |
| | 1086 | * Filters whether file modifications are disallowed. |
| | 1087 | * |
| | 1088 | * @since 4.8.0 |
| | 1089 | * |
| | 1090 | * @param bool $disllow_file_mods Whether file modifications are disallowed. |
| | 1091 | * @param string $context The usage context. |
| | 1092 | */ |
| | 1093 | return apply_filters( 'disallow_file_mods' , defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS, $context ); |
| | 1094 | } |