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-purge-runner.php +42 -9 1.3.4 → 1.4.2 View file →
@@ -239,12 +239,14 @@
239 239 public static function targets(): array {
240 240 $targets = array(
241 241 'page' => array(
242 242 // Named for the flag users reach for, but it is the whole
243 - // local sweep: flat HTML, the static tree, cached REST
244 - // responses and minified assets. Splitting those into four
245 - // line items would be four rows that always move together.
246 - 'label' => __( 'Page cache (HTML, static, REST, minified assets)', 'xspeed' ),
243 + // local sweep: flat HTML, the static tree and cached REST
244 + // responses. Splitting those into three line items would be
245 + // three rows that always move together. Minified assets are
246 + // not in it: they are named by content, so a site purge
247 + // leaves them (see `wp xspeed minify purge`).
248 + 'label' => __( 'Page cache (HTML, static, REST)', 'xspeed' ),
247 249 'group' => 'page',
248 250 // Always attempted. Files outlive the setting that wrote them,
249 251 // so a site that has just turned page caching OFF is exactly
250 252 // the site with stale HTML still on disk — refusing to sweep
@@ -264,8 +266,22 @@
264 266 'group' => 'edge',
265 267 'enabled' => array( self::class, 'cloudflare_enabled' ),
266 268 'callback' => array( self::class, 'purge_cloudflare' ),
267 269 ),
270 + );
271 + // Only where xCloud's purge plugin is installed, so every other site's
272 + // report is not padded with a row that can never apply. An installed
273 + // copy too old to take purges still gets the row: its reason is the
274 + // instruction to update.
275 + if ( Managed_Edge_Purge::installed() ) {
276 + $targets['xcloud'] = array(
277 + 'label' => __( 'Cloudflare Enterprise (xCloud)', 'xspeed' ),
278 + 'group' => 'edge',
279 + 'enabled' => array( Managed_Edge_Purge::class, 'status' ),
280 + 'callback' => array( Managed_Edge_Purge::class, 'purge_everything' ),
281 + );
282 + }
283 + $targets += array(
268 284 'cdn' => array(
269 285 'label' => __( 'CDN', 'xspeed' ),
270 286 'group' => 'cdn',
271 287 // xSpeed's own CDN module rewrites asset URLs; it holds no
@@ -299,14 +315,14 @@
299 315 );
300 316 }
301 317
302 318 /**
303 - * Local files: the flat tree, the static tree, REST responses, minified
304 - * assets — and, through `xspeed_after_purge_all`, whatever modules clear
305 - * alongside them.
319 + * Local files: the flat tree, the static tree and REST responses, and,
320 + * through `xspeed_after_purge_all`, whatever modules clear alongside
321 + * them.
306 322 *
307 323 * @param string $cause Who asked.
308 - * @return array{entries:int,bytes:int}
324 + * @return array{entries:int,bytes:int,reason:string}
309 325 */
310 326 public static function purge_page( string $cause ): array {
311 327 $removed = Cache::purge_local();
312 328 $entries = (int) $removed['pages'] + (int) $removed['rest'] + (int) $removed['assets'];
@@ -323,10 +339,26 @@
323 339 // The public purge contract, which purge_all() publishes but
324 340 // purge_local() does not — without it `wp xspeed purge`, the
325 341 // dashboard button and the MCP purge tool would clear our files and
326 342 // leave LiteSpeed serving the stale page, having reported success.
327 - Cache::announce_purge( $cause, $entries );
343 + // The announce also reaches caches in front of PHP, such as nginx
344 + // through Nginx Helper; the row names them so the operator can tell
345 + // they were reached. (#654)
346 + $run = Cache::report_forwarding(
347 + static function () use ( $cause, $entries ): void {
348 + Cache::announce_purge( $cause, $entries );
349 + }
350 + );
328 351
352 + $reason = '';
353 + if ( array() !== $run['forwarded'] ) {
354 + $reason = sprintf(
355 + /* translators: %s: names of the caches in front of the site, e.g. "Nginx Helper". */
356 + __( 'also sent the purge to %s', 'xspeed' ),
357 + implode( ', ', $run['forwarded'] )
358 + );
359 + }
360 +
329 361 Cache_Inventory::invalidate();
330 362
331 363 Activity_Log::record(
332 364 'cache_purged',
@@ -341,8 +373,9 @@
341 373
342 374 return array(
343 375 'entries' => $entries,
344 376 'bytes' => (int) $removed['bytes'],
377 + 'reason' => $reason,
345 378 );
346 379 }
347 380
348 381 /**