WordPress.org

Make WordPress Core

Changeset 15287


Ignore:
Timestamp:
06/19/10 07:28:27 (5 years ago)
Author:
dd32
Message:

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

Location:
trunk/wp-admin/includes
Files:
2 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; 
  • trunk/wp-admin/includes/schema.php

    r15238 r15287  
    358358 
    359359    // Delete unused options 
    360     $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins', 'can_compress_scripts', 
    361         'page_uris', 'update_core', 'update_plugins', 'update_themes', 'doing_cron', 'random_seed', 'rss_excerpt_length', 'secret', 'use_linksupdate', 'default_comment_status_page' ); 
    362     foreach ($unusedoptions as $option) 
     360    $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins', 'can_compress_scripts', 'page_uris', 'update_core', 'update_plugins', 'update_themes', 'doing_cron', 'random_seed', 'rss_excerpt_length', 'secret', 'use_linksupdate', 'default_comment_status_page', 'wporg_popular_tags'); 
     361    foreach ( $unusedoptions as $option ) 
    363362        delete_option($option); 
    364363 
Note: See TracChangeset for help on using the changeset viewer.