Automattic\WooCommerce\Database\Migrations\CustomOrderTable

CLIRunner::count_unmigrated()publicWC 1.0

Count how many orders have yet to be migrated into the custom orders table.

EXAMPLES

wp wc hpos count_unmigrated

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

Хуков нет.

Возвращает

int. The number of orders to be migrated.*

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

$CLIRunner = new CLIRunner();
$CLIRunner->count_unmigrated( $args, $assoc_args ): int;
$args(массив)
Positional arguments passed to the command.
По умолчанию: array()
$assoc_args(массив)
Associative arguments (options) passed to the command.
По умолчанию: array()

Код CLIRunner::count_unmigrated() WC 9.2.3

public function count_unmigrated( $args = array(), $assoc_args = array() ): int {
	// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
	$order_count = $this->synchronizer->get_current_orders_pending_sync_count();

	$assoc_args = wp_parse_args(
		$assoc_args,
		array(
			'log' => true,
		)
	);
	if ( isset( $assoc_args['log'] ) && $assoc_args['log'] ) {
		WP_CLI::log(
			sprintf(
				/* Translators: %1$d is the number of orders to be synced. */
				_n(
					'There is %1$d order to be synced.',
					'There are %1$d orders to be synced.',
					$order_count,
					'woocommerce'
				),
				$order_count
			)
		);
	}

	return (int) $order_count;
}