Changeset 3743505 for optimazz/trunk/includes/Admin/RestController.php
- Timestamp:
- 10/13/2026 10:00:51 AM (13 days ago)
- File:
-
- 1 edited
-
optimazz/trunk/includes/Admin/RestController.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
optimazz/trunk/includes/Admin/RestController.php
r3723128 r3743505 278 278 // modules emit into the page, so stale cached HTML must be cleared for the 279 279 // change to take effect immediately (the whole point of Safe Mode). 280 // 'cache' is included so a new exclusion (or lifetime, mobile split …) 281 // also drops pages that were cached under the old rules. 280 282 $purged = false; 281 foreach ( array( 'c ss', 'js', 'media', 'fonts', 'cdn', 'tweaks', 'tools' ) as $mod ) {283 foreach ( array( 'cache', 'css', 'js', 'media', 'fonts', 'cdn', 'tweaks', 'tools' ) as $mod ) { 282 284 $old = isset( $before[ $mod ] ) ? $before[ $mod ] : array(); 283 285 $new = isset( $saved[ $mod ] ) ? $saved[ $mod ] : array(); 286 if ( 'cache' === $mod ) { 287 // Preload schedule and browser-cache headers don't change the 288 // cached HTML — changing them must not throw the cache away. 289 foreach ( array( 'preload', 'preload_interval', 'browser_cache' ) as $key ) { 290 unset( $old[ $key ], $new[ $key ] ); 291 } 292 } 284 293 if ( wp_json_encode( $old ) !== wp_json_encode( $new ) ) { 285 294 $purged = true; … … 373 382 */ 374 383 public function purge_cache() { 384 if ( is_multisite() && ! \Optimazz\Core\Network::cache_enabled() ) { 385 return new WP_REST_Response( array( 'message' => __( 'Page caching is not available on multisite networks.', 'optimazz' ) ), 400 ); 386 } 375 387 Manager::storage()->purge_all(); 376 388 return new WP_REST_Response( array( 'message' => 'purged' ), 200 ); … … 573 585 */ 574 586 public function cache_takeover( WP_REST_Request $request ) { 587 if ( ! \Optimazz\Core\Settings::server_features_allowed() ) { 588 return new WP_REST_Response( array( 'message' => __( 'Page caching is not available on multisite networks.', 'optimazz' ) ), 400 ); 589 } 575 590 // Make sure the page-cache module is on, then force our drop-in in. 576 591 $cache = $this->settings->all(); … … 596 611 */ 597 612 public function cache_deactivate_conflict( WP_REST_Request $request ) { 613 if ( ! \Optimazz\Core\Settings::server_features_allowed() ) { 614 return new WP_REST_Response( array( 'message' => __( 'Page caching is not available on multisite networks.', 'optimazz' ) ), 400 ); 615 } 598 616 $plugin = (string) $request->get_param( 'plugin' ); 599 617 if ( '' === $plugin || '' === Dropin::known_cache_plugin_name( $plugin ) ) {
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)