Plugin Directory

Changeset 3246776


Ignore:
Timestamp:
02/25/2025 11:35:50 PM (13 months ago)
Author:
getpantheon
Message:

Update to version 2.1.1 from GitHub

Location:
pantheon-advanced-page-cache
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • pantheon-advanced-page-cache/tags/2.1.1/inc/class-purger.php

    r3132786 r3246776  
    3737        }
    3838        self::purge_post_with_related( $post );
     39        if ( 'publish' === $old_status ) {
     40            return;
     41        }
     42        // Targets 404 pages that could be cached with no surrogate keys (i.e.
     43        // a drafted post going live after the 404 has been cached).
     44        self::clear_post_path( $post );
     45    }
     46
     47
     48    /**
     49     * Purge the cache for a given post's path
     50     *
     51     * @param WP_Post $post Post object.
     52     *
     53     * @since 2.1.1-dev
     54     */
     55    public static function clear_post_path( $post ) {
     56        $post_path = get_permalink( $post->ID );
     57        $parsed_url = parse_url( $post_path );
     58        $path = $parsed_url['path'];
     59        $paths = [ trailingslashit( $path ), untrailingslashit( $path ) ];
     60       
     61        /**
     62         * Paths possibly without surrogate keys purges
     63         *
     64         * @param array $paths    paths to clear.
     65         */
     66        $paths = apply_filters( 'pantheon_clear_post_path', $paths );
     67        pantheon_wp_clear_edge_paths( $paths );
    3968    }
    4069
  • pantheon-advanced-page-cache/tags/2.1.1/pantheon-advanced-page-cache.php

    r3132786 r3246776  
    88 * Text Domain: pantheon-advanced-page-cache
    99 * Domain Path: /languages
    10  * Version: 2.1.0
     10 * Version: 2.1.1
    1111 * Requires at least: 6.4
    12  * Tested up to: 6.6.1
     12 * Tested up to: 6.7.2
    1313 *
    1414 * @package         Pantheon_Advanced_Page_Cache
  • pantheon-advanced-page-cache/tags/2.1.1/readme.txt

    r3132786 r3246776  
    33Tags: pantheon, cdn, cache
    44Requires at least: 6.4
    5 Tested up to: 6.6.1
    6 Stable tag: 2.1.0
     5Tested up to: 6.7.2
     6Stable tag: 2.1.1
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    127127Lastly, the `pantheon_wp_rest_api_surrogate_keys` filter lets you filter surrogate keys present in a REST API response.
    128128
     129= Additional purging by path =
     130
     131When a post is published for the first time, the permalink's path is also purged even if it has no matching keys. This can be further filtered with the `pantheon_clear_post_path` filter.
     132
     133        add_action('pantheon_clear_post_path', function($paths) {
     134            // Add or remove paths from $paths
     135            return $paths
     136        }, 10, 3);
     137
    129138Need a bit more power? In addition to `pantheon_wp_clear_edge_keys()`, there are two additional helper functions you can use:
    130139
     
    369378
    370379== Changelog ==
     380
     381= 2.1.1 (25 February 2025) =
     382* Fixes 404 pages remaining cached after a post has been published ([#315](https://github.com/pantheon-systems/pantheon-advanced-page-cache/pull/315))
     383
    371384= 2.1.0 (8 August 2024) =
    372385* Adds any callable functions hooked to the `pantheon_cache_default_max_age` filter to the message that displays in the WordPress admin when a cache max age filter is active. [[#292](https://github.com/pantheon-systems/pantheon-advanced-page-cache/pull/292)] This gives some context to troubleshoot if the filter is active somewhere in the codebase. If an anonymous function is used, it is noted in the message that displays.
  • pantheon-advanced-page-cache/trunk/inc/class-purger.php

    r3132786 r3246776  
    3737        }
    3838        self::purge_post_with_related( $post );
     39        if ( 'publish' === $old_status ) {
     40            return;
     41        }
     42        // Targets 404 pages that could be cached with no surrogate keys (i.e.
     43        // a drafted post going live after the 404 has been cached).
     44        self::clear_post_path( $post );
     45    }
     46
     47
     48    /**
     49     * Purge the cache for a given post's path
     50     *
     51     * @param WP_Post $post Post object.
     52     *
     53     * @since 2.1.1-dev
     54     */
     55    public static function clear_post_path( $post ) {
     56        $post_path = get_permalink( $post->ID );
     57        $parsed_url = parse_url( $post_path );
     58        $path = $parsed_url['path'];
     59        $paths = [ trailingslashit( $path ), untrailingslashit( $path ) ];
     60       
     61        /**
     62         * Paths possibly without surrogate keys purges
     63         *
     64         * @param array $paths    paths to clear.
     65         */
     66        $paths = apply_filters( 'pantheon_clear_post_path', $paths );
     67        pantheon_wp_clear_edge_paths( $paths );
    3968    }
    4069
  • pantheon-advanced-page-cache/trunk/pantheon-advanced-page-cache.php

    r3132786 r3246776  
    88 * Text Domain: pantheon-advanced-page-cache
    99 * Domain Path: /languages
    10  * Version: 2.1.0
     10 * Version: 2.1.1
    1111 * Requires at least: 6.4
    12  * Tested up to: 6.6.1
     12 * Tested up to: 6.7.2
    1313 *
    1414 * @package         Pantheon_Advanced_Page_Cache
  • pantheon-advanced-page-cache/trunk/readme.txt

    r3132786 r3246776  
    33Tags: pantheon, cdn, cache
    44Requires at least: 6.4
    5 Tested up to: 6.6.1
    6 Stable tag: 2.1.0
     5Tested up to: 6.7.2
     6Stable tag: 2.1.1
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    127127Lastly, the `pantheon_wp_rest_api_surrogate_keys` filter lets you filter surrogate keys present in a REST API response.
    128128
     129= Additional purging by path =
     130
     131When a post is published for the first time, the permalink's path is also purged even if it has no matching keys. This can be further filtered with the `pantheon_clear_post_path` filter.
     132
     133        add_action('pantheon_clear_post_path', function($paths) {
     134            // Add or remove paths from $paths
     135            return $paths
     136        }, 10, 3);
     137
    129138Need a bit more power? In addition to `pantheon_wp_clear_edge_keys()`, there are two additional helper functions you can use:
    130139
     
    369378
    370379== Changelog ==
     380
     381= 2.1.1 (25 February 2025) =
     382* Fixes 404 pages remaining cached after a post has been published ([#315](https://github.com/pantheon-systems/pantheon-advanced-page-cache/pull/315))
     383
    371384= 2.1.0 (8 August 2024) =
    372385* Adds any callable functions hooked to the `pantheon_cache_default_max_age` filter to the message that displays in the WordPress admin when a cache max age filter is active. [[#292](https://github.com/pantheon-systems/pantheon-advanced-page-cache/pull/292)] This gives some context to troubleshoot if the filter is active somewhere in the codebase. If an anonymous function is used, it is noted in the message that displays.
Note: See TracChangeset for help on using the changeset viewer.