ActionScheduler_WPCLI_QueueRunner::run()
Process actions in the queue.
Method of the class: ActionScheduler_WPCLI_QueueRunner{}
Hooks from the method
Return
Int
. The number of actions processed.
Usage
$ActionScheduler_WPCLI_QueueRunner = new ActionScheduler_WPCLI_QueueRunner(); $ActionScheduler_WPCLI_QueueRunner->run( $context );
- $context(string)
- Optional runner context.
Default: 'WP CLI'
ActionScheduler_WPCLI_QueueRunner::run() ActionScheduler WPCLI QueueRunner::run code WC 9.3.1
public function run( $context = 'WP CLI' ) { do_action( 'action_scheduler_before_process_queue' ); $this->setup_progress_bar(); foreach ( $this->actions as $action_id ) { // Error if we lost the claim. if ( ! in_array( $action_id, $this->store->find_actions_by_claim_id( $this->claim->get_id() ) ) ) { WP_CLI::warning( __( 'The claim has been lost. Aborting current batch.', 'woocommerce' ) ); break; } $this->process_action( $action_id, $context ); $this->progress_bar->tick(); } $completed = $this->progress_bar->current(); $this->progress_bar->finish(); $this->store->release_claim( $this->claim ); do_action( 'action_scheduler_after_process_queue' ); return $completed; }