User tests: Successful: Unsuccessful:
Pull Request resolves #47609
This PR fixes a regression introduced in Joomla 5.4 where saving an article that has tags creates a duplicate row in the #__ucm_content table on every save.
The fix modifies a query in TagsHelper::postStore() (libraries/src/Helper/TagsHelper.php) to look up existing UCM records directly from the #__ucm_content table instead of the deprecated #__ucm_base table.
In Joomla 5.4, UCM architecture was deprecated and the call to storeUcmBase() was removed from CoreContent::store(). This means articles created after Joomla 5.4 no longer get a row in the #__ucm_base table.
However, TagsHelper::postStore() was still querying #__ucm_base to determine whether an existing #__ucm_content row exists for the article. Since new articles have no entry in #__ucm_base, the query always returns null. TagsHelper interprets this as 'no UCM record exists yet' and inserts a brand new duplicate row into #__ucm_content on every save.
This PR takes a different approach compared to existing PRs for this issue:
Stop querying the deprecated table entirely.
By querying #__ucm_content directly the fix:
(1) Is immune to orphaned #__ucm_base rows.
(2) Does not need to keep #__ucm_base and #__ucm_content in sync.
(3) Aligns with the deprecation roadmap (dropping #__ucm_base in 7.0).
However,
#__ucm_content is a big table with many columns so querying is expensive ( performance wise).
(1) Create an article and assign a tag to it.
(2) Click on save, wait for the page to reload and click on save again.
In the #__ucm_content table, for each click on save, a new entry is created in the table. No entry for the item is generated in #__ucm_base.
A single entry is created in #__ucm_content and for successive saves of the articles the same entry is updated.
No duplicates are created.
Please select:
Documentation link for guide.joomla.org:
No documentation changes for guide.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
| Status | New | ⇒ | Pending |
| Category | ⇒ | Libraries |
@richard67
Yes, but it calls a deprecated function. This is a possible alternate approach that does not use any deprecated functions/architecture.
There is already a PR for the same issue: #47664