Skip to content

Conversation

@Jeroen-1978
Copy link

Add support for query parameters in file entries.

Description

Fixes #6130

This pull request fixes a bug where purging a page's that has a query string instead of a fancy url would unintentionally clear the cache for the whole site. With this fix we also ensures that the _wpr_rocket_cache database table is correctly and fully updated

Type of change

  • New feature (non-breaking change which adds functionality).
  • Bug fix (non-breaking change which fixes an issue).
  • Enhancement (non-breaking change which improves an existing functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as before).
  • Sub-task of #(issue number)
  • Chore
  • Release

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

When clearing an entry from \wp-content\cache\wp-rocket{domain} the query string wasn't taken in consideration.

If a page has the query string from the root, this resulted in a complete wipe of all the folders. With including the query string -when used- this problem is solved.

When $url contains several arguments, every & is replaced with #.

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

  • I validated all the Acceptance Criteria. If possible, provide screenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • [] I implemented built-in tests to cover the new/changed code.

Code style

  • I wrote a self-explanatory code about what it does.
  • I protected entry points against unexpected inputs.
  • I did not introduce unnecessary complexity.
  • Output messages (errors, notices, logs) are explicit enough for users to understand the issue and are actionnable.

Unticked items justification

If some mandatory items are not relevant, explain why in this section.

Additional Checks

  • In the case of complex code, I wrote comments to explain it.
  • When possible, I prepared ways to observe the implemented system (logs, data, etc.).
  • I added error handling logic when using functions that could throw errors (HTTP/API request, filesystem, etc.)

Copilot AI review requested due to automatic review settings September 8, 2025 14:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request fixes a bug where clearing cache for pages with query parameters would unintentionally clear the entire site cache instead of just the specific page. The fix adds proper handling of query strings by including them in the file entry path with appropriate formatting.

  • Adds query parameter handling to file entry construction in cache clearing functionality
  • Prevents full site cache clearing when purging pages with query strings
  • Formats query parameters by replacing '&' characters with '#' for file path compatibility

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Jeroen-1978 Jeroen-1978 changed the title Fixe #6130 : Enhance file entry handling with query support Fix #6130 : Enhance file entry handling with query support Sep 8, 2025
Jeroen-1978 and others added 2 commits December 1, 2025 14:28
Add support for query parameters in file entries.
@Jeroen-1978 Jeroen-1978 force-pushed the fix/6130-include-query-string-when-clearing-cache branch from dc3788e to 3f8c9cf Compare December 1, 2025 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rocket_clean_files() incorrectly triggers a full cache purge when the URL contains query strings

1 participant