Automattic\WooCommerce\Internal\ProductAttributesLookup
DataRegenerator::initiate_regeneration_from_tools_page
Callback to initiate the regeneration process when the tool is run.
Runs both from the Tools admin page and from the REST API. Authorization is enforced by the caller (nonce for the admin page, capability check for the REST endpoint).
Метод класса: DataRegenerator{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->initiate_regeneration_from_tools_page();
Код DataRegenerator::initiate_regeneration_from_tools_page() DataRegenerator::initiate regeneration from tools page WC 11.2.2
private function initiate_regeneration_from_tools_page() {
//phpcs:disable WordPress.Security.NonceVerification.Recommended
if ( isset( $_REQUEST['regenerate_product_attribute_lookup_data_product_id'] ) ) {
$product_id = (int) $_REQUEST['regenerate_product_attribute_lookup_data_product_id'];
$this->check_can_do_lookup_table_regeneration( $product_id );
$this->data_store->create_data_for_product( $product_id, $this->data_store->optimized_data_access_is_enabled() );
} else {
$this->initiate_regeneration();
}
//phpcs:enable WordPress.Security.NonceVerification.Recommended
}