From b39b419e5bb1c547f6f44bb343a0c9b59e010eb5 Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Mon, 16 Jul 2018 14:24:42 -0300 Subject: [PATCH] Pass an instance of the background updater to the db update callbacks This commit changes the way that WC_Background_Updater::task() calls the database update callbacks and adds the WC_Background_Updater instance as the first parameter to the callbacks. This is used in wc_update_350_order_customer_id() (https://github.com/woocommerce/woocommerce/blob/36b6bd79c0d61035e979b017a23b6c0c79accaba/includes/wc-update-functions.php#L1870) to monitor memory usage while the function is running. This change was intended to ship with PR #17895 (see commit https://github.com/woocommerce/woocommerce/pull/17895/commits/c77b2f20f443647fd09c0de9705d2dbc214548c3) but was accidentaly removed when merging commit 083c9947328df00c0af65cfdf300e31ea74aa337 from another PR. Fixes #20718 --- includes/class-wc-background-updater.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-wc-background-updater.php b/includes/class-wc-background-updater.php index 1c28f7f26da..86047094805 100644 --- a/includes/class-wc-background-updater.php +++ b/includes/class-wc-background-updater.php @@ -106,7 +106,7 @@ class WC_Background_Updater extends WC_Background_Process { if ( is_callable( $callback ) ) { $logger->info( sprintf( 'Running %s callback', $callback ), array( 'source' => 'wc_db_updates' ) ); - $result = (bool) call_user_func( $callback ); + $result = (bool) call_user_func( $callback, $this ); if ( $result ) { $logger->info( sprintf( '%s callback needs to run again', $callback ), array( 'source' => 'wc_db_updates' ) );