Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions src/wp-admin/includes/class-wp-site-health-auto-updates.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static function ( $test ) {
* @param string $constant The name of the constant to check.
* @param bool|string|array $value The value that the constant should be, if set,
* or an array of acceptable values.
* @return array The test results.
* @return ?array The test results, or null if the test passed.
*/
public function test_constants( $constant, $value ) {
$acceptable_values = (array) $value;
Expand All @@ -82,14 +82,16 @@ public function test_constants( $constant, $value ) {
'severity' => 'fail',
);
}

return null;
}

/**
* Checks if updates are intercepted by a filter.
*
* @since 5.2.0
*
* @return array The test results.
* @return ?array The test results, or null if the test passed.
*/
public function test_wp_version_check_attached() {
if ( ( ! is_multisite() || is_main_site() && is_network_admin() )
Expand All @@ -104,14 +106,16 @@ public function test_wp_version_check_attached() {
'severity' => 'fail',
);
}

return null;
}

/**
* Checks if automatic updates are disabled by a filter.
*
* @since 5.2.0
*
* @return array The test results.
* @return ?array The test results, or null if the test passed.
*/
public function test_filters_automatic_updater_disabled() {
/** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */
Expand All @@ -125,6 +129,8 @@ public function test_filters_automatic_updater_disabled() {
'severity' => 'fail',
);
}

return null;
}

/**
Expand Down Expand Up @@ -156,7 +162,7 @@ public function test_wp_automatic_updates_disabled() {
*
* @since 5.2.0
*
* @return array|false The test results. False if the auto-updates failed.
* @return array|false The test results. False if auto-updates didn't previously fail.
*/
public function test_if_failed_update() {
$failed = get_site_option( 'auto_core_update_failed' );
Expand Down Expand Up @@ -397,7 +403,7 @@ public function test_all_files_writable() {
*
* @since 5.2.0
*
* @return array|false The test results. False if it isn't a development version.
* @return array|false|null The test results. False if it isn't a development version. Returns null if the test passed.
*/
public function test_accepts_dev_updates() {
require ABSPATH . WPINC . '/version.php'; // $wp_version; // x.y.z
Expand Down Expand Up @@ -428,14 +434,16 @@ public function test_accepts_dev_updates() {
'severity' => 'fail',
);
}

return null;
}

/**
* Checks if the site supports automatic minor updates.
*
* @since 5.2.0
*
* @return array The test results.
* @return ?array The test results. Null if the test passed.
*/
public function test_accepts_minor_updates() {
if ( defined( 'WP_AUTO_UPDATE_CORE' ) && false === WP_AUTO_UPDATE_CORE ) {
Expand All @@ -460,5 +468,7 @@ public function test_accepts_minor_updates() {
'severity' => 'fail',
);
}

return null;
}
}
Loading