Automattic\WooCommerce\Internal\ProductAttributesLookup
CLIRunner::regenerate_for_product_core
Core method for the "regenerate_for_product" command.
Метод класса: CLIRunner{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->regenerate_for_product_core( $args, $assoc_args );
- $args(массив)
- Positional arguments passed to the command.
По умолчанию:array() - $assoc_args(массив)
- Associative arguments (options) passed to the command.
По умолчанию:array()
Код CLIRunner::regenerate_for_product_core() CLIRunner::regenerate for product core WC 10.6.2
private function regenerate_for_product_core( array $args = array(), array $assoc_args = array() ) {
$product_id = current( $args );
$this->data_regenerator->check_can_do_lookup_table_regeneration( $product_id );
$use_db_optimization = ! array_key_exists( 'disable-db-optimization', $assoc_args );
$this->check_can_use_db_optimization( $use_db_optimization );
$start_time = microtime( true );
$this->lookup_data_store->create_data_for_product( $product_id, $use_db_optimization );
if ( $this->lookup_data_store->get_last_create_operation_failed() ) {
$this->error( "Lookup data regeneration failed.\nSee the WooCommerce logs (source is %9palt-updates%n) for details." );
} else {
$total_time = microtime( true ) - $start_time;
WP_CLI::success( sprintf( 'Attributes lookup data for product %d regenerated in %f seconds.', $product_id, $total_time ) );
}
}