Automattic\WooCommerce\Database\Migrations\CustomOrderTable

CLIRunner::status()publicWC 8.6.0

Displays a summary of HPOS situation on this site.

Method of the class: CLIRunner{}

No Hooks.

Return

null. Nothing (null).

Usage

$CLIRunner = new CLIRunner();
$CLIRunner->status( $args, $assoc_args );
$args(array)
Positional arguments passed to the command.
Default: array()
$assoc_args(array)
Associative arguments (options) passed to the command.
Default: array()

Changelog

Since 8.6.0 Introduced.

CLIRunner::status() code WC 9.7.1

public function status( array $args = array(), array $assoc_args = array() ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed -- for backwards compat.
	$legacy_handler = wc_get_container()->get( LegacyDataHandler::class );

	// translators: %s is either 'yes' or 'no'.
	WP_CLI::log( sprintf( __( 'HPOS enabled?: %s', 'woocommerce' ), wc_bool_to_string( $this->controller->custom_orders_table_usage_is_enabled() ) ) );

	// translators: %s is either 'yes' or 'no'.
	WP_CLI::log( sprintf( __( 'Compatibility mode enabled?: %s', 'woocommerce' ), wc_bool_to_string( $this->synchronizer->data_sync_is_enabled() ) ) );

	// translators: %d is an order count.
	WP_CLI::log( sprintf( __( 'Unsynced orders: %d', 'woocommerce' ), $this->synchronizer->get_current_orders_pending_sync_count() ) );

	WP_CLI::log(
		sprintf(
			/* translators: %d is an order count. */
			__( 'Orders subject to cleanup: %d', 'woocommerce' ),
			( $this->synchronizer->custom_orders_table_is_authoritative() && ! $this->synchronizer->data_sync_is_enabled() )
			? $legacy_handler->count_orders_for_cleanup()
			: 0
		)
	);
}