Included product lookup in reports regeneration tool.

This commit is contained in:
Peter Fabian 2018-09-21 12:24:15 +02:00
parent 5aa3aae58a
commit e0757beafc
1 changed files with 10 additions and 1 deletions

View File

@ -135,6 +135,14 @@ class WC_Admin_Api_Init {
return $endpoints; return $endpoints;
} }
/**
* Regenerate data for reports.
*/
public static function regenrate_report_data() {
WC_Admin_Reports_Orders_Data_Store::queue_order_stats_repopulate_database();
self::order_product_lookup_store_init();
}
/** /**
* Adds regenerate tool. * Adds regenerate tool.
* *
@ -149,7 +157,7 @@ class WC_Admin_Api_Init {
'name' => __( 'Rebuild reports data', 'woocommerce' ), 'name' => __( 'Rebuild reports data', 'woocommerce' ),
'button' => __( 'Rebuild reports', 'woocommerce' ), 'button' => __( 'Rebuild reports', 'woocommerce' ),
'desc' => __( 'This tool will rebuild all of the information used by the reports.', 'woocommerce' ), 'desc' => __( 'This tool will rebuild all of the information used by the reports.', 'woocommerce' ),
'callback' => array( 'WC_Admin_Reports_Orders_Data_Store', 'queue_order_stats_repopulate_database' ), 'callback' => array( 'WC_Admin_Api_Init', 'regenrate_report_data' ),
), ),
) )
); );
@ -168,6 +176,7 @@ class WC_Admin_Api_Init {
* @param WC_Background_Updater|null $updater Updater instance. * @param WC_Background_Updater|null $updater Updater instance.
* @return bool * @return bool
*/ */
// TODO: this needs to be updated a bit, as it no longer runs as a part of WC_Install, there is no bg updater.
public static function order_product_lookup_store_init( $updater = null ) { public static function order_product_lookup_store_init( $updater = null ) {
global $wpdb; global $wpdb;