PluginProbe
Autoptimize / trunk
Autoptimize vtrunk
3.1.16 2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.5.0 2.5.1 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 All 108 releases
← All changes | classes/autoptimizeCLI.php +26 -14 2.3.1 → trunk View file →
@@ -1,22 +1,34 @@
1 1 <?php
2 -// Exit if accessed directly
2 +/**
3 + * WP-CLI commands for Autoptimize.
4 + */
5 +
3 6 if ( ! defined( 'ABSPATH' ) ) {
4 - exit;
7 + exit;
5 8 }
6 9
7 -class autoptimizeCLI extends WP_CLI_Command {
10 +// This is a WP-CLI command, so bail if it's not available.
11 +if ( ! defined( 'WP_CLI' ) ) {
12 + return;
13 +}
8 14
9 - /**
10 - * Clears the cache.
11 - *
12 - * @subcommand clear
13 - */
14 - public function clear( $args, $args_assoc ) {
15 - WP_CLI::line( esc_html__( 'Flushing the cache...', 'autoptimize' ) );
16 - autoptimizeCache::clearall();
17 - WP_CLI::success( esc_html__( 'Cache flushed.', 'autoptimize' ) );
18 - }
19 -
15 +class autoptimizeCLI extends \WP_CLI_Command
16 +{
17 + /**
18 + * Clears the cache.
19 + *
20 + * @subcommand clear
21 + *
22 + * @param array $args Args.
23 + * @param array $args_assoc Associative args.
24 + *
25 + * @return void
26 + */
27 + public function clear( $args, $args_assoc ) {
28 + WP_CLI::line( esc_html__( 'Flushing the cache...', 'autoptimize' ) );
29 + autoptimizeCache::clearall();
30 + WP_CLI::success( esc_html__( 'Cache flushed.', 'autoptimize' ) );
31 + }
20 32 }
21 33
22 34 WP_CLI::add_command( 'autoptimize', 'autoptimizeCLI' );