| @@ -3,9 +3,9 @@ | ||
| 3 | 3 | |
| 4 | 4 | class NginxHelper extends berqIntegrations { |
| 5 | 5 | function __construct() { |
| 6 | 6 | add_action('berqwp_flush_all_cache', [$this, 'flush_cache']); |
| 7 | - add_action('berqwp_stored_page_cache', [$this, 'flush_cache']); | |
| 7 | + add_action('berqwp_stored_page_cache', [$this, 'flush_page_cache']); | |
| 8 | 8 | add_action('berqwp_flush_page_cache', [$this, 'flush_cache']); |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | function flush_cache() |
| @@ -12,8 +12,21 @@ | ||
| 12 | 12 | { |
| 13 | 13 | if (class_exists('Nginx_Helper')) { |
| 14 | 14 | do_action('rt_nginx_helper_purge_all'); |
| 15 | 15 | } |
| 16 | + } | |
| 17 | + | |
| 18 | + function flush_page_cache($slug) | |
| 19 | + { | |
| 20 | + if (!class_exists('Nginx_Helper')) { | |
| 21 | + return; | |
| 22 | + } | |
| 23 | + | |
| 24 | + if (empty($slug)) { | |
| 25 | + $slug = '/'; | |
| 26 | + } | |
| 27 | + | |
| 28 | + do_action('rt_nginx_helper_purge_url', home_url($slug)); | |
| 16 | 29 | } |
| 17 | 30 | } |
| 18 | 31 | |
| 19 | 32 | new NginxHelper(); |