| @@ -320,9 +320,9 @@ | ||
| 320 | 320 | * through `xspeed_after_purge_all`, whatever modules clear alongside |
| 321 | 321 | * them. |
| 322 | 322 | * |
| 323 | 323 | * @param string $cause Who asked. |
| 324 | - * @return array{entries:int,bytes:int} | |
| 324 | + * @return array{entries:int,bytes:int,reason:string} | |
| 325 | 325 | */ |
| 326 | 326 | public static function purge_page( string $cause ): array { |
| 327 | 327 | $removed = Cache::purge_local(); |
| 328 | 328 | $entries = (int) $removed['pages'] + (int) $removed['rest'] + (int) $removed['assets']; |
| @@ -339,10 +339,26 @@ | ||
| 339 | 339 | // The public purge contract, which purge_all() publishes but |
| 340 | 340 | // purge_local() does not — without it `wp xspeed purge`, the |
| 341 | 341 | // dashboard button and the MCP purge tool would clear our files and |
| 342 | 342 | // leave LiteSpeed serving the stale page, having reported success. |
| 343 | - 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 | + ); | |
| 344 | 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 | + | |
| 345 | 361 | Cache_Inventory::invalidate(); |
| 346 | 362 | |
| 347 | 363 | Activity_Log::record( |
| 348 | 364 | 'cache_purged', |
| @@ -357,8 +373,9 @@ | ||
| 357 | 373 | |
| 358 | 374 | return array( |
| 359 | 375 | 'entries' => $entries, |
| 360 | 376 | 'bytes' => (int) $removed['bytes'], |
| 377 | + 'reason' => $reason, | |
| 361 | 378 | ); |
| 362 | 379 | } |
| 363 | 380 | |
| 364 | 381 | /** |