Automattic\WooCommerce\Internal\ProductAttributesLookup
DataRegenerator::run_woocommerce_installed_callback
Run additional setup needed after a WooCommerce install or update finishes.
Method of the class: DataRegenerator{}
No Hooks.
Returns
null. Nothing (null).
Usage
$DataRegenerator = new DataRegenerator(); $DataRegenerator->run_woocommerce_installed_callback();
DataRegenerator::run_woocommerce_installed_callback() DataRegenerator::run woocommerce installed callback code WC 10.3.5
public function run_woocommerce_installed_callback() {
// The table must exist at this point (created via dbDelta), but we check just in case.
if ( ! $this->data_store->check_lookup_table_exists() ) {
return;
}
// If a table regeneration is in progress, leave it alone.
if ( $this->data_store->regeneration_is_in_progress() ) {
return;
}
// If the lookup table has data, or if it's empty because there are no products yet, we're good.
// Otherwise (lookup table is empty but products exist) we need to initiate a regeneration if one isn't already in progress.
if ( $this->data_store->lookup_table_has_data() || ! $this->get_last_existing_product_id() ) {
$must_enable = get_option( 'woocommerce_attribute_lookup_enabled' ) !== 'no';
$this->delete_all_attributes_lookup_data( false );
update_option( 'woocommerce_attribute_lookup_enabled', $must_enable ? 'yes' : 'no' );
} else {
$this->initiate_regeneration();
}
}