Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#30749 closed defect (bug) (fixed)

get_term() is missing cache in some cases

Reported by: boonebgorges's profile boonebgorges Owned by: boonebgorges's profile boonebgorges
Milestone: 4.1 Priority: normal
Severity: blocker Version:
Component: Taxonomy Keywords: has-patch fixed-major
Focuses: Cc:

Description

As reported in https://wordpress.org/support/topic/tagcloud-widget-categories-significant-sql-query-increase?replies=2. On sites with large numbers of categories, both tag cloud and category widgets are missing the cache when building markup (via get_term_link() -> get_term()). My bisect tools are telling me that this dates from [29915]; see #21760. The changes related to #21760 were supposed to have been reverted in [30900], but it appears that something was missed there. I'm investigating.

Attachments (2)

30749.patch (1.3 KB) - added by boonebgorges 10 years ago.
30749.2.patch (3.8 KB) - added by boonebgorges 10 years ago.

Download all attachments as: .zip

Change History (11)

This ticket was mentioned in Slack in #core by boone. View the logs.


10 years ago

@boonebgorges
10 years ago

#2 @boonebgorges
10 years ago

  • Keywords has-patch added

30749.patch fixes the issue. As I suspected, I missed something when cleaning up #21760 [30900] - get_terms() must update the cache for the term objects that it locates. I've added a unit test to make sure this doesn't happen again.

This ticket was mentioned in Slack in #core by boone. View the logs.


10 years ago

#4 @boonebgorges
10 years ago

30749.2.patch adds unit tests for the other cache-setting parts that were touched in [30900]. Everything is passing as expected.

This ticket was mentioned in Slack in #core by boone. View the logs.


10 years ago

#6 @boonebgorges
10 years ago

  • Owner set to boonebgorges
  • Resolution set to fixed
  • Status changed from new to closed

In 30954:

Update individual term caches in get_terms().

This was removed in [29915] as part of the attempt to add cache support to
get_term_by(). When that support was removed in [30900], it was not properly
restored.

This changeset includes a unit test to verify that the cache is properly primed
for terms found in get_terms(), as well as tests to verify the other cache
setting that was touched by [30900].

Fixes #30749. See #21760.

#7 @boonebgorges
10 years ago

  • Keywords fixed-major added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening for the 4.1 branch.

#8 @nacin
10 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 30959:

Update individual term caches in get_terms().

Merges [30954] to the 4.1 branch.

props boonebgorges.
fixes #30749. see #21760.

This ticket was mentioned in Slack in #core by johnbillion. View the logs.


10 years ago

Note: See TracTickets for help on using tickets.