fix: address Phase 1 code review findings
- Serve cache via template_redirect so feeds/404/REST are excluded and query conditionals work - Bypass cache on query strings; key files by md5(host+path) to avoid collisions and support multisite - Write wp-content/wp-recache-cache.php drop-in server and set WP_CACHE in wp-config.php so advanced-cache.php actually runs - Only remove advanced-cache.php on deactivation when it is ours - Respect DONOTCACHEPAGE, non-200 responses; bots read but never warm cache - Fix comment purge (comment_post_ID) and heartbeat purge ($data arg) - Fix exclude URLs textarea parsing; purge all when exclusions change - Enqueue admin purge script on every admin-bar page, not just settings - Sync tests, add TESTING.md manual test guide
This commit is contained in:
@@ -14,20 +14,38 @@ class WP_Recache_Deactivator {
|
||||
*/
|
||||
public static function deactivate() {
|
||||
self::remove_advanced_cache();
|
||||
self::remove_cache_server();
|
||||
WP_Recache_Activator::set_wp_cache_constant(false);
|
||||
self::flush_rewrite_rules();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove advanced-cache.php drop-in.
|
||||
* Remove advanced-cache.php drop-in, but only if it is ours.
|
||||
*/
|
||||
private static function remove_advanced_cache() {
|
||||
$advanced_cache = WP_CONTENT_DIR . '/advanced-cache.php';
|
||||
|
||||
if (file_exists($advanced_cache)) {
|
||||
if (!file_exists($advanced_cache)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$content = file_get_contents($advanced_cache);
|
||||
if (strpos($content, 'WP Recache') !== false) {
|
||||
unlink($advanced_cache);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the standalone cache server.
|
||||
*/
|
||||
private static function remove_cache_server() {
|
||||
$server = WP_CONTENT_DIR . '/wp-recache-cache.php';
|
||||
|
||||
if (file_exists($server)) {
|
||||
unlink($server);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush rewrite rules.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user