Action_Scheduler\WP_CLI
System_Command::status()
Get system status.
Method of the class: System_Command{}
No Hooks.
Return
null
. Nothing (null).
Usage
$System_Command = new System_Command(); $System_Command->status( $args, $assoc_args );
- $args(array) (required)
- Positional args.
- $assoc_args(array) (required)
- Keyed args.
System_Command::status() System Command::status code WC 9.8.2
public function status( array $args, array $assoc_args ) { /** * Get runner status. * * @link https://github.com/woocommerce/action-scheduler-disable-default-runner */ $runner_enabled = has_action( 'action_scheduler_run_queue', array( \ActionScheduler::runner(), 'run' ) ); \WP_CLI::line( sprintf( 'Data store: %s', $this->get_current_datastore() ) ); \WP_CLI::line( sprintf( 'Runner: %s%s', $this->get_current_runner(), ( $runner_enabled ? '' : ' (disabled)' ) ) ); \WP_CLI::line( sprintf( 'Version: %s', $this->get_latest_version() ) ); $rows = array(); $action_counts = $this->store->action_counts(); $oldest_and_newest = $this->get_oldest_and_newest( array_keys( $action_counts ) ); foreach ( $action_counts as $status => $count ) { $rows[] = array( 'status' => $status, 'count' => $count, 'oldest' => $oldest_and_newest[ $status ]['oldest'], 'newest' => $oldest_and_newest[ $status ]['newest'], ); } $formatter = new \WP_CLI\Formatter( $assoc_args, array( 'status', 'count', 'oldest', 'newest' ) ); $formatter->display_items( $rows ); }