From e0757beafc005487f43405650090ac27d9c2e412 Mon Sep 17 00:00:00 2001 From: Peter Fabian Date: Fri, 21 Sep 2018 12:24:15 +0200 Subject: [PATCH] Included product lookup in reports regeneration tool. --- .../includes/class-wc-admin-api-init.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/woocommerce-admin/includes/class-wc-admin-api-init.php b/plugins/woocommerce-admin/includes/class-wc-admin-api-init.php index 8cb9499322a..3fd606ded1c 100644 --- a/plugins/woocommerce-admin/includes/class-wc-admin-api-init.php +++ b/plugins/woocommerce-admin/includes/class-wc-admin-api-init.php @@ -135,6 +135,14 @@ class WC_Admin_Api_Init { 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. * @@ -149,7 +157,7 @@ class WC_Admin_Api_Init { 'name' => __( 'Rebuild reports data', 'woocommerce' ), 'button' => __( 'Rebuild 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. * @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 ) { global $wpdb;