From 510fc8c4a8c0646fe7b93c34e8734463a47fa7be Mon Sep 17 00:00:00 2001 From: Michal Salaj Date: Fri, 23 Jun 2023 21:32:59 +0200 Subject: [PATCH 1/2] change default configuration for cookies --- advanced-cache.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced-cache.php b/advanced-cache.php index ada8883..50b326f 100644 --- a/advanced-cache.php +++ b/advanced-cache.php @@ -69,7 +69,7 @@ class batcache { var $cancel = false; // Change this to cancel the output buffer. Use batcache_cancel(); - var $noskip_cookies = array( 'wordpress_test_cookie' ); // Names of cookies - if they exist and the cache would normally be bypassed, don't bypass it + var $noskip_cookies = array(); // Names of cookies - if they exist and the cache would normally be bypassed, don't bypass it var $cacheable_origin_hostnames = array(); // A whitelist of HTTP origin `:` (or just ``) names that are allowed as cache variations. var $origin = null; // Current Origin header. @@ -407,7 +407,7 @@ function set_query( $query_string ) { // Never batcache when cookies indicate a cache-exempt visitor. if ( is_array( $_COOKIE) && ! empty( $_COOKIE ) ) { foreach ( array_keys( $_COOKIE ) as $batcache->cookie ) { - if ( ! in_array( $batcache->cookie, $batcache->noskip_cookies ) && ( substr( $batcache->cookie, 0, 2 ) == 'wp' || substr( $batcache->cookie, 0, 9 ) == 'wordpress' || substr( $batcache->cookie, 0, 14 ) == 'comment_author' ) ) { + if ( ! in_array( $batcache->cookie, $batcache->noskip_cookies ) && ( substr( $batcache->cookie, 0, 12 ) == 'woocommerce_' || substr( $batcache->cookie, 0, 10 ) == 'wordpress_' || substr( $batcache->cookie, 0, 15 ) == 'comment_author_' ) ) { batcache_stats( 'batcache', 'cookie_skip' ); return; } From b94ee0b7890fa88b0120fd6c22eae48e9ac84310 Mon Sep 17 00:00:00 2001 From: Michal Salaj Date: Sat, 24 Jun 2023 09:53:48 +0200 Subject: [PATCH 2/2] fix test cookie removal --- advanced-cache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced-cache.php b/advanced-cache.php index 50b326f..d857fa9 100644 --- a/advanced-cache.php +++ b/advanced-cache.php @@ -69,7 +69,7 @@ class batcache { var $cancel = false; // Change this to cancel the output buffer. Use batcache_cancel(); - var $noskip_cookies = array(); // Names of cookies - if they exist and the cache would normally be bypassed, don't bypass it + var $noskip_cookies = array( 'wordpress_test_cookie' ); // Names of cookies - if they exist and the cache would normally be bypassed, don't bypass it var $cacheable_origin_hostnames = array(); // A whitelist of HTTP origin `:` (or just ``) names that are allowed as cache variations. var $origin = null; // Current Origin header.