Skip to content

Commit

Permalink
Changed RegExp to intercept calls to /updates/latest.json only if the…
Browse files Browse the repository at this point in the history
…y have readme=true parameter
  • Loading branch information
DanieleAlessandra committed Sep 20, 2024
1 parent 66c41d1 commit 134934b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions includes/class-fs-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,11 +356,12 @@ function get( $path = '/', $flush = false, $expiration = WP_FS__TIME_24_HOURS_IN
}

// Do not cache the latest.json request.
if (preg_match('/\/latest\.json$/', $cache_key)) {
$regex = '/\/updates\/latest\.json\?.*(&|^)readme=true(&|$)/';
if (preg_match($regex, $path)) {
$this->_logger->log('Skipping cache for key: ' . $cache_key);
} else {
self::$_cache->set( $cache_key, $result, $expiration );
}
}

$cached_result = $result;
} else {
Expand Down Expand Up @@ -724,4 +725,4 @@ static function get_error_code( $result ) {
}

#endregion
}
}

0 comments on commit 134934b

Please sign in to comment.