Version Description
- April 2021
- Wrapping a function_exists check which shouldn't be needed, but it fataled for someone and an ounce of prevention yadda yadda.
Download this release
Release Info
Developer | Ipstenu |
Plugin | Varnish HTTP Purge |
Version | 5.0.2 |
Comparing to | |
See all releases |
Code changes from version 5.0.1 to 5.0.2
- debug.php +29 -3
- debugger/plugins.json +18 -0
- readme.txt +21 -4
- settings.php +16 -10
- todo.txt +1 -0
- varnish-http-purge.php +2 -2
debug.php
CHANGED
@@ -404,8 +404,8 @@ class VarnishDebug {
|
|
404 |
// HHVM: Note, WP is dropping support.
|
405 |
if ( isset( $headers['X-Powered-By'] ) && strpos( $headers['X-Powered-By'], 'HHVM' ) !== false ) {
|
406 |
$return['HHVM'] = array(
|
407 |
-
'icon' => '
|
408 |
-
'message' => __( 'You are running HHVM
|
409 |
);
|
410 |
}
|
411 |
|
@@ -633,11 +633,37 @@ class VarnishDebug {
|
|
633 |
} else {
|
634 |
$return['Mod Pagespeed'] = array(
|
635 |
'icon' => 'bad',
|
636 |
-
'message' => __( 'Mod Pagespeed is active but your caching headers may not be right. This
|
637 |
);
|
638 |
}
|
639 |
}
|
640 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
641 |
return $return;
|
642 |
}
|
643 |
|
404 |
// HHVM: Note, WP is dropping support.
|
405 |
if ( isset( $headers['X-Powered-By'] ) && strpos( $headers['X-Powered-By'], 'HHVM' ) !== false ) {
|
406 |
$return['HHVM'] = array(
|
407 |
+
'icon' => 'warning',
|
408 |
+
'message' => __( 'You are running HHVM which is no longer supported by WordPress. As such, this plugin does not officially support it either.', 'varnish-http-purge' ),
|
409 |
);
|
410 |
}
|
411 |
|
633 |
} else {
|
634 |
$return['Mod Pagespeed'] = array(
|
635 |
'icon' => 'bad',
|
636 |
+
'message' => __( 'Mod Pagespeed is active but your caching headers may not be right. This could be a false negative if other parts of your site are overwriting headers. Fix all other errors listed, then come back to this. If you are still having errors, you will need to look into using .htaccess or Nginx to override the Pagespeed headers.', 'varnish-http-purge' ),
|
637 |
);
|
638 |
}
|
639 |
}
|
640 |
|
641 |
+
// Cloudflare
|
642 |
+
if ( isset( $headers['cf-cache-status'] ) ) {
|
643 |
+
|
644 |
+
switch ( $headers['cf-cache-status'] ) {
|
645 |
+
case 'MISS':
|
646 |
+
$return['CloudFlare Cache'] = array(
|
647 |
+
'icon' => 'warning',
|
648 |
+
'message' => __( 'CloudFlare reported this page as not cached. That may be okay. If it goes away when you re-run this check, you\'re fine.', 'varnish-http-purge' ),
|
649 |
+
);
|
650 |
+
break;
|
651 |
+
case 'DYNAMIC':
|
652 |
+
$return['CloudFlare Cache'] = array(
|
653 |
+
'icon' => 'good',
|
654 |
+
'message' => __( 'CloudFlare is caching properly.', 'varnish-http-purge' ),
|
655 |
+
);
|
656 |
+
break;
|
657 |
+
case 'HIT':
|
658 |
+
case 'HIT from Backend':
|
659 |
+
$return['CloudFlare Cache'] = array(
|
660 |
+
'icon' => 'warning',
|
661 |
+
'message' => __( 'CloudFlare is caching however you appear to be using Automatic Platform Optimization (APO). You may face issues with emptying cache on Varnish and APO depending on your webhost. If you find that saving posts takes an exceptionally long time, or does not appear to update content, try disabling APO.', 'varnish-http-purge' ),
|
662 |
+
);
|
663 |
+
break;
|
664 |
+
}
|
665 |
+
}
|
666 |
+
|
667 |
return $return;
|
668 |
}
|
669 |
|
debugger/plugins.json
CHANGED
@@ -53,6 +53,12 @@
|
|
53 |
"reason": "translation",
|
54 |
"always": true
|
55 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
"pie-register":{
|
57 |
"type": "warning",
|
58 |
"path": "pie-register/pie-register.php",
|
@@ -119,6 +125,12 @@
|
|
119 |
"reason": "cache",
|
120 |
"always": true
|
121 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
"woo-advanced-discounts":{
|
123 |
"type": "bad",
|
124 |
"path": "woo-advanced-discounts/wad.php",
|
@@ -143,6 +155,12 @@
|
|
143 |
"reason": "cache",
|
144 |
"always": true
|
145 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
"wp-file-cache":{
|
147 |
"type": "bad",
|
148 |
"path": "wp-file-cache/file-cache.php",
|
53 |
"reason": "translation",
|
54 |
"always": true
|
55 |
},
|
56 |
+
"iron-demo-importer":{
|
57 |
+
"type": "bad",
|
58 |
+
"path": "iron-demo-importer/iron-importer.php",
|
59 |
+
"reason": "incompatible",
|
60 |
+
"always": true
|
61 |
+
},
|
62 |
"pie-register":{
|
63 |
"type": "warning",
|
64 |
"path": "pie-register/pie-register.php",
|
125 |
"reason": "cache",
|
126 |
"always": true
|
127 |
},
|
128 |
+
"wccp-pro":{
|
129 |
+
"type": "bad",
|
130 |
+
"path": "wccp-pro/preventer-index.php",
|
131 |
+
"reason": "cookies",
|
132 |
+
"always": true
|
133 |
+
},
|
134 |
"woo-advanced-discounts":{
|
135 |
"type": "bad",
|
136 |
"path": "woo-advanced-discounts/wad.php",
|
155 |
"reason": "cache",
|
156 |
"always": true
|
157 |
},
|
158 |
+
"wp-content-copy-protector":{
|
159 |
+
"type": "bad",
|
160 |
+
"path": "wp-content-copy-protector/preventer-index.php",
|
161 |
+
"reason": "cookies",
|
162 |
+
"always": true
|
163 |
+
},
|
164 |
"wp-file-cache":{
|
165 |
"type": "bad",
|
166 |
"path": "wp-file-cache/file-cache.php",
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: Ipstenu, mikeschroder, techpriester, danielbachhuber
|
|
3 |
Tags: proxy, purge, cache, varnish, nginx
|
4 |
Requires at least: 5.0
|
5 |
Tested up to: 5.7
|
6 |
-
Stable tag: 5.0
|
7 |
Requires PHP: 5.6
|
8 |
|
9 |
Automatically empty proxy cached content when your site is modified.
|
@@ -121,7 +121,7 @@ No. WordPress can't detect those file changes so it can't tell your cache what t
|
|
121 |
|
122 |
= Does every WordPress plugin and theme work with a proxy cache? =
|
123 |
|
124 |
-
No. Some of them have
|
125 |
|
126 |
= I'm a developer, can I tell your cache to empty in my plugin/theme? =
|
127 |
|
@@ -177,6 +177,10 @@ Replace `123.45.67.89` with the IP of your <em>Proxy Cache Server</em> (_not_ Cl
|
|
177 |
|
178 |
If you want to use WP-CLI, you can set an option in the database. This will not take precedence over the define, and exists for people who want to use automation tools: `wp option update vhp_varnish_ip 123.45.67.890`
|
179 |
|
|
|
|
|
|
|
|
|
180 |
= Why do I get a 503 or 504 error on every post update? =
|
181 |
|
182 |
Your IP address is incorrect. Check the IP of your server and then the setting for your proxy cache IP. If they're _not_ the same, that's likely why.
|
@@ -195,7 +199,7 @@ You may enter them, separated by a comma, on the settings page.
|
|
195 |
|
196 |
= What version of Varnish is supported? =
|
197 |
|
198 |
-
So far this plugin has been reported to successfully function on Varnish
|
199 |
|
200 |
= Does this work with Nginx caching? =
|
201 |
|
@@ -212,7 +216,7 @@ This is a question beyond the support of plugin. I do not have the resources ava
|
|
212 |
|
213 |
= How can I see what the plugin is sending to the cache service? =
|
214 |
|
215 |
-
Yes _IF_ the service has an interface. Sadly Nginx does not. [Detailed directions can be found on the debugging section on GitHub](https://github.com/Ipstenu/varnish-http-purge/wiki
|
216 |
|
217 |
= Don't you work at DreamHost? Is this Official or DreamHost only? =
|
218 |
|
@@ -223,6 +227,19 @@ This plugin is installed by default for _all_ DreamPress installs on DreamHost,
|
|
223 |
|
224 |
== Changelog ==
|
225 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
= 5.0 =
|
227 |
* March 2021
|
228 |
* Now purges draft and pending posts (to account for people who un-publish) - props @jerlarke
|
3 |
Tags: proxy, purge, cache, varnish, nginx
|
4 |
Requires at least: 5.0
|
5 |
Tested up to: 5.7
|
6 |
+
Stable tag: 5.0.2
|
7 |
Requires PHP: 5.6
|
8 |
|
9 |
Automatically empty proxy cached content when your site is modified.
|
121 |
|
122 |
= Does every WordPress plugin and theme work with a proxy cache? =
|
123 |
|
124 |
+
No. Some of them have behaviours that causes them not to cache, either by accident or design. It's incredibly hard to debug those, since many of the related issues are contextual (like _if_ you save a page with a special setting). I've done my best to flag everything as possible issues with the debugger.
|
125 |
|
126 |
= I'm a developer, can I tell your cache to empty in my plugin/theme? =
|
127 |
|
177 |
|
178 |
If you want to use WP-CLI, you can set an option in the database. This will not take precedence over the define, and exists for people who want to use automation tools: `wp option update vhp_varnish_ip 123.45.67.890`
|
179 |
|
180 |
+
= Why are my posts timing out/not showing when I'm using CloudFlare? =
|
181 |
+
|
182 |
+
This is usually related to CloudFlare's APO setup. I have an open ticket with CloudFlare trying to debug this, but basically whatever they're doing with APO doesn't 'like' the flush command and times out (or crashes).
|
183 |
+
|
184 |
= Why do I get a 503 or 504 error on every post update? =
|
185 |
|
186 |
Your IP address is incorrect. Check the IP of your server and then the setting for your proxy cache IP. If they're _not_ the same, that's likely why.
|
199 |
|
200 |
= What version of Varnish is supported? =
|
201 |
|
202 |
+
So far this plugin has been reported to successfully function on Varnish v 2 through v 6.5.
|
203 |
|
204 |
= Does this work with Nginx caching? =
|
205 |
|
216 |
|
217 |
= How can I see what the plugin is sending to the cache service? =
|
218 |
|
219 |
+
Yes _IF_ the service has an interface. Sadly Nginx does not. [Detailed directions can be found on the debugging section on GitHub](https://github.com/Ipstenu/varnish-http-purge/wiki). Bear in mind, these interfaces tend to be command-line only.
|
220 |
|
221 |
= Don't you work at DreamHost? Is this Official or DreamHost only? =
|
222 |
|
227 |
|
228 |
== Changelog ==
|
229 |
|
230 |
+
= 5.0.2 =
|
231 |
+
* April 2021
|
232 |
+
* Wrapping a function_exists check which shouldn't be needed, but it fataled for someone and an ounce of prevention yadda yadda.
|
233 |
+
|
234 |
+
= 5.0.1 =
|
235 |
+
* April 2021
|
236 |
+
* Updating incompatibility lists
|
237 |
+
* HHVM deprecation
|
238 |
+
* Allow saving Proxy IP with ports
|
239 |
+
* Add check for CloudFlare APO
|
240 |
+
* Improve purge execution fails
|
241 |
+
* Double check multiple varnish IPs
|
242 |
+
|
243 |
= 5.0 =
|
244 |
* March 2021
|
245 |
* Now purges draft and pending posts (to account for people who un-publish) - props @jerlarke
|
settings.php
CHANGED
@@ -167,14 +167,22 @@ class VarnishStatus {
|
|
167 |
$varniship = get_site_option( 'vhp_varnish_ip' );
|
168 |
}
|
169 |
|
170 |
-
|
171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
|
173 |
if ( $disabled ) {
|
174 |
esc_html_e( 'A Proxy Cache IP has been defined in your wp-config file, so it is not editable in settings.', 'varnish-http-purge' );
|
175 |
} else {
|
176 |
esc_html_e( 'Examples: ', 'varnish-http-purge' );
|
177 |
-
echo '<code>123.45.67.89</code
|
178 |
}
|
179 |
|
180 |
echo '</label>';
|
@@ -194,15 +202,13 @@ class VarnishStatus {
|
|
194 |
|
195 |
if ( empty( $input ) ) {
|
196 |
return; // do nothing.
|
197 |
-
} elseif ( strpos( $input, ',' ) ) {
|
198 |
// Turn IPs into an array
|
199 |
-
$ips = explode( ',', $input );
|
200 |
$valid_ips = array();
|
201 |
|
202 |
foreach ( $ips as $ip ) {
|
203 |
-
|
204 |
-
$valid_ips[] = trim( $ip );
|
205 |
-
}
|
206 |
}
|
207 |
// If all the IPs are valid, then we can carry on.
|
208 |
if ( ! empty( $valid_ips ) ) {
|
@@ -210,10 +216,10 @@ class VarnishStatus {
|
|
210 |
$set_type = 'updated';
|
211 |
$output = implode( ', ', $valid_ips );
|
212 |
}
|
213 |
-
}
|
214 |
$set_message = __( 'Proxy Cache IP Updated', 'varnish-http-purge' );
|
215 |
$set_type = 'updated';
|
216 |
-
$output = $input;
|
217 |
}
|
218 |
|
219 |
add_settings_error( 'vhp_varnish_ip', 'varnish-ip', $set_message, $set_type );
|
167 |
$varniship = get_site_option( 'vhp_varnish_ip' );
|
168 |
}
|
169 |
|
170 |
+
if ( is_array( $varniship ) ) {
|
171 |
+
$list_varniship = implode( ',', $varniship );
|
172 |
+
} else {
|
173 |
+
$list_varniship = $varniship;
|
174 |
+
}
|
175 |
+
|
176 |
+
?>
|
177 |
+
<input type="text" id="vhp_varnish_ip" name="vhp_varnish_ip" value="<?php echo esc_attr( $list_varniship ); ?>" size="25" <?php disabled( $disabled, true ); ?> />
|
178 |
+
<label for="vhp_varnish_ip">
|
179 |
+
<?php
|
180 |
|
181 |
if ( $disabled ) {
|
182 |
esc_html_e( 'A Proxy Cache IP has been defined in your wp-config file, so it is not editable in settings.', 'varnish-http-purge' );
|
183 |
} else {
|
184 |
esc_html_e( 'Examples: ', 'varnish-http-purge' );
|
185 |
+
echo '<br /><code>123.45.67.89</code><br /><code>localhost</code><br /><code>12.34.56.78, 23.45.67.89</code>';
|
186 |
}
|
187 |
|
188 |
echo '</label>';
|
202 |
|
203 |
if ( empty( $input ) ) {
|
204 |
return; // do nothing.
|
205 |
+
} elseif ( strpos( $input, ',' ) !== false ) {
|
206 |
// Turn IPs into an array
|
207 |
+
$ips = array_map( 'trim', explode( ',', $input ) );
|
208 |
$valid_ips = array();
|
209 |
|
210 |
foreach ( $ips as $ip ) {
|
211 |
+
$valid_ips[] = sanitize_text_field( $ip );
|
|
|
|
|
212 |
}
|
213 |
// If all the IPs are valid, then we can carry on.
|
214 |
if ( ! empty( $valid_ips ) ) {
|
216 |
$set_type = 'updated';
|
217 |
$output = implode( ', ', $valid_ips );
|
218 |
}
|
219 |
+
} else {
|
220 |
$set_message = __( 'Proxy Cache IP Updated', 'varnish-http-purge' );
|
221 |
$set_type = 'updated';
|
222 |
+
$output = sanitize_text_field( $input );
|
223 |
}
|
224 |
|
225 |
add_settings_error( 'vhp_varnish_ip', 'varnish-ip', $set_message, $set_type );
|
todo.txt
CHANGED
@@ -4,3 +4,4 @@ We're going to sit down and look into how the plugin is structured to make it ev
|
|
4 |
|
5 |
* Refactor automated purge all to be kinder
|
6 |
* Get rid of the need to parse_url()
|
|
4 |
|
5 |
* Refactor automated purge all to be kinder
|
6 |
* Get rid of the need to parse_url()
|
7 |
+
* Allow additional domains to be purged.
|
varnish-http-purge.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Proxy Cache Purge
|
4 |
* Plugin URI: https://github.com/ipstenu/varnish-http-purge/
|
5 |
* Description: Automatically empty cached pages when content on your site is modified.
|
6 |
-
* Version: 5.0.
|
7 |
* Author: Mika Epstein
|
8 |
* Author URI: https://halfelf.org/
|
9 |
* License: http://www.apache.org/licenses/LICENSE-2.0
|
@@ -839,7 +839,7 @@ class VarnishPurger {
|
|
839 |
);
|
840 |
|
841 |
foreach ( $json_disablers as $json_plugin ) {
|
842 |
-
if ( is_plugin_active( $json_plugin ) ) {
|
843 |
$json_disabled = true;
|
844 |
}
|
845 |
}
|
3 |
* Plugin Name: Proxy Cache Purge
|
4 |
* Plugin URI: https://github.com/ipstenu/varnish-http-purge/
|
5 |
* Description: Automatically empty cached pages when content on your site is modified.
|
6 |
+
* Version: 5.0.2
|
7 |
* Author: Mika Epstein
|
8 |
* Author URI: https://halfelf.org/
|
9 |
* License: http://www.apache.org/licenses/LICENSE-2.0
|
839 |
);
|
840 |
|
841 |
foreach ( $json_disablers as $json_plugin ) {
|
842 |
+
if ( function_exists( 'is_plugin_active' ) && is_plugin_active( $json_plugin ) ) {
|
843 |
$json_disabled = true;
|
844 |
}
|
845 |
}
|