#52135 closed defect (bug) (fixed)
False positive on `WP_Site_Health_Auto_Updates`
Reported by: | audrasjb | Owned by: | whyisjake |
---|---|---|---|
Milestone: | 5.6.1 | Priority: | normal |
Severity: | normal | Version: | 5.6 |
Component: | Site Health | Keywords: | has-patch has-screenshots commit |
Focuses: | multisite | Cc: |
Description
It looks like there is a false positive on WP_Site_Health_Auto_Updates
check, which trigger "Background updates are not working as expected" notice on Site Health screen.
The issue only occurs on Multisite installations, and doesn't appear on the main site of the network, only on other ones.
I was able to reproduce the issue on several existing networks.
It looks like the issue appeared in WP 5.6, so let's milestone this for the next point release.
Committers: please don't forget to props @aaribaud who first reported the issue on WordPress.org support forums: https://wordpress.org/support/topic/wp-complaining-about-its-own-wp_version_check-filter/
This forum topic also contains some research the original reporter did on their side. Worth a read :)
Attachments (2)
Change History (15)
#2
@
4 years ago
- Focuses multisite added
Thanks for the report!
The issue only occurs on Multisite installations, and doesn't appear on the main site of the network, only on other ones.
As noted in the thread, this was introduced with the ! has_filter( 'wp_version_check', 'wp_version_check' )
condition in [49154].
wp-includes/update.php
does set up the action, but only for the main site:
if ( ( ! is_main_site() && ! is_network_admin() ) || wp_doing_ajax() ) { return; } add_action( 'wp_version_check', 'wp_version_check' );
This ticket was mentioned in Slack in #core-site-health by audrasjb. View the logs.
4 years ago
#5
@
4 years ago
Hello, I reproduced the bug well and did some tests.
I did two quick tests to see the result and modify the condition, the error persists.
For example with
if ( ! is_network_admin() || wp_doing_ajax() ) { return; }
or
if ( ! is_admin() || wp_doing_ajax() ) { return; }
The error is still displayed in the Site Health.
I am attaching a patch where this time the wp_version_check test is run only for the main site if site is multisite.
I updated the test_wp_version_check_attached() function class-wp-site-health-auto-updates.php.
public function test_wp_version_check_attached() { if ( ( ! is_multisite() || ( is_main_site() && is_network_admin() ) ) && ! has_filter( 'wp_version_check', 'wp_version_check' ) ) { return array( 'description' => sprintf( /* translators: %s: Name of the filter used. */ __( 'A plugin has prevented updates by disabling %s.' ), '<code>wp_version_check()</code>' ), 'severity' => 'fail', ); } }
@
4 years ago
update the test_wp_version_check_attached() function class-wp-site-health-auto-updates.php.
#6
@
4 years ago
- Keywords has-patch has-screenshots added; needs-patch removed
The patch looks good to me 👍
Site health false positive on
WP_Site_Health_Auto_Updates