Version Description
- June 2018
- Due to contention (devs hate it, users like it) the empty cache button colour on the toolbar is removed, and replaced with a carrot icon (I did not make it orange, but I wanted to)
- Add carrot icon to collapsed (mobile) toolbar
- Better button hiding
- Fixed a stupid argument issue with flushing memcached and I should have known better but oh well
- FAQ update re nginx
Download this release
Release Info
Developer | Ipstenu |
Plugin | Varnish HTTP Purge |
Version | 4.5.1 |
Comparing to | |
See all releases |
Code changes from version 4.5.0 to 4.5.1
- changelog.txt +49 -38
- debug.php +6 -3
- readme.txt +37 -27
- style.css +17 -2
- varnish-http-purge.php +23 -23
changelog.txt
CHANGED
@@ -1,26 +1,37 @@
|
|
1 |
## CHANGELOG
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
* May 2018
|
5 |
* Remote storage of problem plugins/themes
|
|
|
|
|
|
|
6 |
|
7 |
-
|
8 |
* March 2018
|
9 |
* Improve translations
|
10 |
* Massive improvements to the debugging tools
|
11 |
* Allow for port to be added to host headers (props @davidbarratt)
|
12 |
* WP-CLI for debugging
|
13 |
|
14 |
-
|
15 |
* 10 October 2017
|
16 |
* Copied a wrong line.
|
17 |
|
18 |
-
|
19 |
* 10 October 2017
|
20 |
* Add Varnish Flush for "this" page on front end
|
21 |
* Do not flush non-public taxonomies
|
22 |
|
23 |
-
|
24 |
* 30 August 2017
|
25 |
* More flexible support for custom cat/tag bases
|
26 |
* Added in support for custom taxonomies
|
@@ -28,13 +39,13 @@
|
|
28 |
* Move right now box to be called later, preventing double calls
|
29 |
* Extra check for if it's a URL, because some plugins are weird (props @danielkun)
|
30 |
|
31 |
-
|
32 |
|
33 |
* JSON - fixed overzealous json assumptions from causing errors
|
34 |
* WP-CLI - fixed prepending of domain on domain when using purge on a domain (props @ocean90)
|
35 |
* Typos. We hate them.
|
36 |
|
37 |
-
|
38 |
|
39 |
* JSON / REST API Support
|
40 |
* Fix for Varnish Status Page on MAMP (props @jeremyclarke)
|
@@ -43,24 +54,24 @@
|
|
43 |
* Drop support for pre 4.7 because of JSON / REST API
|
44 |
* Support flushing cache for private pages
|
45 |
|
46 |
-
|
47 |
* Better explanation when Cloudflare gets in the way of DNS
|
48 |
* Rename flush button for people who don't speak Varnish
|
49 |
|
50 |
-
|
51 |
* Support for WP-CLI commands and PHP > 5.5 (though please upgrade, props @robertpeake)
|
52 |
* Better information regarding Cloudflare
|
53 |
* Better failure on domains for scanner
|
54 |
* Better IP detection
|
55 |
* Break apart settings for faster saving
|
56 |
|
57 |
-
|
58 |
* Fix typo (on -> one)
|
59 |
* Correct permissions on Multisite (props @phh - resolves #27 #28)
|
60 |
* Correct weird merge error (props @phh - resolves #25 #26)
|
61 |
* Fix formatting in Changelog
|
62 |
|
63 |
-
|
64 |
* Added Varnish Status Page - Tools -> Varnish Status (includes basic scanning etc)
|
65 |
* Allow filter for `home_url()`
|
66 |
* Update readme with list of filters.
|
@@ -71,17 +82,17 @@
|
|
71 |
* Purge 'default' AMP URL as well
|
72 |
* Cleanup on Uninstall
|
73 |
|
74 |
-
|
75 |
* Update Documentation and Readme
|
76 |
|
77 |
-
|
78 |
* Change purge notice so it can be dismissed.
|
79 |
* Fix purging of deleted posts.
|
80 |
|
81 |
-
|
82 |
* Fixing i18n which wasn't working and threw a stupid error on sites without pretty permalinks. (Props DH customer Rasmus and employee Heckman!)
|
83 |
|
84 |
-
|
85 |
* Retain query params on purge
|
86 |
* Do not use query part for regex purging [Credit: shaula](https://github.com/Ipstenu/varnish-http-purge/pull/18)
|
87 |
* Allow Varnish IP to be filtered. [Credit: floatingio](https://wordpress.org/support/topic/supply-varnish-ip-via-filter)
|
@@ -89,91 +100,91 @@
|
|
89 |
* Add filter so other plugins can add events to trigger purge when they have no post ID
|
90 |
* Add compatibility with [Autoptimize](https://wordpress.org/plugins/autoptimize/) so it flushes Varnish when you flush their cache
|
91 |
|
92 |
-
|
93 |
* Add varnish_http_purge_events filter to allow people to add their own events for purging. (props @norcross)
|
94 |
* Add a method to grab the response from purge request and pass to the 'after_purge_url' action for debugging. (props @shaula)
|
95 |
* Added wp-cli command: wp varnish purge (to purge varnish)
|
96 |
* Adding some docblocks
|
97 |
* Fixing i18n
|
98 |
|
99 |
-
|
100 |
* Add varnish_http_purge_schema filter for changing the default schema. The default remains http (even if you set your home and/or site URL to https) because of sanity, but in order to support some edge cases, they can filter if they want. (props Drumba)
|
101 |
|
102 |
-
|
103 |
* Revisions were being mishandled and purging all inappropriately. (props Cha0sgr)
|
104 |
|
105 |
-
|
106 |
* Archives weren't purging. (props Ingraye)
|
107 |
|
108 |
-
|
109 |
* Optimizing flushes.
|
110 |
* Add filter to allow other people to hook in when 3rd party plugins are abjectly weird (props jnachtigall)
|
111 |
|
112 |
-
|
113 |
* Making purge be http only, since Varnish doesn't support https. This will prevent other issues for people using SSL with Varnish (though goodness knows why...)
|
114 |
* Forcing backslash on home_url. Why WP doesn't, I have no idea, but this will help sites not running regex.
|
115 |
|
116 |
-
|
117 |
* Language fix
|
118 |
* Using add_query_arg
|
119 |
* Ignore revisions
|
120 |
|
121 |
-
|
122 |
* Isset wrap for URL path and query which may not be set in rare conditions (props <a href="https://wordpress.org/support/topic/undefined-index-notices-4">hsz</a>)
|
123 |
* Added in flushing for feeds (requested by <a href="https://wordpress.org/support/topic/feed-not-purged">heypete</a>)
|
124 |
|
125 |
-
|
126 |
* Multisite support
|
127 |
* Button in toolbar
|
128 |
* Fix define message in debug mode
|
129 |
* Better parsing for if you set the define in the DB or config.
|
130 |
|
131 |
-
|
132 |
* Rollback. Sorry.
|
133 |
|
134 |
-
|
135 |
* Per request of Jetpack team, added in a <code>wp_cache_flush()</code> call when manually purging. This should only impact server side PHP caches (APC, Memcached etc)
|
136 |
|
137 |
-
|
138 |
* Varnish IP was too persnickity in PHP 5.4 (added in an 'and if not null' check - props <a href="http://wordpress.org/support/topic/patch-a-little-patch-to-purge-on-comment-posting">colinleroy</a>)
|
139 |
|
140 |
-
|
141 |
* Language Pack fixing.
|
142 |
|
143 |
-
|
144 |
* Quick and dirty fix for a plugin that is causing the URLs to purge <em>ALL THE TIME</em>
|
145 |
|
146 |
-
|
147 |
* Correcting conflict with host's default config.
|
148 |
|
149 |
-
|
150 |
* Refactoring Cleanup (otherwise known as Copy/Pasta error in variable name). (props Shredder)
|
151 |
|
152 |
-
|
153 |
* Adds 'Purge Varnish' button
|
154 |
* More selective purging, to account for different server setups
|
155 |
* Tighened up what purges and when
|
156 |
* Flushing categories and tags (per code from WP Super Cache, thanks!)
|
157 |
* Clarify requirements (Varnish and Pretty Permalinks)
|
158 |
|
159 |
-
|
160 |
* Purge images on deletion
|
161 |
* Fix for a VarnishIP when behind proxy servers not working on all hosts (props Berler)
|
162 |
|
163 |
-
|
164 |
* typo (hit . instead of / - Props John B. Manos)
|
165 |
|
166 |
-
|
167 |
* Added in workaround for Varnish purge reqs going AWOL when another proxy server is in place. (props to Shredder and Berler)
|
168 |
* Cache flushes when you change themes
|
169 |
|
170 |
-
|
171 |
* Header Image
|
172 |
|
173 |
-
|
174 |
* Commit access handed to Ipstenu
|
175 |
* Changed CURL to wp_remote_request (thank you <a href="http://wordpress.org/support/topic/incompatability-with-editorial-calendar-plugin?replies=1">Kenn Wilson</a>) so we don't have to do <a href="http://wordpress.org/support/topic/plugin-varnish-http-purge-incompatibility-with-woocommerce?replies=6">CURLOPT_RETURNTRANSFER</a> Remember kids, CURL is okay, but wp_remote_request is more better.
|
176 |
|
177 |
-
|
178 |
* Moved actual request execution to "shutdown" event
|
179 |
* Removed GET request due to bad performance impact
|
1 |
## CHANGELOG
|
2 |
|
3 |
+
=== 4.5.1 ===
|
4 |
+
* June 2018
|
5 |
+
* Due to contention (devs hate it, users like it) the empty cache button colour on the toolbar is removed, and replaced with a carrot icon (I did not make it orange, but I wanted to)
|
6 |
+
* Add carrot icon to collapsed (mobile) toolbar
|
7 |
+
* Better button hiding
|
8 |
+
* Fixed a stupid argument issue with flushing memcached and I should have known better but oh well
|
9 |
+
* FAQ update re nginx
|
10 |
+
|
11 |
+
=== 4.5.0 ===
|
12 |
* May 2018
|
13 |
* Remote storage of problem plugins/themes
|
14 |
+
* Prevent auto-loading of scan for improved disclosure and compliance
|
15 |
+
* Changed colour of the purge button for improved visibility
|
16 |
+
* Support for nginx proxy headers
|
17 |
|
18 |
+
=== 4.4.0 ===
|
19 |
* March 2018
|
20 |
* Improve translations
|
21 |
* Massive improvements to the debugging tools
|
22 |
* Allow for port to be added to host headers (props @davidbarratt)
|
23 |
* WP-CLI for debugging
|
24 |
|
25 |
+
=== 4.3.1 ===
|
26 |
* 10 October 2017
|
27 |
* Copied a wrong line.
|
28 |
|
29 |
+
=== 4.3.0 ===
|
30 |
* 10 October 2017
|
31 |
* Add Varnish Flush for "this" page on front end
|
32 |
* Do not flush non-public taxonomies
|
33 |
|
34 |
+
=== 4.2.0 ===
|
35 |
* 30 August 2017
|
36 |
* More flexible support for custom cat/tag bases
|
37 |
* Added in support for custom taxonomies
|
39 |
* Move right now box to be called later, preventing double calls
|
40 |
* Extra check for if it's a URL, because some plugins are weird (props @danielkun)
|
41 |
|
42 |
+
=== 4.1.1 ===
|
43 |
|
44 |
* JSON - fixed overzealous json assumptions from causing errors
|
45 |
* WP-CLI - fixed prepending of domain on domain when using purge on a domain (props @ocean90)
|
46 |
* Typos. We hate them.
|
47 |
|
48 |
+
=== 4.1 ===
|
49 |
|
50 |
* JSON / REST API Support
|
51 |
* Fix for Varnish Status Page on MAMP (props @jeremyclarke)
|
54 |
* Drop support for pre 4.7 because of JSON / REST API
|
55 |
* Support flushing cache for private pages
|
56 |
|
57 |
+
=== 4.0.3 ===
|
58 |
* Better explanation when Cloudflare gets in the way of DNS
|
59 |
* Rename flush button for people who don't speak Varnish
|
60 |
|
61 |
+
=== 4.0.2 ===
|
62 |
* Support for WP-CLI commands and PHP > 5.5 (though please upgrade, props @robertpeake)
|
63 |
* Better information regarding Cloudflare
|
64 |
* Better failure on domains for scanner
|
65 |
* Better IP detection
|
66 |
* Break apart settings for faster saving
|
67 |
|
68 |
+
=== 4.0.1 ===
|
69 |
* Fix typo (on -> one)
|
70 |
* Correct permissions on Multisite (props @phh - resolves #27 #28)
|
71 |
* Correct weird merge error (props @phh - resolves #25 #26)
|
72 |
* Fix formatting in Changelog
|
73 |
|
74 |
+
=== 4.0 ===
|
75 |
* Added Varnish Status Page - Tools -> Varnish Status (includes basic scanning etc)
|
76 |
* Allow filter for `home_url()`
|
77 |
* Update readme with list of filters.
|
82 |
* Purge 'default' AMP URL as well
|
83 |
* Cleanup on Uninstall
|
84 |
|
85 |
+
=== 3.9.3 ===
|
86 |
* Update Documentation and Readme
|
87 |
|
88 |
+
=== 3.9.2 ===
|
89 |
* Change purge notice so it can be dismissed.
|
90 |
* Fix purging of deleted posts.
|
91 |
|
92 |
+
=== 3.9.1 ===
|
93 |
* Fixing i18n which wasn't working and threw a stupid error on sites without pretty permalinks. (Props DH customer Rasmus and employee Heckman!)
|
94 |
|
95 |
+
=== 3.9 ===
|
96 |
* Retain query params on purge
|
97 |
* Do not use query part for regex purging [Credit: shaula](https://github.com/Ipstenu/varnish-http-purge/pull/18)
|
98 |
* Allow Varnish IP to be filtered. [Credit: floatingio](https://wordpress.org/support/topic/supply-varnish-ip-via-filter)
|
100 |
* Add filter so other plugins can add events to trigger purge when they have no post ID
|
101 |
* Add compatibility with [Autoptimize](https://wordpress.org/plugins/autoptimize/) so it flushes Varnish when you flush their cache
|
102 |
|
103 |
+
=== 3.8 ===
|
104 |
* Add varnish_http_purge_events filter to allow people to add their own events for purging. (props @norcross)
|
105 |
* Add a method to grab the response from purge request and pass to the 'after_purge_url' action for debugging. (props @shaula)
|
106 |
* Added wp-cli command: wp varnish purge (to purge varnish)
|
107 |
* Adding some docblocks
|
108 |
* Fixing i18n
|
109 |
|
110 |
+
=== 3.7.3 ===
|
111 |
* Add varnish_http_purge_schema filter for changing the default schema. The default remains http (even if you set your home and/or site URL to https) because of sanity, but in order to support some edge cases, they can filter if they want. (props Drumba)
|
112 |
|
113 |
+
=== 3.7.2 ===
|
114 |
* Revisions were being mishandled and purging all inappropriately. (props Cha0sgr)
|
115 |
|
116 |
+
=== 3.7.1 ===
|
117 |
* Archives weren't purging. (props Ingraye)
|
118 |
|
119 |
+
=== 3.7 ===
|
120 |
* Optimizing flushes.
|
121 |
* Add filter to allow other people to hook in when 3rd party plugins are abjectly weird (props jnachtigall)
|
122 |
|
123 |
+
=== 3.6 ===
|
124 |
* Making purge be http only, since Varnish doesn't support https. This will prevent other issues for people using SSL with Varnish (though goodness knows why...)
|
125 |
* Forcing backslash on home_url. Why WP doesn't, I have no idea, but this will help sites not running regex.
|
126 |
|
127 |
+
=== 3.5.1 ===
|
128 |
* Language fix
|
129 |
* Using add_query_arg
|
130 |
* Ignore revisions
|
131 |
|
132 |
+
=== 3.5 ===
|
133 |
* Isset wrap for URL path and query which may not be set in rare conditions (props <a href="https://wordpress.org/support/topic/undefined-index-notices-4">hsz</a>)
|
134 |
* Added in flushing for feeds (requested by <a href="https://wordpress.org/support/topic/feed-not-purged">heypete</a>)
|
135 |
|
136 |
+
=== 3.4 ===
|
137 |
* Multisite support
|
138 |
* Button in toolbar
|
139 |
* Fix define message in debug mode
|
140 |
* Better parsing for if you set the define in the DB or config.
|
141 |
|
142 |
+
=== 3.3.4 ===
|
143 |
* Rollback. Sorry.
|
144 |
|
145 |
+
=== 3.3.3 ===
|
146 |
* Per request of Jetpack team, added in a <code>wp_cache_flush()</code> call when manually purging. This should only impact server side PHP caches (APC, Memcached etc)
|
147 |
|
148 |
+
=== 3.3.2 ===
|
149 |
* Varnish IP was too persnickity in PHP 5.4 (added in an 'and if not null' check - props <a href="http://wordpress.org/support/topic/patch-a-little-patch-to-purge-on-comment-posting">colinleroy</a>)
|
150 |
|
151 |
+
=== 3.3.1 ===
|
152 |
* Language Pack fixing.
|
153 |
|
154 |
+
=== 3.3 ===
|
155 |
* Quick and dirty fix for a plugin that is causing the URLs to purge <em>ALL THE TIME</em>
|
156 |
|
157 |
+
=== 3.2 ===
|
158 |
* Correcting conflict with host's default config.
|
159 |
|
160 |
+
=== 3.1 ===
|
161 |
* Refactoring Cleanup (otherwise known as Copy/Pasta error in variable name). (props Shredder)
|
162 |
|
163 |
+
=== 3.0 ===
|
164 |
* Adds 'Purge Varnish' button
|
165 |
* More selective purging, to account for different server setups
|
166 |
* Tighened up what purges and when
|
167 |
* Flushing categories and tags (per code from WP Super Cache, thanks!)
|
168 |
* Clarify requirements (Varnish and Pretty Permalinks)
|
169 |
|
170 |
+
=== 2.3 ===
|
171 |
* Purge images on deletion
|
172 |
* Fix for a VarnishIP when behind proxy servers not working on all hosts (props Berler)
|
173 |
|
174 |
+
=== 2.2.1 ===
|
175 |
* typo (hit . instead of / - Props John B. Manos)
|
176 |
|
177 |
+
=== 2.2 ===
|
178 |
* Added in workaround for Varnish purge reqs going AWOL when another proxy server is in place. (props to Shredder and Berler)
|
179 |
* Cache flushes when you change themes
|
180 |
|
181 |
+
=== 2.1 ===
|
182 |
* Header Image
|
183 |
|
184 |
+
=== 2.0 ===
|
185 |
* Commit access handed to Ipstenu
|
186 |
* Changed CURL to wp_remote_request (thank you <a href="http://wordpress.org/support/topic/incompatability-with-editorial-calendar-plugin?replies=1">Kenn Wilson</a>) so we don't have to do <a href="http://wordpress.org/support/topic/plugin-varnish-http-purge-incompatibility-with-woocommerce?replies=6">CURLOPT_RETURNTRANSFER</a> Remember kids, CURL is okay, but wp_remote_request is more better.
|
187 |
|
188 |
+
=== 1.2.0 ===
|
189 |
* Moved actual request execution to "shutdown" event
|
190 |
* Removed GET request due to bad performance impact
|
debug.php
CHANGED
@@ -39,9 +39,11 @@ class VarnishDebug {
|
|
39 |
)
|
40 |
);
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
|
|
|
|
|
45 |
}
|
46 |
|
47 |
/**
|
@@ -505,6 +507,7 @@ class VarnishDebug {
|
|
505 |
'cookies' => __( 'This plugin uses cookies, which prevents server side caching.', 'varnish-http-purge' ),
|
506 |
'cache' => __( 'This type of caching plugin does not work well with server side caching.', 'varnish-http-purge' ),
|
507 |
'ancient' => __( 'This plugin is not up to date with WordPress best practices and breaks caching.', 'varnish-http-purge' ),
|
|
|
508 |
);
|
509 |
$request = wp_remote_get( 'https://varnish-http-purge.objects-us-east-1.dream.io/plugins.json' );
|
510 |
|
39 |
)
|
40 |
);
|
41 |
|
42 |
+
// Lazy run twice to make sure we get a primed cache page
|
43 |
+
$response1 = wp_remote_get( $url, $args );
|
44 |
+
$response2 = wp_remote_get( $url, $args );
|
45 |
+
|
46 |
+
return $response2;
|
47 |
}
|
48 |
|
49 |
/**
|
507 |
'cookies' => __( 'This plugin uses cookies, which prevents server side caching.', 'varnish-http-purge' ),
|
508 |
'cache' => __( 'This type of caching plugin does not work well with server side caching.', 'varnish-http-purge' ),
|
509 |
'ancient' => __( 'This plugin is not up to date with WordPress best practices and breaks caching.', 'varnish-http-purge' ),
|
510 |
+
'removed' => __( 'This plugin was removed from WordPress.org and we do not recommend it\'s use.', 'varnish-http-purge' ),
|
511 |
);
|
512 |
$request = wp_remote_get( 'https://varnish-http-purge.objects-us-east-1.dream.io/plugins.json' );
|
513 |
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
|
2 |
Contributors: Ipstenu, mikeschroder, techpriester
|
3 |
Tags: varnish, purge, cache
|
4 |
Requires at least: 4.7
|
5 |
Tested up to: 4.9
|
6 |
-
Stable tag: 4.5.
|
7 |
Requires PHP: 5.6
|
8 |
|
9 |
Automatically empty Varnish Cache when content on your site is modified.
|
@@ -33,23 +33,23 @@ Plugins can hook into the purge actions as well, to filter their own events to t
|
|
33 |
|
34 |
On a multisite network using subfolders, only <strong>network admins</strong> can purge the main site. This is a security decision, as emptying the cache too often can be computationally expensive and cause server outages for a network.
|
35 |
|
36 |
-
|
37 |
|
38 |
* `wp varnish purge` - Flush the entire cache
|
39 |
* `wp varnish debug` - Help for debugging how well Varnish is (or isn't) working
|
40 |
|
41 |
-
|
42 |
|
43 |
If you're working on a site and need to turn off caching, add this to your wp-config file: `define( 'VHP_DEBUG', true );`
|
44 |
|
45 |
That will break cache on page loads. It is _not_ recommended for production!
|
46 |
|
47 |
-
|
48 |
|
49 |
* Pretty Permalinks enabled
|
50 |
* Varnish 3.x or higher
|
51 |
|
52 |
-
|
53 |
|
54 |
By default, no data is tracked. If you use the site scanner/debugging tool, your domain and IP address will access [a remote service hosted on DreamObjects](https://varnish-http-purge.objects-us-east-1.dream.io/readme.txt). No personally identifying transaction data is recorded or stored, only overall usage. IP addresses of the website making the request may be recorded by the service, but there is no way to access them and use it to correspond with individuals or processes.
|
55 |
|
@@ -61,55 +61,55 @@ Use of this service is required for the debugging tool, in order to provide up t
|
|
61 |
|
62 |
If you have code patches, [pull requests are welcome](https://github.com/Ipstenu/varnish-http-purge).
|
63 |
|
64 |
-
|
65 |
|
66 |
No. This plugin tells your cache system when content is updated, and to delete the cached data at that time.
|
67 |
|
68 |
-
|
69 |
|
70 |
When you update content on your site, like making a post or editing one, or someone leaving a comment, WordPress triggers a command on your server to purge (aka empty) the cache for any related pages, including the REST API.
|
71 |
|
72 |
-
|
73 |
|
74 |
Philosophy. There are many other plugins out there which will allow you to granularly select what pages should and should not be deleted on updates. With that in mind, the choice was made for decisions instead of options, and simplicity was the driving principle. The plugin decides what's best to delete on updates, and provides hooks for developers to use as needed.
|
75 |
|
76 |
-
|
77 |
|
78 |
Yes! Click the 'Empty Cache' button on the "Right Now" Dashboard (see the screenshot if you can't find it). There's also an "Empty Cache" button on the admin toolbar.
|
79 |
|
80 |
If you don't see a button, then your account doesn't have the appropriate permissions. Only administrators can empty the entire cache. In the case of a subfolder multisite network, only the <em>network</em> admins can empty the cache for the primary site.
|
81 |
|
82 |
-
|
83 |
|
84 |
No. WordPress can't detect file changes like that, and you really don't want it to. That would empty the cache every time you edited any file, which would cause your site to become unstable. You will need to use the Empty Cache buttons when you're done editing your code.
|
85 |
|
86 |
-
|
87 |
|
88 |
No. Some of them have behaviour that causes Varnish not to cache, either by accident or design.
|
89 |
|
90 |
-
|
91 |
|
92 |
Yes! [Full documentation can be found on Custom Filters in the wiki](https://github.com/Ipstenu/varnish-http-purge/wiki/Custom-Filters).
|
93 |
|
94 |
-
|
95 |
|
96 |
Yes and no. Remember, the plugin isn't doing the caching so it really depends on your server setup. You can set the following define in your `wp-config.php` file to attempt and disable caching, however this may not work on all setups: `define( 'VHP_DEBUG', true );`
|
97 |
|
98 |
-
|
99 |
|
100 |
From your WordPress Dashboard, go to <em>Tools</em> -> <em>Varnish Debugging</em>. There a page will auto-scan your front page and report back any issues found. This includes any known problematic plugins. You can use it to scan any URL on your domain (but ONLY on your own domain).
|
101 |
|
102 |
-
|
103 |
|
104 |
The scan files were off-loaded to a service to allow for more frequent updates without having to require people to update the plugin. In order to ensure no one is scanned without consent, the auto-scanning was disabled.
|
105 |
|
106 |
-
|
107 |
|
108 |
PageSpeed likes to put in Caching headers to say <em>not</em> to cache. To fix this, you need to put this in your `.htaccess` section for PageSpeed: `ModPagespeedModifyCachingHeaders off`
|
109 |
|
110 |
If you're using nginx, it's `pagespeed ModifyCachingHeaders off;`
|
111 |
|
112 |
-
|
113 |
|
114 |
When you use CloudFlare or any other similar service, you've put a proxy in front of the Varnish proxy. In general this isn't a bad thing, though it can introduce some network latency (that means your site may run slower because it has to go through multiple layers to get to the content). The problem arises when WordPress tries to send the purge request to your domain name and, with a proxy, that means the proxy service and not your website.
|
115 |
|
@@ -119,7 +119,7 @@ Replace "123.45.67.89" with the IP of your <em>Varnish Server</em> (not CloudFla
|
|
119 |
|
120 |
If you want to use WP-CLI, you can set an option in the database. This will NOT take precedence over the define, it's just there to let hosts who are using something like wp-cli do this for you in an automated fashion: `wp option update vhp_varnish_ip 123.45.67.890`
|
121 |
|
122 |
-
|
123 |
|
124 |
Your Varnish IP must be one of the IPs that Varnish is listening on. If you use multiple IPs, or if you've customized your ACLs, you'll need to pick on that doesn't conflict with your other settings. For example, if you have Varnish listening on a public and private IP, you'll want to pick the private. On the other hand, if you told Varnish to listen on 0.0.0.0 (i.e. "listen on every interface you can") you would need to check what IP you set your purge ACL to allow (commonly 127.0.0.1 aka localhost), and use that (i.e. 127.0.0.1).
|
125 |
|
@@ -129,23 +129,23 @@ If your webhost set up Varnish, you may need to ask them for the specifics if th
|
|
129 |
<li><strong>DreamHost</strong> - If you're using DreamPress and Cloudflare, go into the Panel and click on the DNS settings for the domain. The entry for <em>resolve-to.domain</em> is your varnish server: `resolve-to.www A 208.97.157.172` -- If you're <em>NOT</em> using Cloudflare, you don't need it; it's just your normal IP.</li>
|
130 |
</ul>
|
131 |
|
132 |
-
|
133 |
|
134 |
Multiple IPs are not supported at this time.
|
135 |
|
136 |
-
|
137 |
|
138 |
No. I will try to point you towards solving it on your own. This may mean you have to decide if using a specific plugin or theme is worth an imperfect cache.
|
139 |
|
140 |
-
|
141 |
|
142 |
This was built and tested on Varnish 3.x. While it is reported to work on 2.x and 4.x, it is only supported on v3 at this time.
|
143 |
|
144 |
-
|
145 |
|
146 |
-
It can, if you configured nginx caching to respect the curl PURGE request.
|
147 |
|
148 |
-
|
149 |
|
150 |
This is a question beyond the support of plugin. I do not have the resources available to offer any configuration help. Here are some basic gotchas to be aware of:
|
151 |
|
@@ -153,11 +153,11 @@ This is a question beyond the support of plugin. I do not have the resources ava
|
|
153 |
* Not all cache services set up PURGE by default
|
154 |
* When flushing the whole cache, the plugin sends a PURGE command of <code>/.*</code> and sets the `X-Purge-Method` header to `regex`.
|
155 |
|
156 |
-
|
157 |
|
158 |
Danger! Here be dragons! If you're command line savvy, you can monitor the interactions between the plugin and Varnish. This can help you understand what's not working quite right, but it can very confusing. [Detailed directions can be found on the debugging section on GitHub](https://github.com/Ipstenu/varnish-http-purge/wiki#debugging).
|
159 |
|
160 |
-
|
161 |
|
162 |
* Yes, I do work for DreamHost.
|
163 |
* No, this plugin is not really official nor DreamHost Only
|
@@ -166,7 +166,17 @@ This plugin is installed by default for _all_ DreamPress installs on DreamHost,
|
|
166 |
|
167 |
== Changelog ==
|
168 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
= 4.5.0 =
|
|
|
170 |
* May 2018
|
171 |
* Remote storage of problem plugins/themes
|
172 |
* Prevent auto-loading of scan for improved disclosure and compliance
|
1 |
+
= Varnish HTTP Purge =
|
2 |
Contributors: Ipstenu, mikeschroder, techpriester
|
3 |
Tags: varnish, purge, cache
|
4 |
Requires at least: 4.7
|
5 |
Tested up to: 4.9
|
6 |
+
Stable tag: 4.5.1
|
7 |
Requires PHP: 5.6
|
8 |
|
9 |
Automatically empty Varnish Cache when content on your site is modified.
|
33 |
|
34 |
On a multisite network using subfolders, only <strong>network admins</strong> can purge the main site. This is a security decision, as emptying the cache too often can be computationally expensive and cause server outages for a network.
|
35 |
|
36 |
+
= WP CLI =
|
37 |
|
38 |
* `wp varnish purge` - Flush the entire cache
|
39 |
* `wp varnish debug` - Help for debugging how well Varnish is (or isn't) working
|
40 |
|
41 |
+
= Debugging =
|
42 |
|
43 |
If you're working on a site and need to turn off caching, add this to your wp-config file: `define( 'VHP_DEBUG', true );`
|
44 |
|
45 |
That will break cache on page loads. It is _not_ recommended for production!
|
46 |
|
47 |
+
= Requirements =
|
48 |
|
49 |
* Pretty Permalinks enabled
|
50 |
* Varnish 3.x or higher
|
51 |
|
52 |
+
= Privacy Policy =
|
53 |
|
54 |
By default, no data is tracked. If you use the site scanner/debugging tool, your domain and IP address will access [a remote service hosted on DreamObjects](https://varnish-http-purge.objects-us-east-1.dream.io/readme.txt). No personally identifying transaction data is recorded or stored, only overall usage. IP addresses of the website making the request may be recorded by the service, but there is no way to access them and use it to correspond with individuals or processes.
|
55 |
|
61 |
|
62 |
If you have code patches, [pull requests are welcome](https://github.com/Ipstenu/varnish-http-purge).
|
63 |
|
64 |
+
= Is this plugin caching my data? =
|
65 |
|
66 |
No. This plugin tells your cache system when content is updated, and to delete the cached data at that time.
|
67 |
|
68 |
+
= How does this plugin know what to delete? =
|
69 |
|
70 |
When you update content on your site, like making a post or editing one, or someone leaving a comment, WordPress triggers a command on your server to purge (aka empty) the cache for any related pages, including the REST API.
|
71 |
|
72 |
+
= Why doesn't the plugin automatically delete the whole cache? =
|
73 |
|
74 |
Philosophy. There are many other plugins out there which will allow you to granularly select what pages should and should not be deleted on updates. With that in mind, the choice was made for decisions instead of options, and simplicity was the driving principle. The plugin decides what's best to delete on updates, and provides hooks for developers to use as needed.
|
75 |
|
76 |
+
= Can I delete the entire cache? =
|
77 |
|
78 |
Yes! Click the 'Empty Cache' button on the "Right Now" Dashboard (see the screenshot if you can't find it). There's also an "Empty Cache" button on the admin toolbar.
|
79 |
|
80 |
If you don't see a button, then your account doesn't have the appropriate permissions. Only administrators can empty the entire cache. In the case of a subfolder multisite network, only the <em>network</em> admins can empty the cache for the primary site.
|
81 |
|
82 |
+
= Will the plugin delete my cache when I edit my theme or plugins? =
|
83 |
|
84 |
No. WordPress can't detect file changes like that, and you really don't want it to. That would empty the cache every time you edited any file, which would cause your site to become unstable. You will need to use the Empty Cache buttons when you're done editing your code.
|
85 |
|
86 |
+
= Does every WordPress plugin and theme work with Varnish? =
|
87 |
|
88 |
No. Some of them have behaviour that causes Varnish not to cache, either by accident or design.
|
89 |
|
90 |
+
= I'm a developer, can I tell your cache to empty in my plugin/theme? =
|
91 |
|
92 |
Yes! [Full documentation can be found on Custom Filters in the wiki](https://github.com/Ipstenu/varnish-http-purge/wiki/Custom-Filters).
|
93 |
|
94 |
+
= Can I turn off caching? =
|
95 |
|
96 |
Yes and no. Remember, the plugin isn't doing the caching so it really depends on your server setup. You can set the following define in your `wp-config.php` file to attempt and disable caching, however this may not work on all setups: `define( 'VHP_DEBUG', true );`
|
97 |
|
98 |
+
= How can I tell if everything's caching? =
|
99 |
|
100 |
From your WordPress Dashboard, go to <em>Tools</em> -> <em>Varnish Debugging</em>. There a page will auto-scan your front page and report back any issues found. This includes any known problematic plugins. You can use it to scan any URL on your domain (but ONLY on your own domain).
|
101 |
|
102 |
+
= Why doesn't the debug page autoload anymore? =
|
103 |
|
104 |
The scan files were off-loaded to a service to allow for more frequent updates without having to require people to update the plugin. In order to ensure no one is scanned without consent, the auto-scanning was disabled.
|
105 |
|
106 |
+
= Why is nothing caching when I use PageSpeed? =
|
107 |
|
108 |
PageSpeed likes to put in Caching headers to say <em>not</em> to cache. To fix this, you need to put this in your `.htaccess` section for PageSpeed: `ModPagespeedModifyCachingHeaders off`
|
109 |
|
110 |
If you're using nginx, it's `pagespeed ModifyCachingHeaders off;`
|
111 |
|
112 |
+
= Why aren't my changes showing when I use CloudFlare or another proxy? =
|
113 |
|
114 |
When you use CloudFlare or any other similar service, you've put a proxy in front of the Varnish proxy. In general this isn't a bad thing, though it can introduce some network latency (that means your site may run slower because it has to go through multiple layers to get to the content). The problem arises when WordPress tries to send the purge request to your domain name and, with a proxy, that means the proxy service and not your website.
|
115 |
|
119 |
|
120 |
If you want to use WP-CLI, you can set an option in the database. This will NOT take precedence over the define, it's just there to let hosts who are using something like wp-cli do this for you in an automated fashion: `wp option update vhp_varnish_ip 123.45.67.890`
|
121 |
|
122 |
+
= How do I find my Varnish IP? =
|
123 |
|
124 |
Your Varnish IP must be one of the IPs that Varnish is listening on. If you use multiple IPs, or if you've customized your ACLs, you'll need to pick on that doesn't conflict with your other settings. For example, if you have Varnish listening on a public and private IP, you'll want to pick the private. On the other hand, if you told Varnish to listen on 0.0.0.0 (i.e. "listen on every interface you can") you would need to check what IP you set your purge ACL to allow (commonly 127.0.0.1 aka localhost), and use that (i.e. 127.0.0.1).
|
125 |
|
129 |
<li><strong>DreamHost</strong> - If you're using DreamPress and Cloudflare, go into the Panel and click on the DNS settings for the domain. The entry for <em>resolve-to.domain</em> is your varnish server: `resolve-to.www A 208.97.157.172` -- If you're <em>NOT</em> using Cloudflare, you don't need it; it's just your normal IP.</li>
|
130 |
</ul>
|
131 |
|
132 |
+
= What if I have multiple varnish IPs? =
|
133 |
|
134 |
Multiple IPs are not supported at this time.
|
135 |
|
136 |
+
= Will you fix my site? =
|
137 |
|
138 |
No. I will try to point you towards solving it on your own. This may mean you have to decide if using a specific plugin or theme is worth an imperfect cache.
|
139 |
|
140 |
+
= What version of Varnish is supported? =
|
141 |
|
142 |
This was built and tested on Varnish 3.x. While it is reported to work on 2.x and 4.x, it is only supported on v3 at this time.
|
143 |
|
144 |
+
= Does this work with Nginx caching? =
|
145 |
|
146 |
+
It can, if you configured nginx caching to respect the curl PURGE request. If this doesn't work, I recommend setting your Varnish IP to `localhost` as Nginx requires a service control installed for the IP address to work.
|
147 |
|
148 |
+
= Will you write my cache rules for me? =
|
149 |
|
150 |
This is a question beyond the support of plugin. I do not have the resources available to offer any configuration help. Here are some basic gotchas to be aware of:
|
151 |
|
153 |
* Not all cache services set up PURGE by default
|
154 |
* When flushing the whole cache, the plugin sends a PURGE command of <code>/.*</code> and sets the `X-Purge-Method` header to `regex`.
|
155 |
|
156 |
+
= How can I see what the plugin is sending to Varnish? =
|
157 |
|
158 |
Danger! Here be dragons! If you're command line savvy, you can monitor the interactions between the plugin and Varnish. This can help you understand what's not working quite right, but it can very confusing. [Detailed directions can be found on the debugging section on GitHub](https://github.com/Ipstenu/varnish-http-purge/wiki#debugging).
|
159 |
|
160 |
+
= Hey, don't you work at DreamHost? Is this Official or DreamHost only? =
|
161 |
|
162 |
* Yes, I do work for DreamHost.
|
163 |
* No, this plugin is not really official nor DreamHost Only
|
166 |
|
167 |
== Changelog ==
|
168 |
|
169 |
+
= 4.5.1 =
|
170 |
+
|
171 |
+
* June 2018
|
172 |
+
* Due to contention (devs hate it, users like it) the empty cache button colour on the toolbar is removed, and replaced with a carrot icon (I did not make it orange, but I wanted to)
|
173 |
+
* Add carrot icon to collapsed (mobile) toolbar
|
174 |
+
* Better button hiding
|
175 |
+
* Fixed a stupid argument issue with flushing memcached and I should have known better but oh well
|
176 |
+
* FAQ update re nginx
|
177 |
+
|
178 |
= 4.5.0 =
|
179 |
+
|
180 |
* May 2018
|
181 |
* Remote storage of problem plugins/themes
|
182 |
* Prevent auto-loading of scan for improved disclosure and compliance
|
style.css
CHANGED
@@ -1,3 +1,18 @@
|
|
1 |
-
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
}
|
1 |
+
/* Add Orange Carrot Dashicon */
|
2 |
+
#wpadminbar #wp-admin-bar-purge-varnish-cache .ab-icon:before {
|
3 |
+
content: '\f511';
|
4 |
+
top: 4px;
|
5 |
+
/*color: #F56E28;*/
|
6 |
+
}
|
7 |
+
|
8 |
+
/* Add Orange Carrot to Button */
|
9 |
+
span.dashicons.dashicons-carrot.varnish-http-purge {
|
10 |
+
color: #F56E28;
|
11 |
+
vertical-align: middle;
|
12 |
+
}
|
13 |
+
|
14 |
+
@media screen and (max-width: 782px) {
|
15 |
+
#wpadminbar li#wp-admin-bar-purge-varnish-cache{
|
16 |
+
display: block!important;
|
17 |
+
}
|
18 |
}
|
varnish-http-purge.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
/*
|
3 |
Plugin Name: Varnish HTTP Purge
|
4 |
Plugin URI: https://halfelf.org/plugins/varnish-http-purge/
|
5 |
-
Description: Automatically empty
|
6 |
-
Version: 4.5.
|
7 |
Author: Mika Epstein
|
8 |
Author URI: https://halfelf.org/
|
9 |
License: http://www.apache.org/licenses/LICENSE-2.0
|
@@ -22,7 +22,6 @@ Network: true
|
|
22 |
Varnish HTTP Purge is distributed in the hope that it will be useful,
|
23 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
24 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
25 |
-
|
26 |
*/
|
27 |
|
28 |
/**
|
@@ -121,7 +120,7 @@ class VarnishPurger {
|
|
121 |
// Add Admin Bar
|
122 |
add_action( 'admin_bar_menu', array( $this, 'varnish_rightnow_adminbar' ), 100 );
|
123 |
add_action( 'admin_enqueue_scripts', array( $this, 'custom_css' ) );
|
124 |
-
add_action( '
|
125 |
}
|
126 |
|
127 |
/**
|
@@ -167,7 +166,6 @@ class VarnishPurger {
|
|
167 |
return $home_url;
|
168 |
}
|
169 |
|
170 |
-
|
171 |
/**
|
172 |
* Custom CSS to allow for coloring.
|
173 |
*
|
@@ -186,16 +184,18 @@ class VarnishPurger {
|
|
186 |
function varnish_rightnow_adminbar( $admin_bar ) {
|
187 |
global $wp;
|
188 |
|
189 |
-
|
190 |
-
|
191 |
-
array(
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
'
|
|
|
|
|
196 |
),
|
197 |
-
)
|
198 |
-
|
199 |
|
200 |
// Checking user permissions for who can and cannot use the all flush
|
201 |
if (
|
@@ -206,6 +206,7 @@ class VarnishPurger {
|
|
206 |
// Multisite - Site admins can purge UNLESS it's a subfolder install and we're on site #1
|
207 |
( is_multisite() && current_user_can( 'activate_plugins' ) && ( SUBDOMAIN_INSTALL || ( !SUBDOMAIN_INSTALL && ( BLOG_ID_CURRENT_SITE != $blog_id ) ) ) )
|
208 |
) {
|
|
|
209 |
$args[] = array(
|
210 |
'parent' => 'purge-varnish-cache',
|
211 |
'id' => 'purge-varnish-cache-all',
|
@@ -221,13 +222,12 @@ class VarnishPurger {
|
|
221 |
'parent' => 'purge-varnish-cache',
|
222 |
'id' => 'purge-varnish-cache-db',
|
223 |
'title' => __( 'Database Cache', 'varnish-http-purge' ),
|
224 |
-
'href' => wp_nonce_url( add_query_arg( '
|
225 |
'meta' => array(
|
226 |
'title' => __( 'Database Cache', 'varnish-http-purge' ),
|
227 |
),
|
228 |
);
|
229 |
}
|
230 |
-
|
231 |
}
|
232 |
|
233 |
// If we're on a front end page and the current user can edit published posts, then they can do this:
|
@@ -260,7 +260,7 @@ class VarnishPurger {
|
|
260 |
$url = wp_nonce_url( add_query_arg( 'vhp_flush_do', 'all' ), 'vhp-flush-do' );
|
261 |
$intro = sprintf( __( '<a href="%1$s">Varnish HTTP Purge</a> automatically deletes your cached posts when published or updated. When making major site changes, such as with a new theme, plugins, or widgets, you may need to manually empty the cache.', 'varnish-http-purge' ), 'http://wordpress.org/plugins/varnish-http-purge/' );
|
262 |
$button = __( 'Press the button below to force it to empty your entire Varnish cache.', 'varnish-http-purge' );
|
263 |
-
$button .= '</p><p><span class="button"><a href="'.$url.'"><strong>';
|
264 |
$button .= __( 'Empty Cache', 'varnish-http-purge' );
|
265 |
$button .= '</strong></a></span>';
|
266 |
$nobutton = __( 'You do not have permission to empty the Varnish cache for the whole site. Please contact your administrator.', 'varnish-http-purge' );
|
@@ -337,15 +337,15 @@ class VarnishPurger {
|
|
337 |
public function executePurge() {
|
338 |
$purgeUrls = array_unique( $this->purgeUrls );
|
339 |
|
340 |
-
if ( empty( $purgeUrls ) ) {
|
341 |
-
if ( isset( $_GET['
|
342 |
-
// Flush DB Cache
|
343 |
-
wp_cache_flush();
|
344 |
-
} elseif ( isset( $_GET['vhp_flush_all'] ) && check_admin_referer( 'vhp-flush-all' ) ) {
|
345 |
// Flush Varnish Cache recursize
|
346 |
$this->purgeUrl( $this->the_home_url() . '/?vhp-regex' );
|
347 |
} elseif ( isset( $_GET['vhp_flush_do'] ) && check_admin_referer( 'vhp-flush-do' ) ) {
|
348 |
-
if ( $_GET['vhp_flush_do'] == '
|
|
|
|
|
|
|
349 |
// Flush Varnish Cache recursize
|
350 |
$this->purgeUrl( $this->the_home_url() . '/?vhp-regex' );
|
351 |
} else {
|
2 |
/*
|
3 |
Plugin Name: Varnish HTTP Purge
|
4 |
Plugin URI: https://halfelf.org/plugins/varnish-http-purge/
|
5 |
+
Description: Automatically empty cached pages when content on your site is modified.
|
6 |
+
Version: 4.5.1
|
7 |
Author: Mika Epstein
|
8 |
Author URI: https://halfelf.org/
|
9 |
License: http://www.apache.org/licenses/LICENSE-2.0
|
22 |
Varnish HTTP Purge is distributed in the hope that it will be useful,
|
23 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
24 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
25 |
*/
|
26 |
|
27 |
/**
|
120 |
// Add Admin Bar
|
121 |
add_action( 'admin_bar_menu', array( $this, 'varnish_rightnow_adminbar' ), 100 );
|
122 |
add_action( 'admin_enqueue_scripts', array( $this, 'custom_css' ) );
|
123 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'custom_css' ) );
|
124 |
}
|
125 |
|
126 |
/**
|
166 |
return $home_url;
|
167 |
}
|
168 |
|
|
|
169 |
/**
|
170 |
* Custom CSS to allow for coloring.
|
171 |
*
|
184 |
function varnish_rightnow_adminbar( $admin_bar ) {
|
185 |
global $wp;
|
186 |
|
187 |
+
if ( ( !is_admin() && get_post() !== false && current_user_can( 'edit_published_posts' ) ) || current_user_can( 'activate_plugins' ) ) {
|
188 |
+
// Main Array
|
189 |
+
$args = array(
|
190 |
+
array(
|
191 |
+
'id' => 'purge-varnish-cache',
|
192 |
+
'title' => '<span class="ab-icon"></span><span class="ab-label">' . __( 'Empty Cache', 'varnish-http-purge' ) . '</span>',
|
193 |
+
'meta' => array(
|
194 |
+
'class' => 'varnish-http-purge'
|
195 |
+
),
|
196 |
),
|
197 |
+
);
|
198 |
+
}
|
199 |
|
200 |
// Checking user permissions for who can and cannot use the all flush
|
201 |
if (
|
206 |
// Multisite - Site admins can purge UNLESS it's a subfolder install and we're on site #1
|
207 |
( is_multisite() && current_user_can( 'activate_plugins' ) && ( SUBDOMAIN_INSTALL || ( !SUBDOMAIN_INSTALL && ( BLOG_ID_CURRENT_SITE != $blog_id ) ) ) )
|
208 |
) {
|
209 |
+
|
210 |
$args[] = array(
|
211 |
'parent' => 'purge-varnish-cache',
|
212 |
'id' => 'purge-varnish-cache-all',
|
222 |
'parent' => 'purge-varnish-cache',
|
223 |
'id' => 'purge-varnish-cache-db',
|
224 |
'title' => __( 'Database Cache', 'varnish-http-purge' ),
|
225 |
+
'href' => wp_nonce_url( add_query_arg( 'vhp_flush_do', 'object' ), 'vhp-flush-do' ),
|
226 |
'meta' => array(
|
227 |
'title' => __( 'Database Cache', 'varnish-http-purge' ),
|
228 |
),
|
229 |
);
|
230 |
}
|
|
|
231 |
}
|
232 |
|
233 |
// If we're on a front end page and the current user can edit published posts, then they can do this:
|
260 |
$url = wp_nonce_url( add_query_arg( 'vhp_flush_do', 'all' ), 'vhp-flush-do' );
|
261 |
$intro = sprintf( __( '<a href="%1$s">Varnish HTTP Purge</a> automatically deletes your cached posts when published or updated. When making major site changes, such as with a new theme, plugins, or widgets, you may need to manually empty the cache.', 'varnish-http-purge' ), 'http://wordpress.org/plugins/varnish-http-purge/' );
|
262 |
$button = __( 'Press the button below to force it to empty your entire Varnish cache.', 'varnish-http-purge' );
|
263 |
+
$button .= '</p><p><span class="button"><span class="dashicons dashicons-carrot varnish-http-purge"></span> <a href="'.$url.'"><strong>';
|
264 |
$button .= __( 'Empty Cache', 'varnish-http-purge' );
|
265 |
$button .= '</strong></a></span>';
|
266 |
$nobutton = __( 'You do not have permission to empty the Varnish cache for the whole site. Please contact your administrator.', 'varnish-http-purge' );
|
337 |
public function executePurge() {
|
338 |
$purgeUrls = array_unique( $this->purgeUrls );
|
339 |
|
340 |
+
if ( empty( $purgeUrls ) && isset( $_GET ) ) {
|
341 |
+
if ( isset( $_GET['vhp_flush_all'] ) && check_admin_referer( 'vhp-flush-all' ) ) {
|
|
|
|
|
|
|
342 |
// Flush Varnish Cache recursize
|
343 |
$this->purgeUrl( $this->the_home_url() . '/?vhp-regex' );
|
344 |
} elseif ( isset( $_GET['vhp_flush_do'] ) && check_admin_referer( 'vhp-flush-do' ) ) {
|
345 |
+
if ( $_GET['vhp_flush_do'] == 'object' ) {
|
346 |
+
// Flush Object Cache (with a double check)
|
347 |
+
if ( file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) wp_cache_flush();
|
348 |
+
} elseif ( $_GET['vhp_flush_do'] == 'all' ) {
|
349 |
// Flush Varnish Cache recursize
|
350 |
$this->purgeUrl( $this->the_home_url() . '/?vhp-regex' );
|
351 |
} else {
|