Automattic\WooCommerce\Internal\ProductAttributesLookup
DataRegenerator::check_can_do_lookup_table_regeneration
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.
Returns
null. Nothing (null).
Usage
$DataRegenerator = new DataRegenerator(); $DataRegenerator->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() DataRegenerator::check can do lookup table regeneration code WC 10.8.1
public 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" );
}
}