Automattic\WooCommerce\DataBase\Migrations\CustomOrderTable

CLIRunner::get_verify_order_count()privateWC 1.0

Helper method to get count for orders needing verification.

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

Хуков нет.

Возвращает

int. Order count.

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

// private - только в коде основоного (родительского) класса
$result = $this->get_verify_order_count( $order_id_start, $log ) : int;
$order_id_start(int) (обязательный)
Order ID to start from.
$log(true|false)
Whether to also log an error message.
По умолчанию: true

Код CLIRunner::get_verify_order_count() WC 7.5.1

private function get_verify_order_count( int $order_id_start, $log = true ) : int {
	global $wpdb;

	$order_count = (int) $wpdb->get_var(
		$wpdb->prepare(
			"SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'shop_order' AND ID > %d",
			$order_id_start
		)
	);

	if ( $log ) {
		WP_CLI::log(
			sprintf(
				/* Translators: %1$d is the number of orders to be verified. */
				_n(
					'There is %1$d order to be verified.',
					'There are %1$d orders to be verified.',
					$order_count,
					'woocommerce'
				),
				$order_count
			)
		);
	}

	return $order_count;
}