PluginProbe
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript / 1.9.3
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript v1.9.3
4.1.16 4.1.15 4.1.14 4.1.13 4.1.12 4.1.11 4.1.10 4.0.30 4.0.29 4.0.28 4.0.27 4.0.26 4.0.24 4.0.25 4.0.23 4.0.22 4.0.21 4.0.19 4.0.18 4.0.17 4.0.16 1.9.3 1.9.4 1.9.5 1.9.6 All 170 releases
searchpro / inc / thirdparty / server / Nginx.php

Nginx.php in BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript 1.9.3, at inc/thirdparty/server/Nginx.php

28 lines 685 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (!defined('ABSPATH')) exit;
3
4 class Nginx extends berqIntegrations {
5 function __construct() {
6 add_action('berqwp_flush_all_cache', [$this, 'flush_cache']);
7 add_action('berqwp_stored_page_cache', [$this, 'flush_cache']);
8 }
9
10 function flush_cache()
11 {
12 $is_nginx = stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false;
13
14 if ($is_nginx) {
15 // Clear nginx cache
16
17 // Common cache dirs
18 $dirs = ['/var/run/nginx-cache', '/var/cache/nginx', '/var/lib/nginx/cache'];
19
20 foreach ($dirs as $dir) {
21 berqwp_unlink_recursive($dir);
22 }
23
24 }
25 }
26 }
27
28 new Nginx();