Omit page caching and object caching tests for Site Health if on WP>=6.1#7645
Omit page caching and object caching tests for Site Health if on WP>=6.1#7645westonruter merged 7 commits intodevelopfrom
Conversation
|
Plugin builds for 57d4c0b are ready 🛎️!
|
9c3d0a5 to
737d1da
Compare
| 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 ); |
There was a problem hiding this comment.
Not sure if this is the best approach to deprecate amp_page_cache_good_response_time_threshold but we need to deprecate it for WP >= 6.1.
737d1da to
3c3ad0d
Compare
westonruter
left a comment
There was a problem hiding this comment.
Very thorough considerations here!
src/Admin/SiteHealth.php
Outdated
| return (int) apply_filters( 'amp_page_cache_good_response_time_threshold', 600 ); | ||
| public function get_good_response_time_threshold( $threshold = 600 ) { | ||
| if ( version_compare( get_bloginfo( 'version' ), '6.1', '>=' ) ) { | ||
| /** @deprecated 2.4.3 Use `site_status_good_response_time_threshold` instead. */ |
There was a problem hiding this comment.
I think we could just add the @deprecated tag to the phpdoc below, and this line can be replaced with just:
| /** @deprecated 2.4.3 Use `site_status_good_response_time_threshold` instead. */ | |
| /** This filter is documented in src/Admin/SiteHealth.php */ |
See:
amp-wp/includes/admin/functions.php
Line 105 in d9727b6
amp-wp/includes/amp-helper-functions.php
Lines 706 to 718 in d9727b6
There was a problem hiding this comment.
Could this deprecation tag lead to confusion if the user is on WP < 6.1? Because in that case site_status_good_response_time_threshold won't be available.
There was a problem hiding this comment.
We don't want people to use it anymore though, as they should be updating WordPress to a current version. In any case, they won't get the deprecated notice because of the if check.
In any case, I highly doubt this filter is being used by many sites. So I don't think there will be any confusion as nobody will even notice the tag.
Co-authored-by: Weston Ruter <westonruter@google.com>
Co-authored-by: Weston Ruter <westonruter@google.com>
Summary
Fixes #7643
Checklist