Closed (fixed)
Project:
Drupal core
Version:
10.1.x-dev
Component:
taxonomy.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
6 Feb 2020 at 22:17 UTC
Updated:
3 Dec 2022 at 07:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
longwaveComment #3
longwaveComment #4
andypostImo itvwas better to reopen #2785693: Follow up #2543726: @todo deleteTermHierarchy and updateTermHierarchy as there's todo pointing there, just need to check if there other todo refs to the issue
Comment #5
longwavePointing to the issue where the methods were to be deleted doesn't help a developer trying to find why they have been deleted, I thought it best to point to the change record instead.
Comment #6
catchDiscussed with xjm, since this wasn't actually marked as deprecated via either @deprecated or trigger_error(), and there are still usages (even if no-op), it seems better to deprecate in 9.x for removal in 10.x at this point. Also these are just cruft rather than having a specific maintenance cost.
So... moving to 9.1.x, but it would be good to have an RTBC patch ready to go so it doesn't get forgotten again. I think everything is ready to go here except the version numbers.
Comment #7
andypostFixed it, meantime https://www.drupal.org/node/2936675 references 8.6.0
Comment #8
berdirThere are two/one calls to it left in searchable contrib: http://grep.xnddx.ru/search?text=deleteTermHierarchy / http://grep.xnddx.ru/search?text=updateTermHierarchy.
Feels a bit strange to deprecate them when the calls to them are actually broken already, usually we do deprecation tests to make sure that deprecated API's still work, but there's nothing left here that could possibly work.
IMHO a clear error is preferable to things silently not working :)
Comment #9
catchAren't they a no-op rather than broken though? The thing you want to do happens, just not because you called the methods.
If they actually would cause bugs in contrib modules calling the methods, then agree it's better to get rid of them but that didn't seem to be the case.
Comment #10
berdirThey used to save term parent information. The only reason to call them directly is to _only_ save that information, without saving the term too.
If you look at http://grep.xnddx.ru/node/29580503#line-151 for example, or http://grep.xnddx.ru/node/29410221#line-391, the only two usages that were found, then they don't save the term, which IMHO means that the logic there is now broken?
Comment #11
catchSo if you look at Term::postDelete():
https://api.drupal.org/api/drupal/core%21modules%21taxonomy%21src%21Enti...
When a term is deleted, it loads all the children of that term, updates the parent information, then resaves them.
This is what http://grep.xnddx.ru/node/29580503#line-151 is trying to do manually. So for that example I think it's just redundant/no-op code but still working.
acquia_commercemanager (http://grep.xnddx.ru/node/29410221#line-391) is also saving the parent term for the children that it's trying to break relationships for, but I can't really tell what the intention actually is there from a quick look.
Back to 8.x while we figure this out properly.
Comment #12
andypostProbably message just needs to be appended with "no-op since 8.6.0"
Comment #13
xjmAt this point, we'll need to deprecate this in 9.1.x instead (for removal in D10).
Comment #14
longwaveUpdated the deprecation message in the method itself. It feels like it doesn't make sense to add information about a no-op to the interface, as that is not the interface's responsibility.
Comment #15
andypostIt's ready
Comment #16
xjmInteteresting/efficient choice to use
__METHOD__. I haven't seen this but we do it in 52 places in 8.8 (out of 901@trigger_error()(many of which are not methods obviously; I didn't dig deeper than that). I wondered if it might fail a phpcs rule that did not take into account this possible format, but it looks like there isn't one enabled in the core ruleset (at least yet). The patch passes. So that's fine.However, we still haven't addressed #8 - #11. We should at least file issues in those two project's queues, but that doesn't address custom code that might also be calling this. Unsilencing a deprecation is disruptive so I'm loathe to do that at almost-RC for something that's a no-op, but it needs discussion.
I debated whether to separate the proper deprecation from the error so these don't sit around until Drupal 11. I'll ask @catch what he thinks also.
Comment #17
xjmOK, discussed with @catch. Let's get three followups filed (two for the contrib projects, one for core to figure out how to address the lack-of-error generally) and then commit this patch as-is to 9.1.x so at least we have a clean deprecation as soon as possible.
Comment #18
xjmFor the core followup, it looks like I raised concerns along the same line as @Berdir's and my feedback was not taken into account (Wim kind of missed the point). Everyone on that issue was focused on the REST bugfix and ignored the implications for Taxonomy itself. Things I said then include:
Comment #23
alexpottWe need to update the deprecation message to be 10.1.0 for 11 now.
I think we can split the difference between an error and a silenced deprecation by unsilencing the deprecation.
Comment #26
spokjeRerolled patch #14 for 10.1.x.
Unsure how to deal with this:
, so I blatantly ignored it for now.
Comment #27
andypostThank you, is it backportable to 10.0.1?
Comment #28
spokjeI'm a bit unsure if we are allowed to introduce new deprecations in 10.0.1.
But the plain diff of the MR applies cleanly to the 10.0.x branch, so technically I think we could.
Let's await the verdict of the core committers :)
Comment #30
catchI think we would have been better off committing the silenced deprecation three years ago than trying to figure out how to do an error and not getting the issue in.
Have gone ahead and committed it with @trigger_error(), we can change that to trigger_error() (not @) in a follow-up if we want to, but also deprecation testing and phpstan have moved on a lot since this was last discussed.
Committed/pushed to 10.1.x, thanks!
Don't think we can/should backport this to 10.0.x since it'll potentially introduce new deprecation failures for modules that have just been ported to 10.0
Comment #31
spokje@catch, thanks for clearing up the silenced (@) mystery, I went looking all over the place for a deprecation that was code-wise suppressed or something similar.
Reading is hard already, understanding what you read turns out to be even harder...
Comment #33
quietone commentedThis is tagged for followups, see #16 - #18.
My searches found usages of updateTermHierarchy and/or deleteTermHierarchy in the following projects:
Noting them here so anyone can make the issues. I am not able to do it now.
Comment #34
spokjeTBH I believe that warning contrib about core changes was maybe something we did in 2020, when #16 -18 were posted, and not so much what we do nowadays?
Anyway:
Comment #35
quietone commented@Spokje, Thank you for making the follow ups, despite your reservations.