Skip to content

Instantly share code, notes, and snippets.

@gbissland
Last active July 7, 2023 23:34
Show Gist options
  • Save gbissland/7b49cbbd4e5cdc44f91b99b4a60cada7 to your computer and use it in GitHub Desktop.
Save gbissland/7b49cbbd4e5cdc44f91b99b4a60cada7 to your computer and use it in GitHub Desktop.
Gridpane - WP-Umbrella purge Nginx Helper
<?
use WPUmbrella\Core\Collections\CacheCollectionItem;
class WPUmbrellaNginxHelper implements CacheCollectionItem
{
public static function isAvailable()
{
if (!function_exists('is_plugin_active')) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
return is_plugin_active('nginx-helper/nginx-helper.php') || class_exists('\Nginx_Helper');
}
public function clear()
{
if (!class_exists('\Nginx_Helper')) {
return;
}
global $nginx_purger;
$nginx_purger->purge_all();
}
}
add_filter('wp_umbrella_cache_compatibilities', 'wpu_add_cache_compatibilities');
function wpu_add_cache_compatibilities($classes)
{
$classes[] = '\WPUmbrellaNginxHelper';
return $classes;
}
@gbissland
Copy link
Author

"Regarding the ability to purge the cache, I can offer you a filter that will add compatibility on our extension with your Nginx system thanks to the code you sent us.
........we do not have knowledge of this system unfortunately. In case you have the possibility to clear the cache via our application and if you add this filter, then it will be taken into account."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment