Skip to content

Commit 2a62612

Browse files
committed
Rename class aqnd move command addition to main command file
1 parent f143a85 commit 2a62612

File tree

2 files changed

+18
-22
lines changed

2 files changed

+18
-22
lines changed
Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* Manages the WP Super Cache plugin
55
*/
6-
class WPSuperCache_Command extends WP_CLI_Command {
6+
class WP_Super_Cache_Command extends WP_CLI_Command {
77

88
/**
99
* Clear something from the cache.
@@ -167,13 +167,3 @@ protected function preload_status( $preload_counter, $pending_cancel ) {
167167
}
168168
}
169169
}
170-
171-
WP_CLI::add_command(
172-
'super-cache', 'WPSuperCache_Command', array(
173-
'before_invoke' => function() {
174-
if ( ! function_exists( 'wp_super_cache_enable' ) ) {
175-
WP_CLI::error( 'WP Super Cache needs to be enabled to use its WP-CLI commands.' );
176-
}
177-
},
178-
)
179-
);

wp-super-cache-cli.php

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
<?php
2-
/*
3-
Plugin Name: WP Super Cache CLI
4-
Version: 1.0
5-
Description: A CLI interface for the WP Super Cache plugin
6-
Author: WP-CLI Team
7-
Author URI: http://github.com/wp-cli
8-
Plugin URI: http://github.com/wp-cli/wp-super-cache-cli
9-
License: MIT
10-
*/
11-
12-
$autoload = __DIR__ . '/vendor/autoload.php';
2+
3+
$autoload = dirname( __FILE__ ) . '/vendor/autoload.php';
4+
135
if ( file_exists( $autoload ) ) {
146
require_once $autoload;
157
}
8+
9+
if ( ! class_exists( 'WP_CLI' ) ) {
10+
return;
11+
}
12+
13+
WP_CLI::add_command(
14+
'super-cache', 'WP_Super_Cache_Command', array(
15+
'before_invoke' => function() {
16+
if ( ! function_exists( 'wp_super_cache_enable' ) ) {
17+
WP_CLI::error( 'WP Super Cache needs to be enabled to use its WP-CLI commands.' );
18+
}
19+
},
20+
)
21+
);

0 commit comments

Comments
 (0)