Add Cloudflare edge cache support with purging via cache tags #455
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.
Summary
Closes: #449
This pull request introduces comprehensive support for managing Cloudflare edge cache within the plugin, including cache purging, configuration options, and WP-CLI integration. The changes add a new Cloudflare settings tab in the admin UI, implement backend logic for purging cache by tag, URL, or entirely, and provide WP-CLI commands for advanced cache management. Additionally, the plugin's metadata and dependencies are updated to reflect Cloudflare support.
Cloudflare Integration and Cache Management
Cloudflare_Client
class toincludes/class-cloudflare-client.php
that wraps the Cloudflare API, providing methods to purge cache by tags, URLs, or entirely, and to manage "Cache Everything" page rules.admin/class-nginx-helper-admin.php
), including support for purging all cache, purging by URL from the admin bar, and handling page rule setup and notifications. [1] [2] [3] [4] [5] [6]Admin UI Enhancements
admin/partials/easycache-cloudflare-options.php
), allowing admins to configure API tokens, zone IDs, and cache TTL, with support for saving and validating these settings. [1] [2] [3]WP-CLI Support
includes/class-cli.php
) to purge Cloudflare cache by tag, path, or entirely, with confirmation prompts and output messages for each action.Composer and Project Metadata Updates
composer.json
to add the Cloudflare SDK as a dependency, reflect the new Cloudflare functionality in the description and keywords, and configure Composer plugin settings. [1] [2]Documentation
README.md
for Cloudflare cache purging inspiration and architecture.Coding Standards
.editorconfig
file to enforce consistent coding standards across editors and IDEs.