Skip to content

Commit dedbaa8

Browse files
committed
Improves command status
1 parent 88ce2e6 commit dedbaa8

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/WP_Super_Cache_Command.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,27 @@ public function flush( $args = array(), $assoc_args = array() ) {
7171
* @when after_wp_load
7272
*/
7373
public function status( $args = array(), $assoc_args = array() ) {
74-
global $super_cache_enabled;
74+
global $cache_enabled, $super_cache_enabled, $wp_cache_mod_rewrite;
7575

7676
$this->load();
77-
$cache_stats = get_option( 'supercache_stats' );
7877

78+
WP_CLI::line( 'Version of WP Super Cache: ' . $this->wpsc_version );
79+
WP_CLI::line();
80+
81+
$cache_method = 'WP-Cache';
82+
if ( $cache_enabled && $super_cache_enabled ) {
83+
$cache_method = $wp_cache_mod_rewrite ? 'Expert' : 'Simple';
84+
}
85+
86+
$cache_status = 'Cache status: ' . WP_CLI::colorize( $cache_enabled ? '%gOn%n' : '%rOff%n' ) . PHP_EOL;
87+
$cache_status .= $cache_enabled
88+
? 'Cache Delivery Method: ' . $cache_method . PHP_EOL
89+
: '';
90+
WP_CLI::line( $cache_status );
91+
92+
$cache_stats = get_option( 'supercache_stats' );
7993
if ( ! empty( $cache_stats ) ) {
8094
if ( $cache_stats['generated'] > time() - 3600 * 24 ) {
81-
WP_CLI::line( 'Cache status: ' . ( $super_cache_enabled ? '%gOn%n' : '%rOff%n' ) );
8295
WP_CLI::line( 'Cache content on ' . date( 'r', $cache_stats['generated'] ) . ': ' );
8396
WP_CLI::line();
8497
WP_CLI::line( ' WordPress cache:' );

0 commit comments

Comments
 (0)