clear(); $state = new Critical_CSS_State(); $state->clear(); if ( self::is_cloud_css() ) { $state->prepare_for_generation( ( new Source_Providers() )->get_provider_sources() ); $state->save(); // Clear the regenerate flag so things are nice and tidy. jetpack_boost_ds_delete( 'critical_css_suggest_regenerate' ); // Also clear the admin notice flag, so the notice doesn't show up in case // the user is reverted to free Boost. Regenerate_Admin_Notice::dismiss(); } Cloud_CSS_Followup::unschedule(); } /** * Respond to environment changes; deciding whether or not to clear Critical CSS data. */ public static function handle_environment_change( $is_major_change ) { if ( $is_major_change ) { self::reset_data(); do_action( 'jetpack_boost_critical_css_invalidated' ); } } public static function update_boost_problem_count( $count ) { $css_needs_regeneration = Boost_Health::critical_css_needs_regeneration(); if ( $css_needs_regeneration ) { ++$count; } return $count; } public static function is_cloud_css() { $optimizations = ( new Modules_Setup() )->get_status(); return isset( $optimizations[ Cloud_CSS::get_slug() ] ) && $optimizations[ Cloud_CSS::get_slug() ]; } }