Commit d4921c5e authored by Erick Hitter's avatar Erick Hitter
Browse files

Provide command to remove completed events

parent 27d4ad7c
......@@ -71,10 +71,10 @@ class Events extends \WP_CLI_Command {
}
/**
* Remove events by ID or action
* Remove events
*
* @subcommand delete
* @synopsis [--event_id=<event_id>] [--action=<action>]
* @synopsis [--event_id=<event_id>] [--action=<action>] [--completed]
*/
public function delete_events( $args, $assoc_args ) {
// Remove a specific event
......@@ -89,6 +89,14 @@ class Events extends \WP_CLI_Command {
return;
}
// Remove all completed events
if ( isset( $assoc_args['completed'] ) ) {
\WP_CLI::confirm( sprintf( __( 'Remove all completed events?', 'automattic-cron-control' ) ) );
\Automattic\WP\Cron_Control\Events_Store::instance()->purge_completed_events();
\WP_CLI::success( __( 'Entries removed', 'automattic-cron-control' ) );
return;
}
\WP_CLI::error( __( 'Specify something to delete, or see the `cron-control-fixers` command to remove all data.', 'automattic-cron-control' ) );
}
......
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