ActionScheduler_WPCLI_QueueRunner::run()publicWC 1.0

Process actions in the queue.

Метод класса: ActionScheduler_WPCLI_QueueRunner{}

Возвращает

int. The number of actions processed.

Использование

$ActionScheduler_WPCLI_QueueRunner = new ActionScheduler_WPCLI_QueueRunner();
$ActionScheduler_WPCLI_QueueRunner->run( $context );
$context(строка)
Optional runner context.
По умолчанию: 'WP CLI'

Код ActionScheduler_WPCLI_QueueRunner::run() WC 8.7.0

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;
}