Version Description
- October 2018
- Documentation: Cleaning up language and spelling
Download this release
Release Info
Developer | Ipstenu |
Plugin | Varnish HTTP Purge |
Version | 4.7.1 |
Comparing to | |
See all releases |
Code changes from version 4.7.0 to 4.7.1
- debug.php +0 -11
- readme.txt +22 -20
- settings.php +3 -14
- uninstall.php +3 -3
- varnish-http-purge.php +7 -7
- wp-cli.php +17 -26
debug.php
CHANGED
@@ -3,17 +3,6 @@
|
|
3 |
* Debug Code
|
4 |
*
|
5 |
* @package varnish-http-purge
|
6 |
-
*
|
7 |
-
* Copyright 2016-2018 Mika Epstein (email: ipstenu@halfelf.org)
|
8 |
-
*
|
9 |
-
* This file is part of Varnish HTTP Purge, a plugin for WordPress.
|
10 |
-
*
|
11 |
-
* Varnish HTTP Purge is free software: you can redistribute it and/or modify
|
12 |
-
* it under the terms of the Apache License 2.0 license.
|
13 |
-
*
|
14 |
-
* Varnish HTTP Purge is distributed in the hope that it will be useful,
|
15 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
17 |
*/
|
18 |
|
19 |
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
* Debug Code
|
4 |
*
|
5 |
* @package varnish-http-purge
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
*/
|
7 |
|
8 |
if ( ! defined( 'ABSPATH' ) ) {
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: Ipstenu, mikeschroder, techpriester, danielbachhuber
|
|
3 |
Tags: proxy, purge, cache, varnish, nginx
|
4 |
Requires at least: 4.7
|
5 |
Tested up to: 4.9
|
6 |
-
Stable tag: 4.7.
|
7 |
Requires PHP: 5.6
|
8 |
|
9 |
Automatically empty proxy cached content when your site is modified.
|
@@ -20,7 +20,7 @@ The Proxy Cache Purge plugin sends a request to delete (aka flush) the cached da
|
|
20 |
|
21 |
= How It Works =
|
22 |
|
23 |
-
When content on a site is updated by WordPress, the plugin reaches out to the
|
24 |
|
25 |
Not all page are deleted from the cache on every change. For example, when a post, page, or custom post type is edited, or a new comment is added, <em>only</em> the following pages will purge:
|
26 |
|
@@ -44,14 +44,14 @@ On a multisite network using subfolders, only <strong>network admins</strong> ca
|
|
44 |
If you're working on a site and need to turn off caching in one of two ways:
|
45 |
|
46 |
1. Add `define( 'VHP_DEVMODE', true );` to your `wp-config.php` file
|
47 |
-
2. Go to
|
48 |
|
49 |
That will break cache on page loads. It is _not_ recommended for production!
|
50 |
|
51 |
= WP CLI =
|
52 |
|
53 |
* `wp varnish purge` - Flush the entire cache
|
54 |
-
* `wp varnish debug [<url>]` - Help for debugging how well
|
55 |
* `wp varnish devmode [<activate|deactivate|toggle>` - Change development mode state
|
56 |
|
57 |
= Privacy Policy =
|
@@ -64,7 +64,7 @@ Use of this service is required for the cache checking in order to provide up to
|
|
64 |
|
65 |
No special instructions apply.
|
66 |
|
67 |
-
If you have a 3rd party proxy service (such as Sucuri or Cloudflare) you will need to add
|
68 |
|
69 |
When using Nginx based proxies, your IP will likely be `localhost`.
|
70 |
|
@@ -95,11 +95,11 @@ If you don't see a button, then your account doesn't have the appropriate permis
|
|
95 |
|
96 |
= Will the plugin delete my cache when I edit files on the server? =
|
97 |
|
98 |
-
No. WordPress can't detect those file changes so it can't tell
|
99 |
|
100 |
-
= Does every WordPress plugin and theme work with
|
101 |
|
102 |
-
No. Some of them have behaviour that causes
|
103 |
|
104 |
= I'm a developer, can I tell your cache to empty in my plugin/theme? =
|
105 |
|
@@ -129,7 +129,7 @@ While development mode is on, your server will continue to cache content but the
|
|
129 |
|
130 |
= How can I tell if everything's caching? =
|
131 |
|
132 |
-
From your WordPress Dashboard, go to <em>
|
133 |
|
134 |
= Why is nothing caching when I use PageSpeed? =
|
135 |
|
@@ -139,27 +139,25 @@ If you're using nginx, it's `pagespeed ModifyCachingHeaders off;`
|
|
139 |
|
140 |
= Why aren't my changes showing when I use CloudFlare or another proxy? =
|
141 |
|
142 |
-
When you use CloudFlare or any other similar service, you've put a proxy in front of the
|
143 |
|
144 |
-
On single-site, you can edit this via the <em>
|
145 |
|
146 |
-
Replace
|
147 |
|
148 |
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`
|
149 |
|
150 |
= Why do I get a 503 or 504 error on every post update? =
|
151 |
|
152 |
-
Your
|
153 |
|
154 |
-
= How do I find
|
155 |
|
156 |
-
Your
|
157 |
|
158 |
-
|
159 |
|
160 |
-
|
161 |
-
<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 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. If you're on DreamPress' Nginx hosting, the ip is `localhost`.</li>
|
162 |
-
</ul>
|
163 |
|
164 |
= What if I have multiple varnish IPs? =
|
165 |
|
@@ -181,7 +179,7 @@ This is a question beyond the support of plugin. I do not have the resources ava
|
|
181 |
* Not all cache services set up PURGE by default
|
182 |
* When flushing the whole cache, the plugin sends a PURGE command of <code>/.*</code> and sets the `X-Purge-Method` header to `regex`.
|
183 |
|
184 |
-
= How can I see what the plugin is sending to
|
185 |
|
186 |
Yes _IF_ the service has an interface. Sadly Nginx doesn't. [Detailed directions can be found on the debugging section on GitHub](https://github.com/Ipstenu/varnish-http-purge/wiki#debugging). Bear in mind, these interfaces tend to be command-line only.
|
187 |
|
@@ -194,6 +192,10 @@ This plugin is installed by default for _all_ DreamPress installs on DreamHost,
|
|
194 |
|
195 |
== Changelog ==
|
196 |
|
|
|
|
|
|
|
|
|
197 |
= 4.7.0 =
|
198 |
* October 2018
|
199 |
* WP-CLI: documentation
|
3 |
Tags: proxy, purge, cache, varnish, nginx
|
4 |
Requires at least: 4.7
|
5 |
Tested up to: 4.9
|
6 |
+
Stable tag: 4.7.1
|
7 |
Requires PHP: 5.6
|
8 |
|
9 |
Automatically empty proxy cached content when your site is modified.
|
20 |
|
21 |
= How It Works =
|
22 |
|
23 |
+
When content on a site is updated by WordPress, the plugin reaches out to the proxy cache service with the URL of the page, requesting the cache be deleted.
|
24 |
|
25 |
Not all page are deleted from the cache on every change. For example, when a post, page, or custom post type is edited, or a new comment is added, <em>only</em> the following pages will purge:
|
26 |
|
44 |
If you're working on a site and need to turn off caching in one of two ways:
|
45 |
|
46 |
1. Add `define( 'VHP_DEVMODE', true );` to your `wp-config.php` file
|
47 |
+
2. Go to Proxy Cache -> Settings and enable debug mode for 24 hours at a time
|
48 |
|
49 |
That will break cache on page loads. It is _not_ recommended for production!
|
50 |
|
51 |
= WP CLI =
|
52 |
|
53 |
* `wp varnish purge` - Flush the entire cache
|
54 |
+
* `wp varnish debug [<url>]` - Help for debugging how well your cache is (or isn't) working
|
55 |
* `wp varnish devmode [<activate|deactivate|toggle>` - Change development mode state
|
56 |
|
57 |
= Privacy Policy =
|
64 |
|
65 |
No special instructions apply.
|
66 |
|
67 |
+
If you have a 3rd party proxy service (such as Sucuri or Cloudflare) you will need to add an IP address on the <em>Proxy Cache -> Settings</em> page. Alternatively you can add a define to your `wp-config.php` file: `define('VHP_VARNISH_IP','123.45.67.89');`
|
68 |
|
69 |
When using Nginx based proxies, your IP will likely be `localhost`.
|
70 |
|
95 |
|
96 |
= Will the plugin delete my cache when I edit files on the server? =
|
97 |
|
98 |
+
No. WordPress can't detect those file changes so it can't tell your cache what to do. You will need to use the Empty Cache buttons when you're done editing your code.
|
99 |
|
100 |
+
= Does every WordPress plugin and theme work with a proxy cache? =
|
101 |
|
102 |
+
No. Some of them have behaviour that causes them not to cache, either by accident or design.
|
103 |
|
104 |
= I'm a developer, can I tell your cache to empty in my plugin/theme? =
|
105 |
|
129 |
|
130 |
= How can I tell if everything's caching? =
|
131 |
|
132 |
+
From your WordPress Dashboard, go to <em>Proxy Cache > Check Caching</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.
|
133 |
|
134 |
= Why is nothing caching when I use PageSpeed? =
|
135 |
|
139 |
|
140 |
= Why aren't my changes showing when I use CloudFlare or another proxy? =
|
141 |
|
142 |
+
When you use CloudFlare or any other similar service, you've put a proxy in front of the server's 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.
|
143 |
|
144 |
+
On single-site, you can edit this via the <em>Proxy Cache > Check Caching</em> page. On Multisite, you'll need to add the following to your wp-config.php file: `define('VHP_VARNISH_IP','123.45.67.89');`
|
145 |
|
146 |
+
Replace `123.45.67.89` with the IP of your <em>Proxy Cache Server</em> (_not_ CloudFlare). **DO NOT** put http in this define. If you're on nginx, you'll want to use `localhost` instead of an IP address.
|
147 |
|
148 |
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`
|
149 |
|
150 |
= Why do I get a 503 or 504 error on every post update? =
|
151 |
|
152 |
+
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.
|
153 |
|
154 |
+
= How do I find the right IP address? =
|
155 |
|
156 |
+
Your proxy IP must be one of the IPs that the service 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.
|
157 |
|
158 |
+
For example, if you have a Varnish based cache and it's 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).
|
159 |
|
160 |
+
If your webhost set up your service, check their documentation.
|
|
|
|
|
161 |
|
162 |
= What if I have multiple varnish IPs? =
|
163 |
|
179 |
* Not all cache services set up PURGE by default
|
180 |
* When flushing the whole cache, the plugin sends a PURGE command of <code>/.*</code> and sets the `X-Purge-Method` header to `regex`.
|
181 |
|
182 |
+
= How can I see what the plugin is sending to the cache service? =
|
183 |
|
184 |
Yes _IF_ the service has an interface. Sadly Nginx doesn't. [Detailed directions can be found on the debugging section on GitHub](https://github.com/Ipstenu/varnish-http-purge/wiki#debugging). Bear in mind, these interfaces tend to be command-line only.
|
185 |
|
192 |
|
193 |
== Changelog ==
|
194 |
|
195 |
+
= 4.7.1 =
|
196 |
+
* October 2018
|
197 |
+
* Documentation: Cleaning up language and spelling
|
198 |
+
|
199 |
= 4.7.0 =
|
200 |
* October 2018
|
201 |
* WP-CLI: documentation
|
settings.php
CHANGED
@@ -4,17 +4,6 @@
|
|
4 |
* Settings Code
|
5 |
*
|
6 |
* @package varnish-http-purge
|
7 |
-
*
|
8 |
-
* Copyright 2016-2018 Mika Epstein (email: ipstenu@halfelf.org)
|
9 |
-
*
|
10 |
-
* This file is part of Varnish HTTP Purge, a plugin for WordPress.
|
11 |
-
*
|
12 |
-
* Varnish HTTP Purge is free software: you can redistribute it and/or modify
|
13 |
-
* it under the terms of the Apache License 2.0 license.
|
14 |
-
*
|
15 |
-
* Varnish HTTP Purge is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
18 |
*/
|
19 |
|
20 |
if ( ! defined( 'ABSPATH' ) ) {
|
@@ -411,9 +400,9 @@ class VarnishStatus {
|
|
411 |
?>
|
412 |
<div class="wrap">
|
413 |
<?php settings_errors(); ?>
|
414 |
-
<h1><?php esc_html_e( '
|
415 |
|
416 |
-
<p><?php esc_html_e( '
|
417 |
|
418 |
<?php
|
419 |
if ( ! is_multisite() ) {
|
@@ -499,7 +488,7 @@ class VarnishStatus {
|
|
499 |
)
|
500 |
),
|
501 |
$dream_url,
|
502 |
-
'<strong>
|
503 |
$review_url,
|
504 |
$review_url
|
505 |
);
|
4 |
* Settings Code
|
5 |
*
|
6 |
* @package varnish-http-purge
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
*/
|
8 |
|
9 |
if ( ! defined( 'ABSPATH' ) ) {
|
400 |
?>
|
401 |
<div class="wrap">
|
402 |
<?php settings_errors(); ?>
|
403 |
+
<h1><?php esc_html_e( 'Proxy Cache Purge Settings', 'varnish-http-purge' ); ?></h1>
|
404 |
|
405 |
+
<p><?php esc_html_e( 'Proxy Cache Purge can empty the cache for different server based caching systems, including Varnish and nginx. For most users, there should be no configuration necessary as the plugin is intended to work silently, behind the scenes.', 'varnish-http-purge' ); ?></p>
|
406 |
|
407 |
<?php
|
408 |
if ( ! is_multisite() ) {
|
488 |
)
|
489 |
),
|
490 |
$dream_url,
|
491 |
+
'<strong>Proxy Cache Purge</strong>',
|
492 |
$review_url,
|
493 |
$review_url
|
494 |
);
|
uninstall.php
CHANGED
@@ -6,12 +6,12 @@
|
|
6 |
*
|
7 |
* Copyright 2016-2018 Mika Epstein (email: ipstenu@halfelf.org)
|
8 |
*
|
9 |
-
* This file is part of
|
10 |
*
|
11 |
-
*
|
12 |
* it under the terms of the Apache License 2.0 license.
|
13 |
*
|
14 |
-
*
|
15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
17 |
*/
|
6 |
*
|
7 |
* Copyright 2016-2018 Mika Epstein (email: ipstenu@halfelf.org)
|
8 |
*
|
9 |
+
* This file is part of Proxy Cache Purge, a plugin for WordPress.
|
10 |
*
|
11 |
+
* Proxy Cache Purge is free software: you can redistribute it and/or modify
|
12 |
* it under the terms of the Apache License 2.0 license.
|
13 |
*
|
14 |
+
* Proxy Cache Purge is distributed in the hope that it will be useful,
|
15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
17 |
*/
|
varnish-http-purge.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Proxy Cache 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.7.
|
7 |
* Author: Mika Epstein
|
8 |
* Author URI: https://halfelf.org/
|
9 |
* License: http://www.apache.org/licenses/LICENSE-2.0
|
@@ -14,12 +14,12 @@
|
|
14 |
*
|
15 |
* Copyright 2016-2018 Mika Epstein (email: ipstenu@halfelf.org)
|
16 |
*
|
17 |
-
* This file is part of
|
18 |
*
|
19 |
-
*
|
20 |
* it under the terms of the Apache License 2.0 license.
|
21 |
*
|
22 |
-
*
|
23 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
24 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
25 |
*/
|
@@ -219,7 +219,7 @@ class VarnishPurger {
|
|
219 |
*/
|
220 |
public function require_pretty_permalinks_notice() {
|
221 |
// translators: The URL should link to the permalinks page.
|
222 |
-
echo wp_kses_post( '<div id="message" class="error"><p>' . sprintf( __( '
|
223 |
}
|
224 |
|
225 |
/**
|
@@ -230,7 +230,7 @@ class VarnishPurger {
|
|
230 |
*/
|
231 |
public function require_wp_version_notice() {
|
232 |
// translators: The URL should link to the update core page.
|
233 |
-
echo "<div id='message' class='error'><p>" . sprintf( esc_html__( '
|
234 |
}
|
235 |
|
236 |
/**
|
@@ -251,7 +251,7 @@ class VarnishPurger {
|
|
251 |
$message = sprintf( __( 'Proxy Cache Purge Development Mode is active for the next %1$s. You can disable this at the <a href="%2$s">Proxy Settings Page</a>.', 'varnish-http-purge' ), $time, esc_url( admin_url( 'admin.php?page=varnish-page' ) ) );
|
252 |
} else {
|
253 |
// translators: %1$s is the time until dev mode expires.
|
254 |
-
$message = sprintf( __( '
|
255 |
}
|
256 |
}
|
257 |
echo '<div class="notice notice-warning"><p>' . wp_kses_post( $message ) . '</p></div>';
|
3 |
* Plugin Name: Proxy Cache 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.7.1
|
7 |
* Author: Mika Epstein
|
8 |
* Author URI: https://halfelf.org/
|
9 |
* License: http://www.apache.org/licenses/LICENSE-2.0
|
14 |
*
|
15 |
* Copyright 2016-2018 Mika Epstein (email: ipstenu@halfelf.org)
|
16 |
*
|
17 |
+
* This file is part of Proxy Cache Purge, a plugin for WordPress.
|
18 |
*
|
19 |
+
* Proxy Cache Purge is free software: you can redistribute it and/or modify
|
20 |
* it under the terms of the Apache License 2.0 license.
|
21 |
*
|
22 |
+
* Proxy Cache 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 |
*/
|
219 |
*/
|
220 |
public function require_pretty_permalinks_notice() {
|
221 |
// translators: The URL should link to the permalinks page.
|
222 |
+
echo wp_kses_post( '<div id="message" class="error"><p>' . sprintf( __( 'Proxy Cache Purge requires you to use custom permalinks. Please go to the <a href="%1$s">Permalinks Options Page</a> to configure them.', 'varnish-http-purge' ), esc_url( admin_url( 'options-permalink.php' ) ) ) . '</p></div>' );
|
223 |
}
|
224 |
|
225 |
/**
|
230 |
*/
|
231 |
public function require_wp_version_notice() {
|
232 |
// translators: The URL should link to the update core page.
|
233 |
+
echo "<div id='message' class='error'><p>" . sprintf( esc_html__( 'Proxy Cache Purge requires WordPress 4.7 or greater. Please <a href="%1$s">upgrade WordPress</a>.', 'varnish-http-purge' ), esc_url( admin_url( 'update-core.php' ) ) ) . '</p></div>';
|
234 |
}
|
235 |
|
236 |
/**
|
251 |
$message = sprintf( __( 'Proxy Cache Purge Development Mode is active for the next %1$s. You can disable this at the <a href="%2$s">Proxy Settings Page</a>.', 'varnish-http-purge' ), $time, esc_url( admin_url( 'admin.php?page=varnish-page' ) ) );
|
252 |
} else {
|
253 |
// translators: %1$s is the time until dev mode expires.
|
254 |
+
$message = sprintf( __( 'Proxy Cache Purge Development Mode is active for the next %1$s.', 'varnish-http-purge' ), $time );
|
255 |
}
|
256 |
}
|
257 |
echo '<div class="notice notice-warning"><p>' . wp_kses_post( $message ) . '</p></div>';
|
wp-cli.php
CHANGED
@@ -1,19 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
|
4 |
-
|
5 |
-
@package varnish-http-purge
|
6 |
-
|
7 |
-
Copyright 2015-2018 Mika Epstein (email: ipstenu@halfelf.org)
|
8 |
-
|
9 |
-
This file is part of Varnish HTTP Purge, a plugin for WordPress.
|
10 |
-
|
11 |
-
Varnish HTTP Purge is free software: you can redistribute it and/or modify
|
12 |
-
it under the terms of the Apache License 2.0 license.
|
13 |
-
|
14 |
-
Varnish HTTP Purge is distributed in the hope that it will be useful,
|
15 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
17 |
*/
|
18 |
|
19 |
if ( ! defined( 'ABSPATH' ) ) {
|
@@ -57,16 +45,20 @@ if ( ! class_exists( 'WP_CLI_Varnish_Command' ) ) {
|
|
57 |
}
|
58 |
|
59 |
/**
|
60 |
-
* Forces
|
61 |
-
*
|
62 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
*
|
64 |
* ## EXAMPLES
|
65 |
*
|
66 |
* wp varnish purge
|
67 |
-
*
|
68 |
* wp varnish purge http://example.com/wp-content/themes/twentyeleventy/style.css
|
69 |
-
*
|
70 |
* wp varnish purge http://example.com/wp-content/themes/ --wildcard
|
71 |
*/
|
72 |
public function purge( $args, $assoc_args ) {
|
@@ -115,10 +107,10 @@ if ( ! class_exists( 'WP_CLI_Varnish_Command' ) ) {
|
|
115 |
if ( WP_DEBUG === true ) {
|
116 |
// translators: %1$s is the URL being flushed.
|
117 |
// translators: %2$s are the params being flushed.
|
118 |
-
WP_CLI::log( sprintf( __( '
|
119 |
}
|
120 |
|
121 |
-
WP_CLI::success( __( '
|
122 |
}
|
123 |
|
124 |
/**
|
@@ -151,23 +143,22 @@ if ( ! class_exists( 'WP_CLI_Varnish_Command' ) ) {
|
|
151 |
// No params, echo state.
|
152 |
$state = ( $devmode['active'] ) ? __( 'activated', 'varnish-http-purge' ) : __( 'deactivated', 'varnish-http-purge' );
|
153 |
// translators: %s is the state of dev mode.
|
154 |
-
WP_CLI::log( sprintf( __( '
|
155 |
} elseif ( ! in_array( $args[0], $valid_modes, true ) ) {
|
156 |
// Invalid Params, warn.
|
157 |
// translators: %s is the bad command.
|
158 |
-
WP_CLI::error( sprintf( __( '%s is not a valid subcommand for
|
159 |
} else {
|
160 |
// Run the toggle!
|
161 |
$result = VarnishDebug::devmode_toggle( sanitize_text_field( $args[0] ) );
|
162 |
$state = ( $result ) ? __( 'activated', 'varnish-http-purge' ) : __( 'deactivated', 'varnish-http-purge' );
|
163 |
// translators: %s is the state of dev mode.
|
164 |
-
WP_CLI::success( sprintf( __( '
|
165 |
}
|
166 |
} // End devmode.
|
167 |
|
168 |
/**
|
169 |
-
* Runs a debug check of the site to see if there are any known
|
170 |
-
* issues that would stop Varnish from caching.
|
171 |
*
|
172 |
* ## OPTIONS
|
173 |
*
|
1 |
<?php
|
2 |
/**
|
3 |
+
* WP-CLI code
|
4 |
+
* @package varnish-http-purge
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
*/
|
6 |
|
7 |
if ( ! defined( 'ABSPATH' ) ) {
|
45 |
}
|
46 |
|
47 |
/**
|
48 |
+
* Forces cache to purge.
|
49 |
+
*
|
50 |
+
* ## OPTIONS
|
51 |
+
*
|
52 |
+
* [<url>]
|
53 |
+
* : Specify a URL
|
54 |
+
*
|
55 |
+
* [--wildcard]
|
56 |
+
* : Include include all subfolders and files.
|
57 |
*
|
58 |
* ## EXAMPLES
|
59 |
*
|
60 |
* wp varnish purge
|
|
|
61 |
* wp varnish purge http://example.com/wp-content/themes/twentyeleventy/style.css
|
|
|
62 |
* wp varnish purge http://example.com/wp-content/themes/ --wildcard
|
63 |
*/
|
64 |
public function purge( $args, $assoc_args ) {
|
107 |
if ( WP_DEBUG === true ) {
|
108 |
// translators: %1$s is the URL being flushed.
|
109 |
// translators: %2$s are the params being flushed.
|
110 |
+
WP_CLI::log( sprintf( __( 'Proxy Cache Purge is flushing the URL %1$s with params %2$s.', 'varnish-http-purge' ), $url, $pregex ) );
|
111 |
}
|
112 |
|
113 |
+
WP_CLI::success( __( 'Proxy Cache Purge has flushed your cache.', 'varnish-http-purge' ) );
|
114 |
}
|
115 |
|
116 |
/**
|
143 |
// No params, echo state.
|
144 |
$state = ( $devmode['active'] ) ? __( 'activated', 'varnish-http-purge' ) : __( 'deactivated', 'varnish-http-purge' );
|
145 |
// translators: %s is the state of dev mode.
|
146 |
+
WP_CLI::log( sprintf( __( 'Proxy Cache Purge development mode is currently %s.', 'varnish-http-purge' ), $state ) );
|
147 |
} elseif ( ! in_array( $args[0], $valid_modes, true ) ) {
|
148 |
// Invalid Params, warn.
|
149 |
// translators: %s is the bad command.
|
150 |
+
WP_CLI::error( sprintf( __( '%s is not a valid subcommand for development mode.', 'varnish-http-purge' ), sanitize_text_field( $args[0] ) ) );
|
151 |
} else {
|
152 |
// Run the toggle!
|
153 |
$result = VarnishDebug::devmode_toggle( sanitize_text_field( $args[0] ) );
|
154 |
$state = ( $result ) ? __( 'activated', 'varnish-http-purge' ) : __( 'deactivated', 'varnish-http-purge' );
|
155 |
// translators: %s is the state of dev mode.
|
156 |
+
WP_CLI::success( sprintf( __( 'Proxy Cache Purge development mode has been %s.', 'varnish-http-purge' ), $state ) );
|
157 |
}
|
158 |
} // End devmode.
|
159 |
|
160 |
/**
|
161 |
+
* Runs a debug check of the site to see if there are any known issues.
|
|
|
162 |
*
|
163 |
* ## OPTIONS
|
164 |
*
|