Plugin Directory


Ignore:
Timestamp:
10/13/2026 10:00:51 AM (13 days ago)
Author:
shiponkarmakar
Message:

Release v1.1.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • optimazz/trunk/includes/Admin/RestController.php

    r3723128 r3743505  
    278278                // modules emit into the page, so stale cached HTML must be cleared for the
    279279                // 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.
    280282                $purged = false;
    281                 foreach ( array( 'css', 'js', 'media', 'fonts', 'cdn', 'tweaks', 'tools' ) as $mod ) {
     283                foreach ( array( 'cache', 'css', 'js', 'media', 'fonts', 'cdn', 'tweaks', 'tools' ) as $mod ) {
    282284                        $old = isset( $before[ $mod ] ) ? $before[ $mod ] : array();
    283285                        $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                        }
    284293                        if ( wp_json_encode( $old ) !== wp_json_encode( $new ) ) {
    285294                                $purged = true;
    … …  
    373382         */
    374383        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                }
    375387                Manager::storage()->purge_all();
    376388                return new WP_REST_Response( array( 'message' => 'purged' ), 200 );
    … …  
    573585         */
    574586        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                }
    575590                // Make sure the page-cache module is on, then force our drop-in in.
    576591                $cache = $this->settings->all();
    … …  
    596611         */
    597612        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                }
    598616                $plugin  = (string) $request->get_param( 'plugin' );
    599617                if ( '' === $plugin || '' === Dropin::known_cache_plugin_name( $plugin ) ) {
Note: See TracChangeset for help on using the changeset viewer.