From 0391b11b20088add4796b954a58f02a31f63668f Mon Sep 17 00:00:00 2001 From: Adrien Foulon <6115458+Tofandel@users.noreply.github.com> Date: Thu, 14 Mar 2019 23:05:54 +0100 Subject: [PATCH] Review --- includes/admin/reports/class-wc-admin-report.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/includes/admin/reports/class-wc-admin-report.php b/includes/admin/reports/class-wc-admin-report.php index bcd105398c9..74dd23c484c 100644 --- a/includes/admin/reports/class-wc-admin-report.php +++ b/includes/admin/reports/class-wc-admin-report.php @@ -358,17 +358,13 @@ class WC_Admin_Report { * Init the static hooks of the class. */ protected static function add_update_transients_hook() { - static $done = false; - - if ( $done ) { - return; + if ( ! has_action( 'shutdown', array( 'WC_Admin_Report', 'maybe_update_transients' ) ) { + add_action( 'shutdown', array( 'WC_Admin_Report', 'maybe_update_transients' ) ); } - $done = true; - add_action( 'shutdown', array( 'WC_Admin_Report', 'maybe_update_transients' ) ); } /** - * Enables big mysql selects for reports, just once for this session + * Enables big mysql selects for reports, just once for this session. */ protected static function enable_big_selects() { static $big_selects = false; @@ -382,7 +378,7 @@ class WC_Admin_Report { } /** - * Get the cached query result or null if it's not in the cache + * Get the cached query result or null if it's not in the cache. * * @param string $query_hash *