Automattic\WooCommerce\Internal\ProductAttributesLookup

DataRegenerator::resume_regeneration()publicWC 1.0

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

Method of the class: DataRegenerator{}

No Hooks.

Return

null. Nothing (null).

Usage

$DataRegenerator = new DataRegenerator();
$DataRegenerator->resume_regeneration( $verify_nonce );
$verify_nonce(true|false) (required)
True to perform nonce verification (needed when running the tool from the tools page).

DataRegenerator::resume_regeneration() code WC 9.3.3

public function resume_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 resume 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 resume the product attribute lookup data regeneration process: regeneration is already in progress" );
	}
	if ( ! $this->data_store->regeneration_was_aborted() ) {
		throw new \Exception( "Can't resume the product attribute lookup data regeneration process: no aborted regeneration process exists" );
	}

	$this->data_store->unset_regeneration_aborted_flag();
	$this->data_store->set_regeneration_in_progress_flag();
	$this->enqueue_regeneration_step_run();
}