mirror of
https://github.com/WordPress/WordPress.git
synced 2025-03-09 07:00:01 +00:00
Upgrade/Install: Replace the conditionals that check the AUTOMATIC_UPDATER_DISABLED
constant and the automatic_updater_disabled
filter in update-core.php with a call to WP_Automatic_Updater::is_disabled()
. This prevents a PHP warning, fixes the logic, and considers wp_is_file_mod_allowed( 'automatic_updater' )
when determining the UI state.
Props jamesros161, pbiron, audrasjb, azaozz. Fixes #51827. Built from https://develop.svn.wordpress.org/trunk@49677 git-svn-id: http://core.svn.wordpress.org/trunk@49400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9150652fed
commit
991114fb57
@ -291,6 +291,9 @@ function core_auto_updates_settings() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
||||||
|
$updater = new WP_Automatic_Updater();
|
||||||
|
|
||||||
// Defaults:
|
// Defaults:
|
||||||
$upgrade_dev = get_site_option( 'auto_update_core_dev', 'enabled' ) === 'enabled';
|
$upgrade_dev = get_site_option( 'auto_update_core_dev', 'enabled' ) === 'enabled';
|
||||||
$upgrade_minor = get_site_option( 'auto_update_core_minor', 'enabled' ) === 'enabled';
|
$upgrade_minor = get_site_option( 'auto_update_core_minor', 'enabled' ) === 'enabled';
|
||||||
@ -323,18 +326,15 @@ function core_auto_updates_settings() {
|
|||||||
$can_set_update_option = false;
|
$can_set_update_option = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( defined( 'AUTOMATIC_UPDATER_DISABLED' )
|
if ( $updater->is_disabled() ) {
|
||||||
|| has_filter( 'automatic_updater_disabled' )
|
$upgrade_dev = false;
|
||||||
) {
|
$upgrade_minor = false;
|
||||||
if ( true === AUTOMATIC_UPDATER_DISABLED
|
$upgrade_major = false;
|
||||||
/** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */
|
|
||||||
|| true === apply_filters( 'automatic_updater_disabled', false )
|
// The UI is overridden by the AUTOMATIC_UPDATER_DISABLED constant
|
||||||
) {
|
// or the automatic_updater_disabled filter,
|
||||||
$upgrade_dev = false;
|
// or by wp_is_file_mod_allowed( 'automatic_updater' ).
|
||||||
$upgrade_minor = false;
|
// See WP_Automatic_Updater::is_disabled().
|
||||||
$upgrade_major = false;
|
|
||||||
}
|
|
||||||
// The UI is overridden by the AUTOMATIC_UPDATER_DISABLED constant.
|
|
||||||
$can_set_update_option = false;
|
$can_set_update_option = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,8 +370,7 @@ function core_auto_updates_settings() {
|
|||||||
|
|
||||||
<p class="auto-update-status">
|
<p class="auto-update-status">
|
||||||
<?php
|
<?php
|
||||||
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
|
||||||
$updater = new WP_Automatic_Updater();
|
|
||||||
if ( $updater->is_vcs_checkout( ABSPATH ) ) {
|
if ( $updater->is_vcs_checkout( ABSPATH ) ) {
|
||||||
_e( 'This site appears to be under version control. Automatic updates are disabled.' );
|
_e( 'This site appears to be under version control. Automatic updates are disabled.' );
|
||||||
} elseif ( $upgrade_major ) {
|
} elseif ( $upgrade_major ) {
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.7-alpha-49676';
|
$wp_version = '5.7-alpha-49677';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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…
x
Reference in New Issue
Block a user