Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Return fresh data not stale data. #1

Merged
merged 1 commit into from
Dec 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions includes/CustomerBluehost.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down