mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 17:48:01 +01:00
Site Health: Use WP_Automatic_Updater::is_disabled()
to check whether automatic updates are disabled.
The previous check for `DISALLOW_FILE_MODS` and `AUTOMATIC_UPDATER_DISABLED` constants didn't always provide accurate results. Props Clorith, kraftner, afragen. Fixes #47869. Built from https://develop.svn.wordpress.org/trunk@46276 git-svn-id: http://core.svn.wordpress.org/trunk@46088 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a86fe08b1d
commit
c117b9957f
@ -26,11 +26,10 @@ class WP_Site_Health_Auto_Updates {
|
|||||||
*/
|
*/
|
||||||
public function run_tests() {
|
public function run_tests() {
|
||||||
$tests = array(
|
$tests = array(
|
||||||
$this->test_constants( 'DISALLOW_FILE_MODS', false ),
|
|
||||||
$this->test_constants( 'AUTOMATIC_UPDATER_DISABLED', false ),
|
|
||||||
$this->test_constants( 'WP_AUTO_UPDATE_CORE', true ),
|
$this->test_constants( 'WP_AUTO_UPDATE_CORE', true ),
|
||||||
$this->test_wp_version_check_attached(),
|
$this->test_wp_version_check_attached(),
|
||||||
$this->test_filters_automatic_updater_disabled(),
|
$this->test_filters_automatic_updater_disabled(),
|
||||||
|
$this->test_wp_automatic_updates_disabled(),
|
||||||
$this->test_if_failed_update(),
|
$this->test_if_failed_update(),
|
||||||
$this->test_vcs_abspath(),
|
$this->test_vcs_abspath(),
|
||||||
$this->test_check_wp_filesystem_method(),
|
$this->test_check_wp_filesystem_method(),
|
||||||
@ -158,12 +157,36 @@ class WP_Site_Health_Auto_Updates {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if automatic updates are disabled.
|
||||||
|
*
|
||||||
|
* @since 5.3.0
|
||||||
|
*
|
||||||
|
* @return array|bool The test results. False if auto updates are enabled.
|
||||||
|
*/
|
||||||
|
public function test_wp_automatic_updates_disabled() {
|
||||||
|
if ( ! class_exists( 'WP_Automatic_Updater' ) ) {
|
||||||
|
require_once( ABSPATH . 'wp-admin/includes/class-wp-automatic-updates.php' );
|
||||||
|
}
|
||||||
|
|
||||||
|
$auto_updates = new WP_Automatic_Updater();
|
||||||
|
|
||||||
|
if ( ! $auto_updates->is_disabled() ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'description' => __( 'All automatic updates are disabled.' ),
|
||||||
|
'severity' => 'fail',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if automatic updates have tried to run, but failed, previously.
|
* Check if automatic updates have tried to run, but failed, previously.
|
||||||
*
|
*
|
||||||
* @since 5.2.0
|
* @since 5.2.0
|
||||||
*
|
*
|
||||||
* @return array|bool The test results. false if the auto updates failed.
|
* @return array|bool The test results. False if the auto updates failed.
|
||||||
*/
|
*/
|
||||||
function test_if_failed_update() {
|
function test_if_failed_update() {
|
||||||
$failed = get_site_option( 'auto_core_update_failed' );
|
$failed = get_site_option( 'auto_core_update_failed' );
|
||||||
@ -308,7 +331,7 @@ class WP_Site_Health_Auto_Updates {
|
|||||||
*
|
*
|
||||||
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
|
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
|
||||||
*
|
*
|
||||||
* @return array|bool The test results. false if they're not writeable.
|
* @return array|bool The test results. False if they're not writeable.
|
||||||
*/
|
*/
|
||||||
function test_all_files_writable() {
|
function test_all_files_writable() {
|
||||||
global $wp_filesystem;
|
global $wp_filesystem;
|
||||||
@ -388,7 +411,7 @@ class WP_Site_Health_Auto_Updates {
|
|||||||
*
|
*
|
||||||
* @since 5.2.0
|
* @since 5.2.0
|
||||||
*
|
*
|
||||||
* @return array|bool The test results. false if it isn't a development version.
|
* @return array|bool The test results. False if it isn't a development version.
|
||||||
*/
|
*/
|
||||||
function test_accepts_dev_updates() {
|
function test_accepts_dev_updates() {
|
||||||
include ABSPATH . WPINC . '/version.php'; // $wp_version; // x.y.z
|
include ABSPATH . WPINC . '/version.php'; // $wp_version; // x.y.z
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.3-alpha-46275';
|
$wp_version = '5.3-alpha-46276';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
Block a user