PluginProbe
xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN / 1.4.2
xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN v1.4.2
1.4.2 1.4.1 1.4.0 1.3.7 1.3.6 1.3.5 1.3.4 1.3.3 1.3.2 1.3.1 1.3.0 1.2.4 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 All 36 releases
← All changes | includes/class-health.php +76 -34 1.3.7 → 1.4.2 View file →
@@ -38,8 +38,70 @@
38 38 'unknown' => 'Unknown',
39 39 );
40 40
41 41 /**
42 + * The server-level page cache row, or null on a site without one. Split
43 + * out of checks() so both Nginx Helper modes can be tested. (#573)
44 + *
45 + * @param bool $cache_enabled Whether xSpeed's own page cache is on.
46 + * @return array<string,string>|null
47 + */
48 + public static function host_page_cache_row( bool $cache_enabled ): ?array {
49 + $host_cache_mode = Host_Page_Caches::nginx_helper_page_cache();
50 + if ( null === $host_cache_mode ) {
51 + return null;
52 + }
53 + // Same wording in both modes; only where the copies live differs.
54 + $where = Host_Page_Caches::MODE_REDIS === $host_cache_mode ? 'in nginx (held in Redis)' : 'in nginx (FastCGI)';
55 + $detail = $cache_enabled
56 + ? 'Your server is running its own full-page cache ' . $where . ', managed by the Nginx Helper plugin your host installed — so this site has TWO full-page caches stacked in front of it. xSpeed clears the server layer too on a Purge All, and on the changes that affect every page — settings, updates, themes, plugins, menus. It leaves the routine purge after a post or comment edit to Nginx Helper, which clears just the pages that changed, as long as Nginx Helper\'s own Enable Purge setting is on. With it off, xSpeed clears the server layer after those edits too. The two caches expire on their own schedules, and your host decides how long the server side keeps each page, so a page can still be served from nginx after xSpeed has regenerated it. If edits keep looking stale, purge from your host\'s dashboard too, or turn xSpeed\'s page cache off and let the server layer do the work — it is the faster of the two, because it answers before PHP starts.'
57 + : 'Your server is running a full-page cache ' . $where . ', managed by the Nginx Helper plugin your host installed. xSpeed\'s own page cache is off, so this is the only full-page cache in front of the site — and it is the fastest kind, answering before PHP starts. Purge All in xSpeed still clears it, as do settings changes and plugin, theme or core updates. The routine purge after editing a post or approving a comment is left to Nginx Helper, which clears just the pages that changed rather than all of them, as long as Nginx Helper\'s own Enable Purge setting is on. With it off, xSpeed clears the server layer after those edits too.';
58 +
59 + $redis = Host_Page_Caches::nginx_helper_redis_target();
60 + if ( null !== $redis ) {
61 + // Server and prefix, never credentials. The prefix is what
62 + // Nginx Helper's purge deletes under, so it is the thing to
63 + // check against the host's nginx config. (#573)
64 + $detail .= sprintf( ' Redis server: %s, key prefix "%s".', $redis['server'], '' !== $redis['prefix'] ? $redis['prefix'] : '(none)' );
65 + } else {
66 + $host_cache_path = (string) Host_Page_Caches::nginx_helper_cache_path();
67 + // Path prefix as a fingerprint for the WORDING only — never as
68 + // a gate. Nginx Helper is not xCloud-only; other hosts and
69 + // manual installs use it with a cache directory elsewhere.
70 + if ( 0 === strpos( $host_cache_path, '/etc/nginx/cache/' ) ) {
71 + $detail .= sprintf( ' Cache directory: %s (the layout xCloud provisions).', $host_cache_path );
72 + } else {
73 + $detail .= sprintf( ' Cache directory: %s.', $host_cache_path );
74 + }
75 + }
76 +
77 + // The purge is a direct unlink by the PHP-FPM user against a
78 + // directory nginx owns. Whether that user can write there is a
79 + // property of the host we cannot test from here without deleting
80 + // someone's cache to find out, so say what to check rather than
81 + // claiming an outcome either way. FastCGI only: Redis has no files.
82 + if ( null === $redis && 'unlink_files' === Host_Page_Caches::nginx_helper_purge_method() ) {
83 + $detail .= ' The server cache is purged by deleting its files directly, which needs PHP to have write access to that directory — if a purge here never changes what nginx serves, that permission is the thing to check with your host.';
84 + }
85 +
86 + if ( is_multisite() ) {
87 + // Nginx Helper's Redis purge_all() deletes only keys under this
88 + // site's scheme, host and path; FastCGI unlinks the whole
89 + // directory. (#573)
90 + $detail .= null !== $redis
91 + ? ' On multisite, Nginx Helper clears only this site\'s pages from Redis, matched by its address. Other sites on the network keep their server copies until their own purge or expiry.'
92 + : ' On multisite, nginx keys one cache per install rather than per site, so this purge clears every site on the network.';
93 + }
94 +
95 + return array(
96 + 'id' => 'host_page_cache',
97 + 'tone' => $cache_enabled ? self::WARN : self::INFO,
98 + 'label' => Host_Page_Caches::MODE_REDIS === $host_cache_mode ? 'Server-level page cache (nginx Redis)' : 'Server-level page cache (nginx FastCGI)',
99 + 'detail' => $detail,
100 + );
101 + }
102 +
103 + /**
42 104 * Full check list used by the Health module's dashboard panel.
43 105 *
44 106 * @return array<int,array{id:string,tone:string,label:string,detail:string}>
45 107 */
@@ -399,42 +461,11 @@
399 461 * inner one has already regenerated — the classic "I purged and it is
400 462 * still stale" report. With xSpeed's own page cache off there is only
401 463 * one layer and nothing to warn about, so that case is INFO.
402 464 */
403 - $host_cache_path = Host_Page_Caches::nginx_helper_cache_path();
404 - if ( null !== $host_cache_path ) {
405 - $detail = $cache_enabled
406 - ? 'Your server is running its own full-page cache in nginx (FastCGI), managed by the Nginx Helper plugin your host installed — so this site has TWO full-page caches stacked in front of it. xSpeed clears the server layer too on a Purge All, and on the changes that affect every page — settings, updates, themes, plugins, menus. It leaves the routine purge after a post or comment edit to Nginx Helper, which clears just the pages that changed, as long as Nginx Helper\'s own Enable Purge setting is on. With it off, xSpeed clears the server layer after those edits too. The two caches expire on their own schedules (the server side is typically an hour), so a page can still be served from nginx after xSpeed has regenerated it. If edits keep looking stale, purge from your host\'s dashboard too, or turn xSpeed\'s page cache off and let the server layer do the work — it is the faster of the two, because it answers before PHP starts.'
407 - : 'Your server is running a full-page cache in nginx (FastCGI), managed by the Nginx Helper plugin your host installed. xSpeed\'s own page cache is off, so this is the only full-page cache in front of the site — and it is the fastest kind, answering before PHP starts. Purge All in xSpeed still clears it, as do settings changes and plugin, theme or core updates. The routine purge after editing a post or approving a comment is left to Nginx Helper, which clears just the pages that changed rather than all of them, as long as Nginx Helper\'s own Enable Purge setting is on. With it off, xSpeed clears the server layer after those edits too.';
408 -
409 - // Path prefix as a fingerprint for the WORDING only — never as a
410 - // gate. Nginx Helper is not xCloud-only; other hosts and manual
411 - // installs use it with a cache directory somewhere else entirely.
412 - if ( 0 === strpos( $host_cache_path, '/etc/nginx/cache/' ) ) {
413 - $detail .= sprintf( ' Cache directory: %s (the layout xCloud provisions).', $host_cache_path );
414 - } else {
415 - $detail .= sprintf( ' Cache directory: %s.', $host_cache_path );
416 - }
417 -
418 - // The purge is a direct unlink by the PHP-FPM user against a
419 - // directory nginx owns. Whether that user can write there is a
420 - // property of the host we cannot test from here without deleting
421 - // someone's cache to find out, so say what to check rather than
422 - // claiming an outcome either way.
423 - if ( 'unlink_files' === Host_Page_Caches::nginx_helper_purge_method() ) {
424 - $detail .= ' The server cache is purged by deleting its files directly, which needs PHP to have write access to that directory — if a purge here never changes what nginx serves, that permission is the thing to check with your host.';
425 - }
426 -
427 - if ( is_multisite() ) {
428 - $detail .= ' On multisite, nginx keys one cache per install rather than per site, so this purge clears every site on the network.';
429 - }
430 -
431 - $out[] = array(
432 - 'id' => 'host_page_cache',
433 - 'tone' => $cache_enabled ? self::WARN : self::INFO,
434 - 'label' => 'Server-level page cache (nginx FastCGI)',
435 - 'detail' => $detail,
436 - );
465 + $host_row = self::host_page_cache_row( $cache_enabled );
466 + if ( null !== $host_row ) {
467 + $out[] = $host_row;
437 468 }
438 469
439 470 // Cache expiry vs preloader schedule (deterministic rule, issue #31):
440 471 // pages that expire faster than the preloader re-warms them leave the
@@ -472,8 +503,19 @@
472 503 // checks(); see edge_check().
473 504 $edge_row = self::edge_check();
474 505 if ( null !== $edge_row ) {
475 506 $out[] = $edge_row;
507 + }
508 +
509 + // Whether that edge actually obeys "do not store". Read from the
510 + // last background probe only; a cold one schedules a run and shows
511 + // nothing this paint. See Edge_Mode_Probe.
512 + $mode_row = Edge_Mode_Probe::health_row(
513 + Edge_Mode_Probe::cached()['verdict'],
514 + defined( 'XCLOUD_CFE_PURGE_API_URL' ) || defined( 'XCLOUD_CFE_PURGE_VERSION' )
515 + );
516 + if ( null !== $mode_row ) {
517 + $out[] = $mode_row;
476 518 }
477 519
478 520 // Cache-poisoning Set-Cookie detection (issue #33): a plugin emitting
479 521 // Set-Cookie on anonymous pageviews forces CDN/edge BYPASS for all