Automattic\WooCommerce\Internal\ProductAttributesLookup

DataRegenerator::abort_regeneration_from_tools_page()privateWC 1.0

Callback to abort the regeneration process from the Status - Tools page.

{} Это метод класса: DataRegenerator{}

Хуков нет.

Возвращает

null. Ничего.

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

// private - только в коде основоного (родительского) класса
$result = $this->abort_regeneration_from_tools_page();

Код DataRegenerator::abort_regeneration_from_tools_page() WC 6.8.0

private function abort_regeneration_from_tools_page() {
	$this->verify_tool_execution_nonce();

	if ( ! $this->data_store->check_lookup_table_exists() ) {
		throw new \Exception( "Can't abort the product attribute lookup data regeneration process: lookup table doesn't exist" );
	}
	if ( ! $this->data_store->regeneration_is_in_progress() ) {
		throw new \Exception( "Can't abort the product attribute lookup data regeneration process since it's not currently in progress" );
	}

	$queue = WC()->get_instance_of( \WC_Queue::class );
	$queue->cancel_all( 'woocommerce_run_product_attribute_lookup_regeneration_callback' );
	$this->data_store->unset_regeneration_in_progress_flag();
	$this->data_store->set_regeneration_aborted_flag();
	$this->enable_or_disable_lookup_table_usage( false );

	// Note that we are NOT deleting the options that track the regeneration progress (processed count, last product id to process).
	// This is on purpose so that the regeneration can be resumed where it stopped.
}