Automattic\WooCommerce\Database\Migrations\CustomOrderTable

CLIRunner::register_commands()publicWC 1.0

Registers commands for CLI.

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

Хуков нет.

Возвращает

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

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

$CLIRunner = new CLIRunner();
$CLIRunner->register_commands();

Код CLIRunner::register_commands() WC 9.3.3

public function register_commands() {
	$legacy_commands = array( 'count_unmigrated', 'sync', 'verify_cot_data', 'enable', 'disable' );
	foreach ( $legacy_commands as $cmd ) {
		$new_cmd_name = 'verify_cot_data' === $cmd ? 'verify_data' : $cmd;

		WP_CLI::add_command( "wc hpos {$new_cmd_name}", array( $this, $cmd ) );
		WP_CLI::add_command(
			"wc cot {$cmd}",
			function ( array $args = array(), array $assoc_args = array() ) use ( $cmd, $new_cmd_name ) {
				WP_CLI::warning( "Command `wc cot {$cmd}` is deprecated since 8.9.0. Please use `wc hpos {$new_cmd_name}` instead." );
				return call_user_func( array( $this, $cmd ), $args, $assoc_args );
			}
		);
	}

	WP_CLI::add_command( 'wc hpos cleanup', array( $this, 'cleanup_post_data' ) );
	WP_CLI::add_command( 'wc hpos status', array( $this, 'status' ) );
	WP_CLI::add_command( 'wc hpos diff', array( $this, 'diff' ) );
	WP_CLI::add_command( 'wc hpos backfill', array( $this, 'backfill' ) );
	WP_CLI::add_command( 'wc hpos compatibility-info', array( $this, 'compatibility_info' ) );
	WP_CLI::add_command( 'wc hpos compatibility-mode enable', array( $this, 'enable_compat_mode' ) );
	WP_CLI::add_command( 'wc hpos compatibility-mode disable', array( $this, 'disable_compat_mode' ) );

	WP_CLI::add_command( 'wc cot migrate', array( $this, 'migrate' ) ); // Fully deprecated. No longer works.
}