Closed (fixed)
Project:
Drupal core
Version:
9.3.x-dev
Component:
taxonomy.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
11 Mar 2019 at 08:07 UTC
Updated:
16 Jul 2021 at 16:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
claudiu.cristeaPatch.
Comment #3
claudiu.cristeaOuch!
Comment #4
jibranThis makes sense to me.
Comment #5
alexpotterror: core/modules/taxonomy/tests/src/Functional/VocabularyCrudTest.php: does not exist in indexComment #6
alexpottThe return here is not correct. We should still continue with the original behaviour even though it is pointless. Deprecations should by and large not change behaviour.
I don't get why we both checking for the existence of the vocabulary. We don't save a query because a non-existent vocab will need a query to work out it doesn't exist and if we only did:
We'd still get an empty array and the
taxonomy_term_datatable has a key on vid so the query will be quick if it doesn't exist.Comment #7
pguillard commentedI made the changes on points #6.1 and #6.2 (even if I'm not sure about point 2).
The patch has also been rerolled, as VocabularyCrudTest has been moved from Functional to Kernel test.
Comment #8
pguillard commentedComment #9
yogeshmpawarComment #12
hardik_patel_12 commentedChanging deprecation message from Drupal 8.8.0 and will be removed before Drupal 9.0.0 to Drupal 9.1.0 and will be removed before Drupal 10.0.0.
Comment #15
longwaveSorry but the deprecation needs updating again.
Comment #16
claudiu.cristea@alexpott, I disagree with #6.1 because there's no replacement for this deprecation. The only thing we need, if
taxonomy_vocabulary_get_namesis passed, is to trigger the deprecation message. Here we're not replacing a procedural function with a service. However, it doesn't hurt, just that conceptually I think it's not quite OK.Comment #18
claudiu.cristea$this->expectDeprecation() instead of annotation.if(...)fromdrupal_static_reset()into aswitch() {...}anticipating other deprecations.Comment #19
longwaveRTBC for these changes, +1 to using a switch in
drupal_static_reset.I think all the legacy code in the argument validator plugins can be removed, I can't see how it can ever work, but that's for a followup (or an issue might already exist).
Comment #20
longwaveOpened #3220647: Remove "legacy vids" handling from taxonomy Views plugins as followup
Comment #21
xjmBig fan of this issue. This is a thing I wanted cleaned up as a subsystem maintainer for Taxonomy (but the whole release management thing got in the way). A few nitpicks and a couple questions:
We're at 9.3 now.
Also, we normally avoid contractions in core text (so "There is" rather than "There's").
Hmm, is it safe to just rip out this method implementation?
Ditto on updating this to say 9.3.
What's happening to this code path? Does this case have test coverage?
This test coverage should maybe be moved to a legacy test?
Finally, I think the CR should also mention the bit about the static cache.
Thanks for working on this!
Comment #22
claudiu.cristea#21.1, 3: Fixed.
#21.2: Why wouldn't be? Keeping
drupal_static_reset('taxonomy_vocabulary_get_names');there would trigger the deprecation message. If we remove then, there's only the call to the parent.#21.4: Added a test for the whole procedural function. However, that function is only used in tests. Shouldn't we deprecate it in this issue too?
#21.5: Moved the coverage in legacy test.
#21.6: Fixed.
Comment #23
catchMakes sense to me to deprecate
taxonomy_term_load_multiple_by_name()here as well.Comment #24
claudiu.cristeaOK, deprecated also
taxonomy_term_load_multiple_by_name(). Note that I've moved thetaxonomy_term_load_multiple_by_name()coverage in deprecation/legacy test. Anyway, the test was wrongly a functional test. It should have been kernel test.Comment #25
claudiu.cristeaComment #26
claudiu.cristeaGoing to the rest of procedural functions from taxonomy.module:
taxonomy_implode_tags(): Not used anywhere, not even in tests.taxonomy_term_title(): Just a wrapper around$term->getName(), which is a wrapper around$term->label().taxonomy_terms_static_reset(): Wraps\Drupal::entityTypeManager()->getStorage('taxonomy_term')->resetCache();.taxonomy_vocabulary_static_reset(): Wraps\Drupal::entityTypeManager()->getStorage('taxonomy_vocabulary')->resetCache($ids).Any clue if it's appropriate to deprecate them in this step?
Comment #27
catch@claudiu.cristea if they don't have usages (or just one or two), then it makes sense to me to deprecate them in one issue - it's unlikely to conflict with other patches, a single change record will make things easier to find etc.
Comment #28
claudiu.cristeaUpdated title, IS and CR as per #23 and #27.
Comment #29
claudiu.cristeaFixed the test and remarks from @Berdir.
Comment #30
claudiu.cristeaAddressed @catch remarks.
Comment #31
daffie commentedWe are using the MR in this issue.
Comment #32
tim.plunkettThat "legacy" code in the Views handlers was removed from core in #1552396: Convert vocabularies into configuration but accidentally reintroduced in #1850792-26: Make init() method consistent across all views plugins. Because of that isset() check, it has been dead code this entire time, and the whole
init()method can be removed in both cases.Comment #33
xjmRe: #32, I believe @tim.plunkett is referring to @longwave's comment here.
I think cleaning that up could be a followup issue? Since replacing the prodedural functions with entity API calls are 1:1 changes, but removing dead code in views handlers is a different logical scope.
Comment #35
tim.plunkettI opened a follow-up here: #3221149: Remove dead code in Taxonomy's Views handlers
With that out of the way, the rest of the patch seems fine. Thanks!
Comment #36
xjmNW for the above point about the scope creep of rewriting the legacy test vs. the original one. They should be kept as similar as possible. Thanks!
Comment #37
claudiu.cristeaComment #38
tim.plunkettThanks @claudiu.cristea, the test changes are so much more straightforward now. I like that you kept the new test additions too.
Comment #39
alexpottI think that #3221149: Remove dead code in Taxonomy's Views handlers should land before this patch. It removes all runtime usages of taxonomy_term_load_multiple_by_name() except for taxonomy_term_load_multiple_by_name() (which itself is only called by test code) and makes the performance impact of this patch non-existent. If this patch lands first it will result in additional queries because we're calling
\Drupal::entityQuery('taxonomy_vocabulary')->execute();instead oftaxonomy_vocabulary_get_names(). The old code implements a static cache whereas entity queries are uncached and results in additional queries to the config table.Comment #40
xjmThis issue is RTBC. That one is not. Either is easy to reroll. Therefore, since I think this is also committable, I'm going to go ahead and commit this despite #39.
Comment #42
xjmCommitted to 9.3.x and published the CR. Thanks!
@pguillard, in the future, please include interdiffs when updating patches. (For merge requests, they are not needed.) Thanks!