Commit dfdfd924 authored by Erick Hitter's avatar Erick Hitter Committed by GitHub
Browse files

Merge pull request #34 from Automattic/add/cli-for-cpt

Introduce command to flush plugin's cache
parents 462e1c50 7e005f30
......@@ -30,4 +30,5 @@ function stop_the_insanity() {
/**
* Load commands
*/
require __DIR__ . '/wp-cli/class-data.php';
require __DIR__ . '/wp-cli/class-one-time-fixers.php';
<?php
namespace Automattic\WP\Cron_Control\CLI;
/**
* Manage Cron Control's data, including internal caches
*/
class Data extends \WP_CLI_Command {
/**
* Flush Cron Control's internal caches
*
* eg.: `wp --allow-root cron-control-data flush-cache`
*
* @subcommand flush-cache
*/
public function flush_internal_cache( $args, $assoc_args ) {
$flushed = wp_cache_delete( \Automattic\WP\Cron_Control\Cron_Options_CPT::CACHE_KEY );
if ( $flushed ) {
\WP_CLI::success( __( 'Internal caches cleared', 'automattic-cron-control' ) );
} else {
\WP_CLI::warning( __( 'No caches to clear', 'automattic-cron-control' ) );
}
}
}
\WP_CLI::add_command( 'cron-control-data', 'Automattic\WP\Cron_Control\CLI\Data' );
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment