| @@ -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,11 +315,11 @@ | ||
| 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 | 324 | * @return array{entries:int,bytes:int} |
| 309 | 325 | */ |
| @@ -311,9 +327,22 @@ | ||
| 311 | 327 | $removed = Cache::purge_local(); |
| 312 | 328 | $entries = (int) $removed['pages'] + (int) $removed['rest'] + (int) $removed['assets']; |
| 313 | 329 | |
| 314 | 330 | Cache::update_stats( array( 'last_purge' => time() ) ); |
| 315 | - do_action( 'xspeed_after_purge_all', $cause ); | |
| 331 | + | |
| 332 | + // Isolated per listener, and the throw swallowed: this sweep is | |
| 333 | + // already done, and one listener (Critical CSS, Unused CSS, the | |
| 334 | + // Cloudflare edge purge) failing must not cancel the ones queued | |
| 335 | + // behind it or stop the announcement below. Same handling | |
| 336 | + // purge_all() gives this action. (QA #348) | |
| 337 | + Cache::do_action_isolated( 'xspeed_after_purge_all', $cause ); | |
| 338 | + | |
| 339 | + // The public purge contract, which purge_all() publishes but | |
| 340 | + // purge_local() does not — without it `wp xspeed purge`, the | |
| 341 | + // dashboard button and the MCP purge tool would clear our files and | |
| 342 | + // leave LiteSpeed serving the stale page, having reported success. | |
| 343 | + Cache::announce_purge( $cause, $entries ); | |
| 344 | + | |
| 316 | 345 | Cache_Inventory::invalidate(); |
| 317 | 346 | |
| 318 | 347 | Activity_Log::record( |
| 319 | 348 | 'cache_purged', |