Automattic\WooCommerce\Internal\ProductAttributesLookup

CLIRunner::info_core()privateWC 1.0

Core method for the "info" command.

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

Хуков нет.

Возвращает

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

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

// private - только в коде основоного (родительского) класса
$result = $this->info_core( $args, $assoc_args );
$args(массив) (обязательный)
Positional arguments passed to the command.
$assoc_args(массив) (обязательный)
Associative arguments (options) passed to the command.

Код CLIRunner::info_core() WC 9.7.1

private function info_core( array $args, array $assoc_args ) {
	global $wpdb;

	$enabled = 'yes' === get_option( 'woocommerce_attribute_lookup_enabled' );

	$table_name = $this->lookup_data_store->get_lookup_table_name();
	$info       = $this->get_lookup_table_info();

	$this->log( "Table name: %W{$table_name}%n" );
	$this->log( 'Table usage is ' . ( $enabled ? '%Genabled%n' : '%Ydisabled%n' ) );
	$this->log( "The table contains %C{$info['total_rows']}%n rows corresponding to %G{$info['products_count']}%n products." );

	if ( $info['total_rows'] > 0 ) {
		// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
		$highest_product_id_in_table = $wpdb->get_var( 'select max(product_or_parent_id) from ' . $table_name );
		$this->log( "The highest product id in the table is %B{$highest_product_id_in_table}%n." );
	}

	if ( $this->lookup_data_store->regeneration_is_in_progress() ) {
		$max_product_id_to_process = get_option( 'woocommerce_attribute_lookup_last_product_id_to_process', '???' );
		WP_CLI::log( '' );
		$this->warning( 'Full regeneration of the table is currently %Gin progress.%n' );
		if ( ! $this->data_regenerator->has_scheduled_action_for_regeneration_step() ) {
			$this->log( 'However, there are %9NO%n actions scheduled to run the regeneration steps (a %9wp cli palt regenerate%n command was aborted?).' );
		}
		$this->log( "The last product id that will be processed is %Y{$max_product_id_to_process}%n." );
		$this->log( "\nRun %9wp cli palt abort_regeneration%n to abort the regeneration process," );
		$this->log( "then you'll be able to run %9wp cli palt resume_regeneration%n to resume the regeneration process," );
	} elseif ( $this->lookup_data_store->regeneration_was_aborted() ) {
		$max_product_id_to_process = get_option( 'woocommerce_attribute_lookup_last_product_id_to_process', '???' );
		WP_CLI::log( '' );
		$this->warning( "Full regeneration of the table has been %Raborted.%n\nThe last product id that will be processed is %Y{$max_product_id_to_process}%n." );
		$this->log( "\nRun %9wp cli palt resume_regeneration%n to resume the regeneration process." );
	}
}