Version Description
- JSON - fixed overzealous json assumptions from causing errors
- WP-CLI - fixed prepending of domain on domain when using purge on a domain (props @ocean90)
- Typos. We hate them.
Download this release
Release Info
Developer | Ipstenu |
Plugin | Varnish HTTP Purge |
Version | 4.1.1 |
Comparing to | |
See all releases |
Code changes from version 4.1 to 4.1.1
- readme.txt +7 -6
- varnish-http-purge.php +4 -2
- varnish-status.php +1 -1
- wp-cli.php +10 -3
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: Ipstenu, mikeschroder, techpriester
|
|
3 |
Tags: varnish, purge, cache
|
4 |
Requires at least: 4.7
|
5 |
Tested up to: 4.8
|
6 |
-
Stable tag: 4.1
|
7 |
|
8 |
Automatically empty a Varnish Cache when content on your site is modified.
|
9 |
|
@@ -31,11 +31,6 @@ And if you're into WP-CLI, you can use that too: `wp varnish purge`
|
|
31 |
|
32 |
Please note: On a multisite network using subfolders, only <strong>network admins</strong> can purge the main site. This is a security decision.
|
33 |
|
34 |
-
== Installation ==
|
35 |
-
No WordPress configuration needed.
|
36 |
-
|
37 |
-
When used on Multisite, the plugin is only able to be activated Network Wide.
|
38 |
-
|
39 |
= Requirements =
|
40 |
|
41 |
* Pretty Permalinks enabled
|
@@ -222,6 +217,12 @@ This plugin is installed by default for _all_ DreamPress installs on DreamHost,
|
|
222 |
|
223 |
== Changelog ==
|
224 |
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
= 4.1 =
|
226 |
|
227 |
* JSON / REST API Support
|
3 |
Tags: varnish, purge, cache
|
4 |
Requires at least: 4.7
|
5 |
Tested up to: 4.8
|
6 |
+
Stable tag: 4.1.1
|
7 |
|
8 |
Automatically empty a Varnish Cache when content on your site is modified.
|
9 |
|
31 |
|
32 |
Please note: On a multisite network using subfolders, only <strong>network admins</strong> can purge the main site. This is a security decision.
|
33 |
|
|
|
|
|
|
|
|
|
|
|
34 |
= Requirements =
|
35 |
|
36 |
* Pretty Permalinks enabled
|
217 |
|
218 |
== Changelog ==
|
219 |
|
220 |
+
= 4.1.1 =
|
221 |
+
|
222 |
+
* JSON - fixed overzealous json assumptions from causing errors
|
223 |
+
* WP-CLI - fixed prepending of domain on domain when using purge on a domain (props @ocean90)
|
224 |
+
* Typos. We hate them.
|
225 |
+
|
226 |
= 4.1 =
|
227 |
|
228 |
* JSON / REST API Support
|
varnish-http-purge.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Varnish HTTP Purge
|
4 |
Plugin URI: https://halfelf.org/plugins/varnish-http-purge/
|
5 |
Description: Automatically empty pages cached by Varnish when content on your site is modified.
|
6 |
-
Version: 4.1
|
7 |
Author: Mika Epstein
|
8 |
Author URI: https://halfelf.org/
|
9 |
License: http://www.apache.org/licenses/LICENSE-2.0
|
@@ -412,6 +412,7 @@ class VarnishPurger {
|
|
412 |
// We only want to do this if the rest_base exists
|
413 |
// But we apparently have to force it for posts and pages (seriously?)
|
414 |
$post_type_object = get_post_type_object( $postId );
|
|
|
415 |
if ( isset( $post_type_object->rest_base ) ) {
|
416 |
$rest_permalink = get_rest_url() . $rest_api_route . '/' . $post_type_object->rest_base . '/' . $postId . '/';
|
417 |
} elseif ( $this_post_type == 'post' ) {
|
@@ -419,7 +420,8 @@ class VarnishPurger {
|
|
419 |
} elseif ( $this_post_type == 'page' ) {
|
420 |
$rest_permalink = get_rest_url() . $rest_api_route . '/pages/' . $postId . '/';
|
421 |
}
|
422 |
-
|
|
|
423 |
|
424 |
// Add in AMP permalink if Automattic's AMP is installed
|
425 |
if ( function_exists( 'amp_get_permalink' ) ) {
|
3 |
Plugin Name: Varnish HTTP Purge
|
4 |
Plugin URI: https://halfelf.org/plugins/varnish-http-purge/
|
5 |
Description: Automatically empty pages cached by Varnish when content on your site is modified.
|
6 |
+
Version: 4.1.1
|
7 |
Author: Mika Epstein
|
8 |
Author URI: https://halfelf.org/
|
9 |
License: http://www.apache.org/licenses/LICENSE-2.0
|
412 |
// We only want to do this if the rest_base exists
|
413 |
// But we apparently have to force it for posts and pages (seriously?)
|
414 |
$post_type_object = get_post_type_object( $postId );
|
415 |
+
$rest_permalink = false;
|
416 |
if ( isset( $post_type_object->rest_base ) ) {
|
417 |
$rest_permalink = get_rest_url() . $rest_api_route . '/' . $post_type_object->rest_base . '/' . $postId . '/';
|
418 |
} elseif ( $this_post_type == 'post' ) {
|
420 |
} elseif ( $this_post_type == 'page' ) {
|
421 |
$rest_permalink = get_rest_url() . $rest_api_route . '/pages/' . $postId . '/';
|
422 |
}
|
423 |
+
|
424 |
+
if ( $rest_permalink !== false ) array_push( $listofurls, $rest_permalink );
|
425 |
|
426 |
// Add in AMP permalink if Automattic's AMP is installed
|
427 |
if ( function_exists( 'amp_get_permalink' ) ) {
|
varnish-status.php
CHANGED
@@ -232,7 +232,7 @@ class VarnishStatus {
|
|
232 |
} else {
|
233 |
?>
|
234 |
<td width="40px"><?php echo $icon_good; ?></td>
|
235 |
-
<td><?php printf( __( 'Your
|
236 |
<?php
|
237 |
}
|
238 |
?></tr><?php
|
232 |
} else {
|
233 |
?>
|
234 |
<td width="40px"><?php echo $icon_good; ?></td>
|
235 |
+
<td><?php printf( __( 'Your server IP setup looks good. If you are using a proxy (like Sucuri or Cloudflare or Fastly) please double check that configuration and make sure to add a <a href="%s">custom Varnish IP</a> if necessary.', 'varnish-http-purge' ), '#configure' ); ?></td>
|
236 |
<?php
|
237 |
}
|
238 |
?></tr><?php
|
wp-cli.php
CHANGED
@@ -66,9 +66,12 @@ class WP_CLI_Varnish_Purge_Command extends WP_CLI_Command {
|
|
66 |
|
67 |
wp_create_nonce('vhp-flush-cli');
|
68 |
|
69 |
-
//
|
70 |
-
if ( !empty($url) ) {
|
71 |
-
$url =
|
|
|
|
|
|
|
72 |
} else {
|
73 |
$url = $this->varnish_purge->the_home_url();
|
74 |
}
|
@@ -82,6 +85,10 @@ class WP_CLI_Varnish_Purge_Command extends WP_CLI_Command {
|
|
82 |
}
|
83 |
|
84 |
$this->varnish_purge->purgeUrl( $url.$pregex );
|
|
|
|
|
|
|
|
|
85 |
|
86 |
WP_CLI::success( 'The Varnish cache was purged.' );
|
87 |
}
|
66 |
|
67 |
wp_create_nonce('vhp-flush-cli');
|
68 |
|
69 |
+
// If the URL is not empty, sanitize. Else use home URL.
|
70 |
+
if ( !empty( $url ) ) {
|
71 |
+
$url = esc_url( $url );
|
72 |
+
|
73 |
+
// If it's a regex, let's make sure we don't have //
|
74 |
+
if ( isset( $assoc_args['wildcard'] ) ) $url = rtrim( $url, '/' );
|
75 |
} else {
|
76 |
$url = $this->varnish_purge->the_home_url();
|
77 |
}
|
85 |
}
|
86 |
|
87 |
$this->varnish_purge->purgeUrl( $url.$pregex );
|
88 |
+
|
89 |
+
if ( WP_DEBUG == true ) {
|
90 |
+
WP_CLI::log( sprintf( 'Flushing URL: %s with params: %s.', $url, $pregex ) );
|
91 |
+
}
|
92 |
|
93 |
WP_CLI::success( 'The Varnish cache was purged.' );
|
94 |
}
|