From 01fc3018d076bbc8f5de1b3ebc9501ea0b64524f Mon Sep 17 00:00:00 2001 From: Josh Betz Date: Tue, 3 May 2022 10:47:59 -0500 Subject: [PATCH] Clear the theme cache for any plugin update The cached theme data has some properties that depend on WooCommerce. This could also extend to extensions. Since we don't have a reliable way to know if a given plugin is a WooCommerce extension, any plugin update should flush the cache. --- .../class-wc-rest-system-status-v2-controller.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-v2-controller.php b/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-v2-controller.php index cb50e5243c8..4c7565dba32 100644 --- a/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-v2-controller.php +++ b/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-v2-controller.php @@ -50,15 +50,9 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller { } // Clear the cache if woocommerce is updated - if ( 'plugin' === $extra['type'] && isset( $extra['plugins'] ) ) { - $plugins = array_filter( $extra['plugins'], function( $plugin ) { - return strpos( $plugin, 'woocommerce.php' ) !== false; - } ); - - if ( count( $plugins ) > 0 ) { - \WC_REST_System_Status_V2_Controller::clean_theme_cache(); - return; - } + if ( 'plugin' === $extra['type'] ) { + \WC_REST_System_Status_V2_Controller::clean_theme_cache(); + return; } if ( 'theme' === $extra['type'] ) {