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() (36b6bd79c0/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 c77b2f20f4) but was accidentaly removed when merging commit 083c994732 from another PR.

Fixes #20718
This commit is contained in:
Rodrigo Primo 2018-07-16 14:24:42 -03:00
parent ef00985e44
commit b39b419e5b
1 changed files with 1 additions and 1 deletions

View File

@ -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' ) );