-
Notifications
You must be signed in to change notification settings - Fork 383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Omit page caching and object caching tests for Site Health if on WP>=6.1 #7645
Conversation
Plugin builds for 57d4c0b are ready 🛎️!
|
9c3d0a5
to
737d1da
Compare
src/Admin/SiteHealth.php
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
/** This filter is documented in includes/settings/class-amp-customizer-design-settings.php */ |
amp-wp/includes/amp-helper-functions.php
Lines 706 to 718 in d9727b6
/** | |
* Filters whether to show the amphtml link on the frontend. | |
* | |
* This is deprecated since the name was wrong and the use case is not clear. To remove this from being printed, | |
* instead of using the filter you can rather do: | |
* | |
* add_action( 'template_redirect', static function () { | |
* remove_action( 'wp_head', 'amp_add_amphtml_link' ); | |
* } ); | |
* | |
* @since 0.2 | |
* @deprecated Remove amp_add_amphtml_link() call on wp_head action instead. | |
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
Summary
Fixes #7643
Checklist