[wp-trac] [WordPress Trac] #36949: Term exists should use get_terms internally
WordPress Trac
noreply at wordpress.org
Fri Feb 18 12:39:43 UTC 2022
#36949: Term exists should use get_terms internally
-------------------------------------------------+-------------------------
Reporter: spacedmonkey | Owner:
| spacedmonkey
Type: enhancement | Status: assigned
Priority: normal | Milestone: 6.0
Component: Taxonomy | Version: 2.3
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests needs-dev- | Focuses:
note commit | performance
-------------------------------------------------+-------------------------
Changes (by spacedmonkey):
* keywords: has-patch has-unit-tests close => has-patch has-unit-tests
needs-dev-note commit
Comment:
I understand the concerns that @boonebgorges has raised and originally I
agreed with them. But after working on #54511 and spending 4+ hours
reviewing of the taxonomy code to ensure that caches are invalidates, I am
confident that this change will not breaking change. The fact that in
earlier version of this patch, only 5 tests fail, prove that to me. three
of breakages, were tests where raw sql queries were run in tests and the
correct `clean_term_cache` calls were not added. This is a case should /
would not happen in the wild, as performing raw queries without clearing
caching after, will result in invalid / corrupted caches anyway.
As for importer, there is a pretty clever workaround using `cache_domains`
in the patch. But again, imports are a special case. The importer
[https://github.com/WordPress/wordpress-
importer/blob/0003f2398ae9a3df8f7a070bb4c318c9c4c4f84f/src/class-wp-
import.php#L85-L90 suspends cache invalidation], see this results in the
test failures. Which is a very special case.
I have added the keywords, needs-dev-note. There is a small chance their
might be breakages in custom migration / importer tools or code that does
custom sql queries. The fix is simple, either implement
`clean_term_cache` function calls in the correct place or do a full object
cache flush or simply. I will provide examples in the dev note.
This sound reasonable @flixos90 ?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36949#comment:22>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list