Repository navigation
Refactor: simplify sitemap services and cache invalidation - #1
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Note
Medium Risk
Changes sitemap routing, 404 behavior for inactive languages, and cache invalidation paths that affect public XML output; PHP 8.1+ is now required.
Overview
Release 1.1.0 refactors the plugin around a small injected service graph in
Plugin(Url_Helper,Router,Sitemap_Cache,Rank_Math_Overrides,Index_Expander) and drops the separateLanguage_Context,Sitemap_Availability, andTransient_Versionsclasses. Static helpers become instance services; activation/deactivation flow throughPlugin::on_activation()/on_deactivation().Sitemap routing and languages:
Routernow owns request-time language setup (moved fromLanguage_Context), registers rewrite rules for all Polylang languages—including inactive Pro languages—so prefixed sitemap URLs setrm_sitemap_langand can 404 instead of serving the default language.Url_Helperadds URI-based language detection when the query var is missing.Index and cache: Per-language index availability probing lives in
Index_Expander::has_urlset_for_language(); results are cached viaSitemap_Cache(availability transients + version bumps merged into one class). Language term edits trigger a full cache clear, rewrite re-registration, and flush so inactive languages drop out of the index.Platform: Minimum PHP 8.1 (Composer/dev tooling updated accordingly). Tests follow the instance APIs and add coverage for cache transient keys and request URI language detection.
Reviewed by Cursor Bugbot for commit 6407dd0. Bugbot is set up for automated code reviews on this repo. Configure here.