refactor: extract DEFAULT_REJECTED_COOKIES constant and rename create_cache_server

This commit is contained in:
2026-09-13 17:21:36 +02:00
parent 94eea83d60
commit 22230d188b
6 changed files with 18 additions and 49 deletions
+2 -8
View File
@@ -23,7 +23,7 @@ class WP_Recache_Admin {
// New exclusions must not leave stale files that the drop-in would still serve.
add_action('update_option_wp_recache_exclude_urls', 'wp_recache_delete_all_cache');
add_action('update_option_wp_recache_rejected_cookies', function () {
WP_Recache_Activator::create_cache_server();
WP_Recache_Activator::write_cookie_bypass_script();
wp_recache_delete_all_cache();
});
}
@@ -66,13 +66,7 @@ class WP_Recache_Admin {
register_setting('wp_recache_settings', 'wp_recache_rejected_cookies', [
'type' => 'array',
'sanitize_callback' => [$this, 'sanitize_rejected_cookies'],
'default' => [
'woocommerce_items_in_cart',
'wp_woocommerce_session_*',
'wp-postpass',
'comment_author_*',
'wordpress_*',
],
'default' => WP_RECACHE_DEFAULT_REJECTED_COOKIES,
]);
register_setting('wp_recache_settings', 'wp_recache_minify_css', [
+1 -7
View File
@@ -55,13 +55,7 @@ $stats = WP_Recache_Admin::get_cache_stats();
<tr>
<th scope="row">Rejected Cookies</th>
<td>
<textarea name="wp_recache_rejected_cookies" rows="5" cols="50" class="large-text"><?php echo esc_textarea(implode("\n", get_option('wp_recache_rejected_cookies', [
'woocommerce_items_in_cart',
'wp_woocommerce_session_*',
'wp-postpass',
'comment_author_*',
'wordpress_*',
]))); ?></textarea>
<textarea name="wp_recache_rejected_cookies" rows="5" cols="50" class="large-text"><?php echo esc_textarea(implode("\n", get_option('wp_recache_rejected_cookies', WP_RECACHE_DEFAULT_REJECTED_COOKIES))); ?></textarea>
<p class="description">One cookie name per line. Visitors with these cookies bypass the cache. Use <code>*</code> as a suffix to match a prefix (e.g. <code>comment_author_*</code>).</p>
</td>
</tr>