Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#13108 closed defect (bug) (fixed)

install_popular_tags() should use a transient

Reported by: dd32 Owned by:
Milestone: 3.1 Priority: normal
Severity: normal Version: 3.0
Component: Optimization Keywords: needs-patch
Focuses: Cc:


install_popular_tags() should use a site transient, at present, this is the function:

function install_popular_tags( $args = array() ) {
	if ( ! ($cache = wp_cache_get('popular_tags', 'api')) && ! ($cache = get_option('wporg_popular_tags')) )
		add_option('wporg_popular_tags', array(), '', 'no'); ///No autoload.

	if ( $cache && $cache->timeout + 3 * 60 * 60 > time() )
		return $cache->cached;

	$tags = plugins_api('hot_tags', $args);

	if ( is_wp_error($tags) )
		return $tags;

	$cache = (object) array('timeout' => time(), 'cached' => $tags);

	update_option('wporg_popular_tags', $cache);
	wp_cache_set('popular_tags', $cache, 'api');

	return $tags;

Change History (3)

comment:1 @dd325 years ago

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

(In [15287]) Move plugin installer install_popular_tags() to use a site transient rather than its own caching logic. Fixes #13108

comment:2 @dd325 years ago

I realise i missed updating the DB version to cause that option to be removed. I'll leave it as-is for now and let it expire with the next db upgrade.

comment:3 @nacin5 years ago

  • Milestone changed from Awaiting Triage to 3.1
Note: See TracTickets for help on using tickets.