Automattic\WooCommerce\Internal\DataStores\Orders

CustomOrdersTableController::add_initiate_regeneration_entry_to_tools_array()publicWC 1.0

Method of the class: CustomOrdersTableController{}

No Hooks.

Return

null. Nothing (null).

Usage

$CustomOrdersTableController = new CustomOrdersTableController();
$CustomOrdersTableController->;

CustomOrdersTableController::add_initiate_regeneration_entry_to_tools_array() code WC 8.7.0

}

/**
 * Add an entry to Status - Tools to create or regenerate the custom orders table,
 * and also an entry to delete the table as appropriate.
 *
 * @param array $tools_array The array of tools to add the tool to.
 * @return array The updated array of tools-
 */
private function add_hpos_tools( array $tools_array ): array {
	if ( ! $this->data_synchronizer->check_orders_table_exists() ) {
		return $tools_array;
	}

	// Cleanup tool.
	$tools_array = array_merge( $tools_array, $this->data_cleanup->get_tools_entries() );

	// Delete HPOS tables tool.
	if ( $this->custom_orders_table_usage_is_enabled() || $this->data_synchronizer->data_sync_is_enabled() ) {
		$disabled = true;
		$message  = __( 'This will delete the custom orders tables. The tables can be deleted only if the "High-Performance order storage" is not authoritative and sync is disabled (via Settings > Advanced > Features).', 'woocommerce' );
	} else {
		$disabled = false;
		$message  = __( 'This will delete the custom orders tables. To create them again enable the "High-Performance order storage" feature (via Settings > Advanced > Features).', 'woocommerce' );
	}

	$tools_array['delete_custom_orders_table'] = array(
		'name'             => __( 'Delete the custom orders tables', 'woocommerce' ),
		'desc'             => sprintf(
			'<strong class="red">%1$s</strong> %2$s',
			__( 'Note:', 'woocommerce' ),
			$message