Automattic\WooCommerce\Internal\ProductAttributesLookup
DataRegenerator::initiate_regeneration()
Initialize the regeneration procedure: deletes the lookup table and related options if they exist, then it creates the table and runs the first step of the regeneration process.
If $in_background is true, regeneration will continue in the background using scheduled actions. If $in_background is false, do_regeneration_step and finalize_regeneration must be invoked explicitly.
This method is intended to be used as a callback for a db update in wc-update-functions and in the CLI commands, regeneration triggered from the tools page will use initiate_regeneration_from_tools_page instead.
Метод класса: DataRegenerator{}
Хуков нет.
Возвращает
int
. Highest product id that will be processed.
Использование
$DataRegenerator = new DataRegenerator(); $DataRegenerator->initiate_regeneration( $in_background ): int;
- $in_background(true|false)
- True if regeneration will continue in the background using scheduled actions.
По умолчанию: true
Код DataRegenerator::initiate_regeneration() DataRegenerator::initiate regeneration WC 9.3.1
public function initiate_regeneration( bool $in_background = true ): int { $this->check_can_do_lookup_table_regeneration(); $this->enable_or_disable_lookup_table_usage( false ); $this->delete_all_attributes_lookup_data( true ); $last_product_id = $this->initialize_table_and_data(); if ( $last_product_id > 0 ) { $this->data_store->set_regeneration_in_progress_flag(); if ( $in_background ) { $this->enqueue_regeneration_step_run(); } } else { $this->finalize_regeneration( true ); } return $last_product_id; }