Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method to update lists from JSON files and clear cache #7054

Merged
merged 5 commits into from
Nov 6, 2024

Conversation

Miraeld
Copy link
Contributor

@Miraeld Miraeld commented Oct 23, 2024

  • DynamicLists.php

    • Add update_lists_from_files method to clear transient cache and update lists from JSON files
    • Call remove_lists_cache and get_lists methods from each provider's data manager in update_lists_from_files
  • AbstractDataManager.php

    • Add remove_lists_cache method to delete transient cache
  • Subscriber.php

    • Modify wp_rocket_upgrade callback to call update_lists_from_files method
    • Add update_lists_from_files method to call $this->dynamic_lists->update_lists_from_files()

Description

Fixes #6920
This update modifies the dynamic lists handling, improving the performance and reliability of the feature as the customer won't have to wait a week before getting the new exclusions updated.

Type of change

  • Bug fix (non-breaking change which fixes an issue).

Detailed scenario

Update WP Rocket

Technical description

Documentation

We simply delete the transient cache before fetching the dynamic list from the file within the ZIP archive.

New dependencies

Risks

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.

* **DynamicLists.php**
  - Add `update_lists_from_files` method to clear transient cache and update lists from JSON files
  - Call `remove_lists_cache` and `get_lists` methods from each provider's data manager in `update_lists_from_files`

* **AbstractDataManager.php**
  - Add `remove_lists_cache` method to delete transient cache

* **Subscriber.php**
  - Modify `wp_rocket_upgrade` callback to call `update_lists_from_files` method
  - Add `update_lists_from_files` method to call `$this->dynamic_lists->update_lists_from_files()`
@Miraeld Miraeld requested a review from a team October 23, 2024 03:38
@Miraeld Miraeld self-assigned this Oct 23, 2024
Copy link

codacy-production bot commented Oct 23, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for 10317d71 80.00% (target: 50.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (10317d7) Report Missing Report Missing Report Missing
Head commit (d6685ec) 38130 16703 43.81%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#7054) 10 8 80.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

@Mai-Saad
Copy link
Contributor

Copy link

@hanna-meda hanna-meda left a comment

Choose a reason for hiding this comment

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

@Miraeld, @wordpressfan, thank you.
All looks good on test env with this PR.
Related Test Plan Report here:
testrail-report-658.pdf

@hanna-meda hanna-meda added this pull request to the merge queue Nov 6, 2024
Merged via the queue into develop with commit e5bca66 Nov 6, 2024
13 checks passed
@hanna-meda hanna-meda deleted the enhancement/6920-dynamic-list-on-update branch November 6, 2024 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clear dynamic lists on WP Rocket update
5 participants