Automattic\WooCommerce\Internal\ProductAttributesLookup

DataRegenerator::check_can_do_lookup_table_regeneration()privateWC 1.0

Check if everything is good to go to perform a complete or per product lookup table data regeneration and throw an exception if not.

Method of the class: DataRegenerator{}

No Hooks.

Return

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->check_can_do_lookup_table_regeneration( $product_id );
$product_id(mixed)
The product id to check the regeneration viability for, or null to check if a complete regeneration is possible.
Default: null

DataRegenerator::check_can_do_lookup_table_regeneration() code WC 8.6.1

private function check_can_do_lookup_table_regeneration( $product_id = null ) {
	if ( $product_id && ! $this->data_store->check_lookup_table_exists() ) {
		throw new \Exception( "Can't do product attribute lookup data regeneration: lookup table doesn't exist" );
	}
	if ( $this->data_store->regeneration_is_in_progress() ) {
		throw new \Exception( "Can't do product attribute lookup data regeneration: regeneration is already in progress" );
	}
	if ( $product_id && ! wc_get_product( $product_id ) ) {
		throw new \Exception( "Can't do product attribute lookup data regeneration: product doesn't exist" );
	}
}