mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
Move plugin installer install_popular_tags() to use a site transient rather than its own caching logic. Fixes #13108
git-svn-id: http://svn.automattic.com/wordpress/trunk@15287 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
47f0da9c17
commit
a7cabc4a3e
@ -65,21 +65,16 @@ function plugins_api($action, $args = null) {
|
|||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function install_popular_tags( $args = array() ) {
|
function install_popular_tags( $args = array() ) {
|
||||||
if ( ! ($cache = wp_cache_get('popular_tags', 'api')) && ! ($cache = get_option('wporg_popular_tags')) )
|
$key = md5(serialize($args));
|
||||||
add_option('wporg_popular_tags', array(), '', 'no'); ///No autoload.
|
if ( false !== ($tags = get_site_transient('poptags_' . $key) ) )
|
||||||
|
return $tags;
|
||||||
if ( $cache && $cache->timeout + 3 * 60 * 60 > time() )
|
|
||||||
return $cache->cached;
|
|
||||||
|
|
||||||
$tags = plugins_api('hot_tags', $args);
|
$tags = plugins_api('hot_tags', $args);
|
||||||
|
|
||||||
if ( is_wp_error($tags) )
|
if ( is_wp_error($tags) )
|
||||||
return $tags;
|
return $tags;
|
||||||
|
|
||||||
$cache = (object) array('timeout' => time(), 'cached' => $tags);
|
set_site_transient('poptags_' . $key, $tags, 10800); // 3 * 60 * 60 = 10800
|
||||||
|
|
||||||
update_option('wporg_popular_tags', $cache);
|
|
||||||
wp_cache_set('popular_tags', $cache, 'api');
|
|
||||||
|
|
||||||
return $tags;
|
return $tags;
|
||||||
}
|
}
|
||||||
|
@ -357,8 +357,7 @@ function populate_options() {
|
|||||||
if ( !__get_option('home') ) update_option('home', $guessurl);
|
if ( !__get_option('home') ) update_option('home', $guessurl);
|
||||||
|
|
||||||
// Delete unused options
|
// Delete unused options
|
||||||
$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',
|
$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');
|
||||||
'page_uris', 'update_core', 'update_plugins', 'update_themes', 'doing_cron', 'random_seed', 'rss_excerpt_length', 'secret', 'use_linksupdate', 'default_comment_status_page' );
|
|
||||||
foreach ( $unusedoptions as $option )
|
foreach ( $unusedoptions as $option )
|
||||||
delete_option($option);
|
delete_option($option);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user