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.

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

Хуков нет.

Возвращает

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

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

// private - только в коде основоного (родительского) класса
$result = $this->check_can_do_lookup_table_regeneration( $product_id );
$product_id(разное)
The product id to check the regeneration viability for, or null to check if a complete regeneration is possible.
По умолчанию: null

Код DataRegenerator::check_can_do_lookup_table_regeneration() WC 8.7.0

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" );
	}
}