added use SSL on purge requests option
[varnish-caching-wordpress-plugin.git] / wp-cli.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
 
if (!defined('ABSPATH')) {
    die();
}
 
if (!defined('WP_CLI')) return;
 
/**
 * Purges Varnish Cache
 */
class WP_CLI_VarnishCaching_Purge_Command extends WP_CLI_Command {
 
    public function __construct() {
        $this->varnish_caching = new VarnishCaching();
    }
 
    /**
     * Forces a Varnish Purge
     *
     * ## EXAMPLES
     *
     *     wp varnish purge
     *
     */
    public function purge() {
        wp_create_nonce('varnish-http-purge-cli');
        $this->varnish_caching->purgeUrl(home_url() .'/?vc-regex');
        WP_CLI::success('The Varnish cache was purged.');
    }
 
}
 
WP_CLI::add_command('varnish', 'WP_CLI_VarnishCaching_Purge_Command');
 
comments