From 62645be17ee3300a87543cfd2ff0ee9c8dfc17f7 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 1 May 2019 18:07:46 +0000 Subject: [PATCH] Site Health: Disable recommendations that could be problematic on multisite installs. When viewing Site Health for a multisite install, there are a few recommendations that are not appropriate and could have negative implications for other sites on the install if the administrator follows the advice provided. For example, Site Health recommends that inactive plugins and themes for a site should be removed. On a single site install, this is a great recommendation. However, on a multisite install, inactive plugins and themes for one site should not be removed because they could be active for other sites on the network. This change also disables the `test_wp_version_check_attached()` test for multisite. This test checks for the presence of the `wp_version_check()` function on the `wp_version_check` hook, which is not present for every site on multisite. Reviewed by jeremyfelt and desrosj. Props iandunn, Clorith, azaozz, jeremyfelt. Fixes #47084. git-svn-id: https://develop.svn.wordpress.org/trunk@45275 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-wp-site-health-auto-updates.php | 4 ++++ src/wp-admin/includes/class-wp-site-health.php | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/class-wp-site-health-auto-updates.php b/src/wp-admin/includes/class-wp-site-health-auto-updates.php index d06ae33cb2..b202235f12 100644 --- a/src/wp-admin/includes/class-wp-site-health-auto-updates.php +++ b/src/wp-admin/includes/class-wp-site-health-auto-updates.php @@ -86,6 +86,10 @@ class WP_Site_Health_Auto_Updates { * @return array The test results. */ public function test_wp_version_check_attached() { + if ( ! is_main_site() ) { + return; + } + $cookies = wp_unslash( $_COOKIE ); $timeout = 10; $headers = array( diff --git a/src/wp-admin/includes/class-wp-site-health.php b/src/wp-admin/includes/class-wp-site-health.php index f777514617..d7a6786a8d 100644 --- a/src/wp-admin/includes/class-wp-site-health.php +++ b/src/wp-admin/includes/class-wp-site-health.php @@ -366,7 +366,7 @@ class WP_Site_Health { } // Check if there are inactive plugins. - if ( $plugins_total > $plugins_active ) { + if ( $plugins_total > $plugins_active && ! is_multisite() ) { $unused_plugins = $plugins_total - $plugins_active; $result['status'] = 'recommended'; @@ -521,7 +521,7 @@ class WP_Site_Health { } } - if ( $has_unused_themes && $show_unused_themes ) { + if ( $has_unused_themes && $show_unused_themes && ! is_multisite() ) { // This is a child theme, so we want to be a bit more explicit in our messages. if ( $active_theme->parent() ) {