Skip to content

Commit

Permalink
Only deprecate amp_page_cache_good_response_time_threshold hook for…
Browse files Browse the repository at this point in the history
… WP 6.1+
  • Loading branch information
thelovekesh committed Oct 25, 2023
1 parent 66dd0c3 commit 9a09c38
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions src/Admin/SiteHealth.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,16 @@ public function register() {
/**
* Detect whether async tests can be used.
*
* Returns true if *not* on version of Health Check plugin which doesn't support REST async tests.
* Returns true if on WP 5.6+ and *not* on version of Health Check plugin which doesn't support REST async tests.
*
* @param array $tests Tests.
* @return bool
*/
private function supports_async_rest_tests( $tests ) {
if ( version_compare( get_bloginfo( 'version' ), '5.6', '<' ) ) {
return false;
}

if ( defined( 'HEALTH_CHECK_PLUGIN_VERSION' ) ) {
$core_async_tests = [
'dotorg_communication',
Expand Down Expand Up @@ -350,21 +354,23 @@ static function ( $available_service ) {
* @return int Threshold.
*/
public function get_good_response_time_threshold( $threshold = 600 ) {
/**
* Filters the threshold below which a response time is considered good.
*
* @since 2.2.1
*
* @deprecated 2.4.3 Use `site_status_good_response_time_threshold` instead.
*
* @param int $threshold Threshold in milliseconds.
*/
return (int) apply_filters_deprecated(
'amp_page_cache_good_response_time_threshold',
[ $threshold ],
'2.4.3',
'site_status_good_response_time_threshold'
);
if ( version_compare( get_bloginfo( 'version' ), '6.1', '>=' ) ) {
/** @deprecated 2.4.3 Use `site_status_good_response_time_threshold` instead. */
return (int) apply_filters_deprecated(
'amp_page_cache_good_response_time_threshold',
[ $threshold ],
'2.4.3',
'site_status_good_response_time_threshold'
);
} else {
/**
* Filters the threshold below which a response time is considered good.
*
* @since 2.2.1
* @param int $threshold Threshold in milliseconds.
*/
return (int) apply_filters( 'amp_page_cache_good_response_time_threshold', 600 );
}
}

/**
Expand Down

0 comments on commit 9a09c38

Please sign in to comment.