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. Built from https://develop.svn.wordpress.org/trunk@40638 git-svn-id: http://core.svn.wordpress.org/trunk@40499 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
77858f4b92
commit
33047ba14e
|
@ -31,7 +31,7 @@ class WP_Automatic_Updater {
|
||||||
*/
|
*/
|
||||||
public function is_disabled() {
|
public function is_disabled() {
|
||||||
// Background updates are disabled if you don't want file changes.
|
// 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;
|
return true;
|
||||||
|
|
||||||
if ( wp_installing() )
|
if ( wp_installing() )
|
||||||
|
|
|
@ -202,7 +202,7 @@ function wp_download_language_pack( $download ) {
|
||||||
return $download;
|
return $download;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( wp_disallow_file_mods( 'download_language_pack' ) ) {
|
if ( ! wp_is_file_mod_allowed( 'download_language_pack' ) ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ function wp_download_language_pack( $download ) {
|
||||||
* @return bool Returns true on success, false on failure.
|
* @return bool Returns true on success, false on failure.
|
||||||
*/
|
*/
|
||||||
function wp_can_install_language_pack() {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -362,7 +362,7 @@ function map_meta_cap( $cap, $user_id ) {
|
||||||
// Disallow the file editors.
|
// Disallow the file editors.
|
||||||
if ( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT )
|
if ( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT )
|
||||||
$caps[] = 'do_not_allow';
|
$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';
|
$caps[] = 'do_not_allow';
|
||||||
elseif ( is_multisite() && ! is_super_admin( $user_id ) )
|
elseif ( is_multisite() && ! is_super_admin( $user_id ) )
|
||||||
$caps[] = 'do_not_allow';
|
$caps[] = 'do_not_allow';
|
||||||
|
@ -380,7 +380,7 @@ function map_meta_cap( $cap, $user_id ) {
|
||||||
case 'update_core':
|
case 'update_core':
|
||||||
// Disallow anything that creates, deletes, or updates core, plugin, or theme files.
|
// Disallow anything that creates, deletes, or updates core, plugin, or theme files.
|
||||||
// Files in uploads are excepted.
|
// 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';
|
$caps[] = 'do_not_allow';
|
||||||
} elseif ( is_multisite() && ! is_super_admin( $user_id ) ) {
|
} elseif ( is_multisite() && ! is_super_admin( $user_id ) ) {
|
||||||
$caps[] = 'do_not_allow';
|
$caps[] = 'do_not_allow';
|
||||||
|
|
|
@ -1099,14 +1099,14 @@ function is_wp_error( $thing ) {
|
||||||
* @param string $context The usage context.
|
* @param string $context The usage context.
|
||||||
* @return bool True if file modification is disallowed, false otherwise.
|
* @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.
|
* Filters whether file modifications are disallowed.
|
||||||
*
|
*
|
||||||
* @since 4.8.0
|
* @since 4.8.0
|
||||||
*
|
*
|
||||||
* @param bool $disllow_file_mods Whether file modifications are disallowed.
|
* @param bool $disallow_file_mods Whether file modifications are disallowed.
|
||||||
* @param string $context The usage context.
|
* @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 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.8-alpha-40637';
|
$wp_version = '4.8-alpha-40638';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue