Improve Site Health Page Cache Detection Logic#10606
Improve Site Health Page Cache Detection Logic#10606solankisoftware89 wants to merge 1 commit intoWordPress:trunkfrom
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.
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.
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.
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.
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.
Why are all of these lines modified?
|
Closing due to lack of response and the PR not being touching many unrelated lines. |
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.