Fix #2698: Replace parent post purge with child post purge #7613
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request is ment to solve issue #2698
This pull request fixes a critical bug where purging a parent page's cache would unintentionally clear the cache for all of its descendant pages. It also ensures the _wpr_rocket_cache database table is correctly and fully updated, especially when page slugs are modified within a hierarchy.
Type of change
Detailed scenario
What was tested
Describe the scenarios that you tested, and specify if it is automated or manual. For manual scenarios, provide a screenshot of the results.
How to test
Describe how the PR can be tested so that the validator can be autonomous: environment, dependencies, specific setup, steps to perform, API requests, etc.
Technical description
Documentation
Problem
The previous implementation purged parent pages when a post was updated. This led to several issues:
Solution
The logic has been inverted: instead of purging parent pages, the process now explicitly targets all affected child pages.
This change ensures that only the intended cache files are removed and that each purged URL is explicitly processed, guaranteeing that the _wpr_rocket_cache table is always kept in sync with the actual state of the cache.
New dependencies
List any new dependencies that are required for this change.
Risks
List possible performance & security issues or risks, and explain how they have been mitigated.
Mandatory Checklist
Code validation
Code style
Unticked items justification
If some mandatory items are not relevant, explain why in this section.
Additional Checks