[wp-trac] [WordPress Trac] #14485: Taxonomy hierarchy cache isn't properly refreshed
WordPress Trac
noreply at wordpress.org
Wed Feb 5 14:43:42 UTC 2014
#14485: Taxonomy hierarchy cache isn't properly refreshed
-----------------------------------------------+------------------
Reporter: thealien | Owner:
Type: defect (bug) | Status: new
Priority: high | Milestone: 3.9
Component: Cache API | Version: 3.0
Severity: normal | Resolution:
Keywords: needs-unit-tests has-patch commit | Focuses:
-----------------------------------------------+------------------
Changes (by wonderboymusic):
* keywords: needs-testing needs-unit-tests needs-patch needs-refresh =>
needs-unit-tests has-patch commit
* milestone: Future Release => 3.9
Comment:
This almost melted my brain.
[attachment:14485.diff 14485.diff] fixes this by piggybacking on the patch
from #22526. The `"{$taxonomy}_children"`option has to the be in sync with
`wp_cache_get( 'last_changed', $taxonomy );`. This is accomplished by also
setting `wp_cache_set( 'hierarchy_last_changed', $last_changed, $taxonomy
);`.
Introduces `taxonomy_hierarchy_is_fresh( $taxonomy )`.
By doing this, we only need to check `taxonomy_hierarchy_is_fresh()` in
`_get_term_hierarchy()` before setting `$children`.
Added some unit tests. Bugs like these make me want to work on nothing but
Cache, there are probably other problems like these in the wild.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/14485#comment:76>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list