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.
This commit is contained in:
Josh Betz 2022-05-03 10:47:59 -05:00
parent 43579aeac9
commit 01fc3018d0
1 changed files with 3 additions and 9 deletions

View File

@ -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'] ) {