Automattic\WooCommerce\Internal\ProductAttributesLookup
CLIRunner::initiate_regeneration_core
Core method for the "initiate_regeneration" command.
Method of the class: CLIRunner{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->initiate_regeneration_core( $args, $assoc_args );
- $args(array) (required)
- Positional arguments passed to the command.
- $assoc_args(array) (required)
- Associative arguments (options) passed to the command.
CLIRunner::initiate_regeneration_core() CLIRunner::initiate regeneration core code WC 10.3.3
private function initiate_regeneration_core( array $args, array $assoc_args ) {
$this->data_regenerator->check_can_do_lookup_table_regeneration();
$info = $this->get_lookup_table_info();
if ( $info['total_rows'] > 0 && ! array_key_exists( 'force', $assoc_args ) ) {
$table_name = $this->lookup_data_store->get_lookup_table_name();
$this->warning( "The %W{$table_name}%n table contains %C{$info['total_rows']}%n rows corresponding to %G{$info['products_count']}%n products." );
WP_CLI::confirm( 'Initiating the regeneration will first delete the data. Are you sure?' );
}
$this->data_regenerator->initiate_regeneration();
$table_name = $this->lookup_data_store->get_lookup_table_name();
$this->log( "%GSuccess:%n The regeneration of the data in the %W{$table_name}%n table has been initiated." );
}