<!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" />
<title>[52707] trunk/src/wp-includes: </title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { 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 { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#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>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/52707">52707</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/52707","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>spacedmonkey</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2022-02-11 18:50:08 +0000 (Fri, 11 Feb 2022)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>
Cache: Use wp_cache_*_multiple() in core functions.
Implement the `wp_cache_add_multiple`, `wp_cache_set_multiple` and `wp_cache_delete_multiple` in a number of core functions after they were introduced in <a href="https://core.trac.wordpress.org/changeset/52700">[52700]</a>
Props: spacedmonkey, adamsilverstein, flixos90, mitogh.
Fixes: <a href="https://core.trac.wordpress.org/ticket/55029">#55029</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesclasswpcommentqueryphp">trunk/src/wp-includes/class-wp-comment-query.php</a></li>
<li><a href="#trunksrcwpincludescommentphp">trunk/src/wp-includes/comment.php</a></li>
<li><a href="#trunksrcwpincludesmetaphp">trunk/src/wp-includes/meta.php</a></li>
<li><a href="#trunksrcwpincludesmsnetworkphp">trunk/src/wp-includes/ms-network.php</a></li>
<li><a href="#trunksrcwpincludesmssitephp">trunk/src/wp-includes/ms-site.php</a></li>
<li><a href="#trunksrcwpincludesoptionphp">trunk/src/wp-includes/option.php</a></li>
<li><a href="#trunksrcwpincludespostphp">trunk/src/wp-includes/post.php</a></li>
<li><a href="#trunksrcwpincludestaxonomyphp">trunk/src/wp-includes/taxonomy.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesclasswpcommentqueryphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-comment-query.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-comment-query.php 2022-02-11 18:47:38 UTC (rev 52706)
+++ trunk/src/wp-includes/class-wp-comment-query.php 2022-02-11 18:50:08 UTC (rev 52707)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1058,10 +1058,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $child_ids[] = $level_comment->comment_ID;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $data = array();
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( $parent_map as $parent_id => $children ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $cache_key = "get_comment_child_ids:$parent_id:$key:$last_changed";
- wp_cache_set( $cache_key, $children, 'comment' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $cache_key = "get_comment_child_ids:$parent_id:$key:$last_changed";
+ $data[ $cache_key ] = $children;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp_cache_set_multiple( $data, 'comment' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $level++;
</span></span></pre></div>
<a id="trunksrcwpincludescommentphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/comment.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/comment.php 2022-02-11 18:47:38 UTC (rev 52706)
+++ trunk/src/wp-includes/comment.php 2022-02-11 18:50:08 UTC (rev 52707)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1883,9 +1883,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function _clear_modified_cache_on_transition_comment_status( $new_status, $old_status ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'approved' === $new_status || 'approved' === $old_status ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $data = array();
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( array( 'server', 'gmt', 'blog' ) as $timezone ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp_cache_delete( "lastcommentmodified:$timezone", 'timeinfo' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $data[] = "lastcommentmodified:$timezone";
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp_cache_delete_multiple( $data, 'timeinfo' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2045,9 +2047,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 1 == $comment_approved ) {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_update_comment_count( $comment_post_ID );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $data = array();
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( array( 'server', 'gmt', 'blog' ) as $timezone ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp_cache_delete( "lastcommentmodified:$timezone", 'timeinfo' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $data[] = "lastcommentmodified:$timezone";
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp_cache_delete_multiple( $data, 'timeinfo' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> clean_comment_cache( $id );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3220,9 +3224,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int|array $ids Comment ID or an array of comment IDs to remove from cache.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function clean_comment_cache( $ids ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- foreach ( (array) $ids as $id ) {
- wp_cache_delete( $id, 'comment' );
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $comment_ids = (array) $ids;
+ wp_cache_delete_multiple( $comment_ids, 'comment' );
+ foreach ( $comment_ids as $id ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Fires immediately after a comment has been removed from the object cache.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3250,9 +3254,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param bool $update_meta_cache Whether to update commentmeta cache. Default true.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function update_comment_cache( $comments, $update_meta_cache = true ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $data = array();
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( (array) $comments as $comment ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp_cache_add( $comment->comment_ID, $comment, 'comment' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $data[ $comment->comment_ID ] = $comment;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp_cache_add_multiple( $data, 'comment' );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $update_meta_cache ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // Avoid `wp_list_pluck()` in case `$comments` is passed by reference.
</span></span></pre></div>
<a id="trunksrcwpincludesmetaphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/meta.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/meta.php 2022-02-11 18:47:38 UTC (rev 52706)
+++ trunk/src/wp-includes/meta.php 2022-02-11 18:50:08 UTC (rev 52707)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -496,12 +496,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $delete_all ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- foreach ( (array) $object_ids as $o_id ) {
- wp_cache_delete( $o_id, $meta_type . '_meta' );
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $data = (array) $object_ids;
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp_cache_delete( $object_id, $meta_type . '_meta' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $data = array( $object_id );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp_cache_delete_multiple( $data, $meta_type . '_meta' );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Fires immediately after deleting metadata of a specific type.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1191,12 +1190,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $data = array();
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( $non_cached_ids as $id ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! isset( $cache[ $id ] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $cache[ $id ] = array();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp_cache_add( $id, $cache[ $id ], $cache_key );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $data[ $id ] = $cache[ $id ];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp_cache_add_multiple( $data, $cache_key );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return $cache;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcwpincludesmsnetworkphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/ms-network.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/ms-network.php 2022-02-11 18:47:38 UTC (rev 52706)
+++ trunk/src/wp-includes/ms-network.php 2022-02-11 18:50:08 UTC (rev 52707)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -82,9 +82,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- foreach ( (array) $ids as $id ) {
- wp_cache_delete( $id, 'networks' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $network_ids = (array) $ids;
+ wp_cache_delete_multiple( $network_ids, 'networks' );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ foreach ( $network_ids as $id ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Fires immediately after a network has been removed from the object cache.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -110,9 +111,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $networks Array of network row objects.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function update_network_cache( $networks ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $data = array();
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( (array) $networks as $network ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp_cache_add( $network->id, $network, 'networks' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $data[ $network->id ] = $network;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp_cache_add_multiple( $data, 'networks' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span></span></pre></div>
<a id="trunksrcwpincludesmssitephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/ms-site.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/ms-site.php 2022-02-11 18:47:38 UTC (rev 52706)
+++ trunk/src/wp-includes/ms-site.php 2022-02-11 18:50:08 UTC (rev 52707)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -371,12 +371,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! $sites ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $site_ids = array();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $site_ids = array();
+ $site_data = array();
+ $blog_details_data = array();
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( $sites as $site ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $site_ids[] = $site->blog_id;
- wp_cache_add( $site->blog_id, $site, 'sites' );
- wp_cache_add( $site->blog_id . 'short', $site, 'blog-details' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $site_ids[] = $site->blog_id;
+ $site_data[ $site->blog_id ] = $site;
+ $blog_details_data[ $site->blog_id . 'short' ] = $site;
+
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp_cache_add_multiple( $site_data, 'sites' );
+ wp_cache_add_multiple( $blog_details_data, 'blog-details' );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $update_meta_cache ) {
</span><span class="cx" style="display: block; padding: 0 10px"> update_sitemeta_cache( $site_ids );
</span></span></pre></div>
<a id="trunksrcwpincludesoptionphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/option.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/option.php 2022-02-11 18:47:38 UTC (rev 52706)
+++ trunk/src/wp-includes/option.php 2022-02-11 18:50:08 UTC (rev 52707)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -344,13 +344,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $core_options_in = "'" . implode( "', '", $core_options ) . "'";
</span><span class="cx" style="display: block; padding: 0 10px"> $options = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $wpdb->sitemeta WHERE meta_key IN ($core_options_in) AND site_id = %d", $network_id ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $data = array();
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( $options as $option ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $key = $option->meta_key;
</span><span class="cx" style="display: block; padding: 0 10px"> $cache_key = "{$network_id}:$key";
</span><span class="cx" style="display: block; padding: 0 10px"> $option->meta_value = maybe_unserialize( $option->meta_value );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp_cache_set( $cache_key, $option->meta_value, 'site-options' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $data[ $cache_key ] = $option->meta_value;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp_cache_set_multiple( $data, 'site-options' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span></span></pre></div>
<a id="trunksrcwpincludespostphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/post.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/post.php 2022-02-11 18:47:38 UTC (rev 52706)
+++ trunk/src/wp-includes/post.php 2022-02-11 18:50:08 UTC (rev 52707)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -7368,9 +7368,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $data = array();
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( $posts as $post ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp_cache_add( $post->ID, $post, 'posts' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $data[ $post->ID ] = $post;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp_cache_add_multiple( $data, 'posts' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span></span></pre></div>
<a id="trunksrcwpincludestaxonomyphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/taxonomy.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/taxonomy.php 2022-02-11 18:47:38 UTC (rev 52706)
+++ trunk/src/wp-includes/taxonomy.php 2022-02-11 18:50:08 UTC (rev 52707)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3512,10 +3512,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $taxonomies = get_object_taxonomies( $object_type );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- foreach ( $object_ids as $id ) {
- foreach ( $taxonomies as $taxonomy ) {
- wp_cache_delete( $id, "{$taxonomy}_relationships" );
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ foreach ( $taxonomies as $taxonomy ) {
+ wp_cache_delete_multiple( $object_ids, "{$taxonomy}_relationships" );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> wp_cache_delete( 'last_changed', 'terms' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3567,18 +3565,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( (array) $terms as $term ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $taxonomies[] = $term->taxonomy;
</span><span class="cx" style="display: block; padding: 0 10px"> $ids[] = $term->term_id;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp_cache_delete( $term->term_id, 'terms' );
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp_cache_delete_multiple( $ids, 'terms' );
</ins><span class="cx" style="display: block; padding: 0 10px"> $taxonomies = array_unique( $taxonomies );
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp_cache_delete_multiple( $ids, 'terms' );
</ins><span class="cx" style="display: block; padding: 0 10px"> $taxonomies = array( $taxonomy );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- foreach ( $taxonomies as $taxonomy ) {
- foreach ( $ids as $id ) {
- wp_cache_delete( $id, 'terms' );
- }
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $taxonomies as $taxonomy ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3752,11 +3744,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $cache_values = array();
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( $object_terms as $id => $value ) {
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $value as $taxonomy => $terms ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp_cache_add( $id, $terms, "{$taxonomy}_relationships" );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $cache_values[ $taxonomy ][ $id ] = $terms;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ foreach ( $cache_values as $taxonomy => $data ) {
+ wp_cache_add_multiple( $data, "{$taxonomy}_relationships" );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3768,6 +3764,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $taxonomy Not used.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function update_term_cache( $terms, $taxonomy = '' ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $data = array();
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( (array) $terms as $term ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // Create a copy in case the array was passed by reference.
</span><span class="cx" style="display: block; padding: 0 10px"> $_term = clone $term;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3775,8 +3772,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Object ID should not be cached.
</span><span class="cx" style="display: block; padding: 0 10px"> unset( $_term->object_id );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp_cache_add( $term->term_id, $_term, 'terms' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $data[ $term->term_id ] = $_term;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp_cache_add_multiple( $data, 'terms' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> //
</span></span></pre>
</div>
</div>
</body>
</html>