Delete UCM content entries when Joomla articles are deleted#13584
Delete UCM content entries when Joomla articles are deleted#13584roland-d wants to merge 2 commits intojoomla:stagingfrom
Conversation
libraries/cms/helper/tags.php
Outdated
| */ | ||
| $ucmContentTable = JTable::getInstance('Corecontent'); | ||
|
|
||
| $delete = $ucmContentTable->deleteByContentId($itemId, $this->typeAlias); |
There was a problem hiding this comment.
Currently you're only going to get the result of the last item. This should cascade over all items you are deleting
|
Why do we have an array here? It seems kinda weird? |
|
@wilsonge that is because an array is passed to this function. That is because you can select multiple items to be deleted at once. |
|
tested successfully on postgresql |
|
unable to mark successfull test on issue tracker This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13584. |
|
Successfully tested. Related #__ucm_content deleted after emptying the article trash. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13584. |
|
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13584. |
|
I still don't understand how this is getting an array. The call stack should look something like:
I don't understand why we have an array for a single item? |
|
The method is documented to receive an integer. Anything calling it with an array is Doing It Wrong™. |
|
OK So our problem is this https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/table/table.php#L942 - So this is always an array - but so we support multi-key tables. I don't think ucm content supports the concept of a multikey special table. So what we need to do is grab the array here. Check it only has one value. If it does use that. If it doesn't, throw and |
|
@mbabker I should change it further upstream then because Joomla is sending an array to this function. @wilsonge since there is always an array are you saying we should throw that exception? As we can delete more than one item at once we should just loop through this array. Whatever we do it should be fixed, it's a real mess now. |
|
It works now because Either way here we have a massive documentation and behavior inconsistency and taking B/C into consideration since the behavior is documented now to expect an integer that needs to continue working until 4.0 at a minimum. If this patch is going to go through, the API MUST document the array behavior too; we already suck at documenting our API or how to use the code, let's not add more magical boxes please. |
|
Try this #13592 |
|
Closing in favor of #13592 |
Pull Request for Issue #8770 .
Summary of Changes
Deleting an article doesn't remove the article from the ucm_content table because an array is sent while an integer is expected. This pull request fixes this.
Testing Instructions
Documentation Changes Required
None