Automattic / Automattic/wp-super-cache

On comment: too much stuff is deleted

Open
#932 2 comments 0 reactions 0 assignees View on GitHub
[Plugin] Super Cache enhancement
Dominant language
PHP
Stars
436
Forks
130
Avg merge
15h 11m
Merged PRs (30d)
10

Description

Hello, using WP 4.7.3, WPSC 1.4.9

The problem is similar to Automattic/wp-super-cache#169 but now its happening when commenting (not when updating/posting).
ALL the cache is deleted when someone posts a comment. I have used the filter wpsc_delete_related_pages_on_edit to return 0, to disable deleting homepage and other pages. But that only works for post updates. Not for comments?

I have uncommented the prune_super_cache function, and replaced it by a debug message, because else the log would be deleted every time... Here a snippet from my log:

10:55:25 27836 /wp-comments-post.php wp_cache_post_change: not deleting all pages.
10:55:25 27836 /wp-comments-post.php wp_cache_post_change: not deleting front static page.
10:55:25 27836 /wp-comments-post.php wp_cache_post_change: checking /httpdocs/wp-content/cache/blogs/blog/meta/
10:55:25 27836 /wp-comments-post.php wp_cache_post_change: Already processed post 90323.
10:55:25 27836 /wp-comments-post.php DEBUG: prune_super_cache ( /httpdocs/wp-content/cache/.htaccess, 1, )
10:55:25 27836 /wp-comments-post.php gc: could not delete /httpdocs/wp-content/cache/.htaccess as it's protected.
10:55:25 27836 /wp-comments-post.php DEBUG: prune_super_cache ( /httpdocs/wp-content/cache/blogs, 1, )
10:55:25 27836 /wp-comments-post.php gc: could not delete /httpdocs/wp-content/cache/blogs as it's not empty: index.html
10:55:25 27836 /wp-comments-post.php DEBUG: prune_super_cache ( /httpdocs/wp-content/cache/index.html, 1, )
10:55:25 27836 /wp-comments-post.php gc: could not delete /httpdocs/wp-content/cache/index.html as it's protected.
10:55:25 27836 /wp-comments-post.php DEBUG: prune_super_cache ( /httpdocs/wp-content/cache/xxxxx.txt, 1, )
10:55:25 27836 /wp-comments-post.php DEBUG: prune_super_cache ( /httpdocs/wp-content/cache/supercache, 1, )
10:55:25 27836 /wp-comments-post.php gc: could not delete /httpdocs/wp-content/cache/supercache as it's protected.
10:55:25 27836 /wp-comments-post.php Post 90323 changed. Update cache.
10:55:25 27836 /wp-comments-post.php wp_cache_post_change: Already processed post 90323.
10:55:25 27836 /wp-comments-post.php Not caching POST request.
10:55:25 27836 /wp-comments-post.php wp_cache_maybe_dynamic: returned $buffer

Is there a reason this is happening?

Any help appreciated.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the wp-comments-post.php flow and the wp_cache_post_change entry point, then compare it with post-update handling of the wpsc_delete_related_pages_on_edit filter. Trace the prune_super_cache calls shown in the log and reproduce with WordPress 4.7.3 and WPSC 1.4.9. Done means commenting no longer removes unrelated cache pages when the filter disables that behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
backend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.