-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Improve Site Health Page Cache Detection Logic #10606
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
base: trunk
Are you sure you want to change the base?
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
westonruter
left a comment
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.
Question: Are you using AI to draft these changes?
|
|
||
| // Generic caching proxies (Nginx, Varnish, etc.) | ||
| 'x-cache' => $cache_hit_callback, | ||
| 'x-cache-status' => $cache_hit_callback, | ||
| 'x-litespeed-cache' => $cache_hit_callback, | ||
| 'x-proxy-cache' => $cache_hit_callback, | ||
| 'via' => '', | ||
|
|
||
| // Cloudflare | ||
| 'cf-cache-status' => $cache_hit_callback, |
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.
Why are these removed from this list but the others are left intact?
| * @param array $headers Response headers. | ||
| * @return bool Whether cache was detected. | ||
| */ | ||
| private function detect_cache_headers( $headers ) { |
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.
There are many PHPCS coding standards issues in this method.
| '<p><a href="%1$s" target="_blank" rel="noreferrer">%2$s<span class="screen-reader-text"> %3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>', | ||
| __( 'https://developer.wordpress.org/advanced-administration/performance/optimization/#caching' ), | ||
| __( 'Learn more about page cache' ), | ||
| /* translators: Hidden accessibility text. */ |
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.
Why is this comment removed?
| * @return array The test result. | ||
| */ | ||
| public function get_test_page_cache() { | ||
| $description = '<p>' . __( 'Page cache enhances the speed and performance of your site by saving and serving static pages instead of calling for a page every time a user visits.' ) . '</p>'; |
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.
Why are all of these lines modified?
Trac Ticket: https://core.trac.wordpress.org/ticket/64370
This PR enhances the WordPress Site Health page cache test by introducing
a robust cache header detection mechanism. The previous method could
produce false positives or negatives depending on the caching system used.
Changes include:
Testing:
This PR is backward compatible and does not change existing Site Health UI behavior.