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_VCaching_Purge_Command extends WP_CLI_Command {
 
    public function __construct() {
        $this->vcaching = new VCaching();
    }
 
    /**
     * Forces a Varnish Purge
     *
     * ## EXAMPLES
     *
     *     wp vcaching purge
     *
     */
    public function purge() {
        wp_create_nonce('vcaching-purge-cli');
        $this->vcaching->purgeUrl(home_url() .'/?vc-regex');
        WP_CLI::success('ALL Varnish cache was purged.');
    }
 
}
 
WP_CLI::add_command('vcaching', 'WP_CLI_VCaching_Purge_Command');
 
comments