Automattic\WooCommerce\Internal\ProductAttributesLookup

DataRegenerator::initialize_table_and_data()privateWC 1.0

Create the lookup table and initialize the options that will be temporarily used while the regeneration is in progress.

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

No Hooks.

Return

true|false. True if there's any product at all in the database, false otherwise.

Usage

// private - for code of main (parent) class only
$result = $this->initialize_table_and_data();

Код DataRegenerator::initialize_table_and_data() WC 7.1.0

private function initialize_table_and_data() {
	global $wpdb;

	// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
	$wpdb->query( $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 false;
	}

	$this->data_store->set_regeneration_in_progress_flag();
	update_option( 'woocommerce_attribute_lookup_last_product_id_to_process', $last_existing_product_id );
	update_option( 'woocommerce_attribute_lookup_processed_count', 0 );

	return true;
}