[6.x] Fix deleted terms reappearing after clearing the Stache - #15426
Open
duncanmcclean wants to merge 1 commit into
Open
[6.x] Fix deleted terms reappearing after clearing the Stache#15426duncanmcclean wants to merge 1 commit into
duncanmcclean wants to merge 1 commit into
Conversation
`TaxonomyTermsStore::getItem` overrides `BasicStore::getItem` without syncing the term's original state, so `UpdateTermReferences` saw a null original slug on deletion and left the term's references in entries. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XzL1xhLTSn6kRxAi7UTcm8
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.
This pull request fixes an issue where deleting a taxonomy term would leave its slug behind in any entries referencing it, so the term would reappear as a "ghost" the next time the Stache was rebuilt.
This was happening because the
UpdateTermReferenceslistener relies ongetOriginal('slug')to know which slug to strip from entries, butTaxonomyTermsStore::getItemnever calledsyncOriginal()on the terms it returned. Every other store gets this fromBasicStore::getItem, but the terms store overrides that method (to support terms which only exist in entry data) and #5502 removed the sync it previously had inmakeItemFromFile. As a result, any term fetched from the Stache, which is every term deleted via the Control Panel, had anulloriginal slug and the listener bailed before touching any entries. Terms which only exist in entry data were never synced at all, so deleting them has never worked.This PR fixes it by syncing the original state in
TaxonomyTermsStore::getItem, mirroringBasicStore. Renaming a term outside the Control Panel (which #11058 patched separately) now also cleans up the old term and its references.Fixes #11264
Caused by #5502
Related: #11058