Action_Scheduler\WP_CLI\Action

Run_Command::executepublicWC 1.0

Execute.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

$Run_Command = new Run_Command();
$Run_Command->execute();

Код Run_Command::execute() WC 10.0.2

public function execute() {
	$runner = \ActionScheduler::runner();

	$progress_bar = \WP_CLI\Utils\make_progress_bar(
		sprintf(
			/* translators: %d: number of actions */
			_n( 'Executing %d action', 'Executing %d actions', $this->action_counts['total'], 'woocommerce' ),
			number_format_i18n( $this->action_counts['total'] )
		),
		$this->action_counts['total']
	);

	foreach ( $this->action_ids as $action_id ) {
		$runner->process_action( $action_id, 'Action Scheduler CLI' );
		$progress_bar->tick();
	}

	$progress_bar->finish();

	foreach ( array(
		'ignored',
		'invalid',
		'failed',
	) as $type ) {
		$count = $this->action_counts[ $type ];

		if ( empty( $count ) ) {
			continue;
		}

		/*
		 * translators:
		 * %1$d: count of actions evaluated.
		 * %2$s: type of action evaluated.
		 */
		$format = _n( '%1$d action %2$s.', '%1$d actions %2$s.', $count, 'woocommerce' );

		\WP_CLI::warning(
			sprintf(
				$format,
				number_format_i18n( $count ),
				$type
			)
		);
	}

	\WP_CLI::success(
		sprintf(
			/* translators: %d: number of executed actions */
			_n( 'Executed %d action.', 'Executed %d actions.', $this->action_counts['executed'], 'woocommerce' ),
			number_format_i18n( $this->action_counts['executed'] )
		)
	);
}