Make WordPress Core


Ignore:
Timestamp:
06/19/2010 07:28:27 AM (14 years ago)
Author:
dd32
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/plugin-install.php

    r14985 r15287  
    6666 */
    6767function install_popular_tags( $args = array() ) {
    68     if ( ! ($cache = wp_cache_get('popular_tags', 'api')) && ! ($cache = get_option('wporg_popular_tags')) )
    69         add_option('wporg_popular_tags', array(), '', 'no'); ///No autoload.
    70 
    71     if ( $cache && $cache->timeout + 3 * 60 * 60 > time() )
    72         return $cache->cached;
     68    $key = md5(serialize($args));
     69    if ( false !== ($tags = get_site_transient('poptags_' . $key) ) )
     70        return $tags;
    7371
    7472    $tags = plugins_api('hot_tags', $args);
     
    7775        return $tags;
    7876
    79     $cache = (object) array('timeout' => time(), 'cached' => $tags);
    80 
    81     update_option('wporg_popular_tags', $cache);
    82     wp_cache_set('popular_tags', $cache, 'api');
     77    set_site_transient('poptags_' . $key, $tags, 10800); // 3 * 60 * 60 = 10800
    8378
    8479    return $tags;
Note: See TracChangeset for help on using the changeset viewer.