Automattic\WooCommerce\Internal\ProductAttributesLookup
DataRegenerator::initialize_table_and_data
Create the lookup table and initialize the options that will be temporarily used while the regeneration is in progress.
Method of the class: DataRegenerator{}
No Hooks.
Returns
Int. Id of the last product id that will be processed.
Usage
// private - for code of main (parent) class only $result = $this->initialize_table_and_data(): int;
DataRegenerator::initialize_table_and_data() DataRegenerator::initialize table and data code WC 10.3.5
private function initialize_table_and_data(): int {
$database_util = wc_get_container()->get( DatabaseUtil::class );
$database_util->dbdelta( $this->get_table_creation_sql() );
$last_existing_product_id = $this->get_last_existing_product_id();
if ( ! $last_existing_product_id ) {
// No products exist, nothing to (re)generate.
return 0;
}
update_option( 'woocommerce_attribute_lookup_last_product_id_to_process', $last_existing_product_id );
update_option( 'woocommerce_attribute_lookup_processed_count', 0 );
return $last_existing_product_id;
}