• Please add support for clearing cache with the nginx-helper plugin, the nginx-helper plugin features a very handy top menu button that clears the current page fastcgi cache if on frontend or clears everything when on backend.

    i see it fires a rt_nginx_helper_after_fastcgi_purge_all when a purge all is fired and that it calls a filter for rt_nginx_helper_purge_url with the $url as second parameter, which these 2 pieces of information you guys should be able to pick it up easily.

    Thanks in advance, congrats on the apo release, it really made me consider why the need for expensive hosting for certain customers…

Viewing 1 replies (of 1 total)
  • Thread Starter carlosbarbosa

    (@carlosbarbosa)

    Hacked my way around it for now:

    <?php
    /**
    * Plugin Name
    *
    * @package Nginx Helper Cloudflare Sync
    * @author Carlos Barbosa
    * @copyright 2020 CBD
    * @license GPL-2.0-or-later
    *
    * @wordpress-plugin
    * Plugin Name: Nginx Helper Cloudflare Sync
    * Description: Clears Cloudflare cache when nginx-helper does its thing.
    * Version: 1.0.1
    * Author: Carlos Barbosa
    * Author URI: [email protected]
    * License: GPLv2 or later
    * Text Domain: nginx-helper-cf
    */

    add_action(‘rt_nginx_helper_after_fastcgi_purge_all’, ‘nginx_helper_cf_purge_all_action’);
    function nginx_helper_cf_purge_all_action ()
    {
    $cloudflareHooks = new \CF\WordPress\Hooks();
    $cloudflareHooks->purgeCacheEverything();
    }

    add_filter(‘rt_nginx_helper_purge_url’, ‘nginx_helper_cf_purge_url_filter’);
    function nginx_helper_cf_purge_url_filter($url)
    {
    $pid = url_to_postid($url);

    if ($pid > 0)
    {
    $cloudflareHooks = new \CF\WordPress\Hooks();
    $cloudflareHooks->purgeCacheByRelevantURLs($pid);
    }

    return $url;
    }

Viewing 1 replies (of 1 total)

The topic ‘Add Support for nginx helper plugin’ is closed to new replies.