From 2b8971a7f3f6c7508156e25317e0b10ddc3b5a29 Mon Sep 17 00:00:00 2001 From: Mike Hansen Date: Thu, 8 Dec 2022 22:59:22 -0500 Subject: [PATCH] Return fresh data not stale data. --- includes/CustomerBluehost.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/includes/CustomerBluehost.php b/includes/CustomerBluehost.php index 4d16545..00c0a4d 100644 --- a/includes/CustomerBluehost.php +++ b/includes/CustomerBluehost.php @@ -59,18 +59,17 @@ class CustomerBluehost { */ public static function collect() { - // check if bh_cdata is in option (prefered) + // check if bh_cdata is stale + if ( self::is_stale() ) { + self::refresh_data(); + } + + // check if bh_cdata is in option (prefered) - always fresh $data = \get_option( self::CUST_DATA ); - // if found + // exists and no need for additional checks if ( ! empty( $data ) ) { - - // if stale, refresh data - if ( self::is_stale() ) { - self::refresh_data(); - } - - return $data; // return data + return $data; } // If no option found, check for transient value