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

Commit

Permalink
Merge pull request #1 from newfold-labs/data-updates
Browse files Browse the repository at this point in the history
Return fresh data not stale data.
  • Loading branch information
circlecube authored Dec 12, 2022
2 parents 207fa07 + 2b8971a commit 8e83090
Showing 1 changed file with 8 additions and 9 deletions.
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

0 comments on commit 8e83090

Please sign in to comment.