<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[15287] trunk/wp-admin/includes: Move plugin installer install_popular_tags
() to use a site transient rather than its own caching logic.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/15287">15287</a></dd>
<dt>Author</dt> <dd>dd32</dd>
<dt>Date</dt> <dd>2010-06-19 07:28:27 +0000 (Sat, 19 Jun 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Move plugin installer install_popular_tags() to use a site transient rather than its own caching logic. Fixes <a href="http://trac.wordpress.org/ticket/13108">#13108</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesplugininstallphp">trunk/wp-admin/includes/plugin-install.php</a></li>
<li><a href="#trunkwpadminincludesschemaphp">trunk/wp-admin/includes/schema.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesplugininstallphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/plugin-install.php (15286 => 15287)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/plugin-install.php        2010-06-19 07:05:23 UTC (rev 15286)
+++ trunk/wp-admin/includes/plugin-install.php        2010-06-19 07:28:27 UTC (rev 15287)
</span><span class="lines">@@ -65,22 +65,17 @@
</span><span class="cx"> * @return array
</span><span class="cx"> */
</span><span class="cx"> function install_popular_tags( $args = array() ) {
</span><del>-        if ( ! ($cache = wp_cache_get('popular_tags', 'api')) && ! ($cache = get_option('wporg_popular_tags')) )
-                add_option('wporg_popular_tags', array(), '', 'no'); ///No autoload.
</del><ins>+        $key = md5(serialize($args));
+        if ( false !== ($tags = get_site_transient('poptags_' . $key) ) )
+                return $tags;
</ins><span class="cx">
</span><del>-        if ( $cache && $cache->timeout + 3 * 60 * 60 > time() )
-                return $cache->cached;
-
</del><span class="cx">         $tags = plugins_api('hot_tags', $args);
</span><span class="cx">
</span><span class="cx">         if ( is_wp_error($tags) )
</span><span class="cx">                 return $tags;
</span><span class="cx">
</span><del>-        $cache = (object) array('timeout' => time(), 'cached' => $tags);
</del><ins>+        set_site_transient('poptags_' . $key, $tags, 10800); // 3 * 60 * 60 = 10800
</ins><span class="cx">
</span><del>-        update_option('wporg_popular_tags', $cache);
-        wp_cache_set('popular_tags', $cache, 'api');
-
</del><span class="cx">         return $tags;
</span><span class="cx"> }
</span><span class="cx"> add_action('install_plugins_search', 'install_search', 10, 1);
</span></span></pre></div>
<a id="trunkwpadminincludesschemaphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/schema.php (15286 => 15287)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/schema.php        2010-06-19 07:05:23 UTC (rev 15286)
+++ trunk/wp-admin/includes/schema.php        2010-06-19 07:28:27 UTC (rev 15287)
</span><span class="lines">@@ -357,9 +357,8 @@
</span><span class="cx">         if ( !__get_option('home') ) update_option('home', $guessurl);
</span><span class="cx">
</span><span class="cx">         // Delete unused options
</span><del>-        $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' );
-        foreach ($unusedoptions as $option)
</del><ins>+        $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');
+        foreach ( $unusedoptions as $option )
</ins><span class="cx">                 delete_option($option);
</span><span class="cx">
</span><span class="cx">         // delete obsolete magpie stuff
</span></span></pre>
</div>
</div>
</body>
</html>