HEX
Server: Apache
System: Linux eisbus 6.8.12-9-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-9 (2025-03-16T19:18Z) x86_64
User: www-data (33)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /var/www/wordpress/wp-content/plugins/jetpack-boost/app/lib/class-cache-compatibility.php
<?php
/**
 * Compatibility class for caching plugins.
 */

namespace Automattic\Jetpack_Boost\Lib;

/**
 * Compatibility class for caching plugins.
 */
class Cache_Compatibility {
	/**
	 * Checks if the site has a caching plugin.
	 *
	 * Supports:
	 * - Endurance Page Cache
	 *
	 * @since 4.0.0
	 *
	 * @return bool True if the site has a caching plugin, false otherwise.
	 */
	public static function has_cache() {
		/**
		 * Filters whether the site has a caching plugin.
		 * Useful for testing.
		 *
		 * @since 4.0.0
		 *
		 * @param bool $has_cache True if the site has a caching plugin, false otherwise.
		 */
		$has_cache = apply_filters( 'jetpack_boost_compatibility_has_cache', false );
		if ( $has_cache ) {
			return true;
		}

		/*
		 * Disable Page Cache on sites that run Newfold's caching service.
		 * Their cache is considered enabled when the endurance_cache_level option is set to 2 or 3.
		 *
		 * @link https://github.com/bluehost/endurance-page-cache/blob/59fe9993d2cb8a03d1df6da8325f73ad0851ba0a/endurance-page-cache.php#L343
		 */
		if (
			class_exists( '\\Endurance_Page_Cache' )
			&& 2 <= (int) get_option( 'endurance_cache_level' )
		) {
			return true;
		}

		return false;
	}
}