Automattic\WooCommerce\Internal\ProductAttributesLookup

DataRegenerator::abort_regeneration()publicWC 1.0

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

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

Хуков нет.

Возвращает

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

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

$DataRegenerator = new DataRegenerator();
$DataRegenerator->abort_regeneration( $verify_nonce );
$verify_nonce(true|false) (обязательный)
True to perform nonce verification (needed when running the tool from the tools page).

Код DataRegenerator::abort_regeneration() WC 9.3.3

public function abort_regeneration( bool $verify_nonce ) {
	if ( $verify_nonce ) {
		$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" );
	}

	$this->cancel_regeneration_scheduled_action();
	$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.
}