HEX
Server: Apache/2.4.65 (Debian)
System: Linux wordpress-7cb4c6b6f6-wz24n 5.15.0-131-generic #141-Ubuntu SMP Fri Jan 10 21:18:28 UTC 2025 x86_64
User: www-data (33)
PHP: 8.3.27
Disabled: NONE
Upload Files
File: /var/www/html/wp-content/plugins/jet-engine/includes/modules/data-stores/inc/compatibility.php
<?php
namespace Jet_Engine\Modules\Data_Stores;

/**
 * Define Compatibility class
 */
class Compatibility {

	public function __construct() {

		// WP Rocket Compatibility hooks.
		if ( defined('WP_ROCKET_VERSION' ) ) {
			add_action( 'jet-engine/data-stores/post-count-increased', array( $this, 'clean_wp_rocket_cache' ) );
			add_action( 'jet-engine/data-stores/post-count-decreased', array( $this, 'clean_wp_rocket_cache' ) );
		}

	}

	/**
	 * Clean WP Rocket Cache.
	 *
	 * @param $post_id
	 */
	public function clean_wp_rocket_cache( $post_id ) {

		if ( empty( $post_id ) ) {
			return;
		}

		if ( ! function_exists( 'rocket_clean_post' ) ) {
			return;
		}

		rocket_clean_post( $post_id );
	}

}