Ticket #21595: 21595.diff
File 21595.diff, 1.6 KB (added by , 13 years ago) |
---|
-
wp-includes/ms-functions.php
152 152 * 153 153 * @param int $blog_id ID of the blog. 154 154 * @param int $post_id ID of the post you're looking for. 155 * @return object The post.155 * @return WP_Post The post. 156 156 */ 157 157 function get_blog_post( $blog_id, $post_id ) { 158 global $wpdb; 158 switch_to_blog( $blog_id ); 159 $post = get_post( $post_id ); 160 restore_current_blog(); 159 161 160 $key = $blog_id . '-' . $post_id;161 $post = wp_cache_get( $key, 'global-posts' );162 if ( $post == false ) {163 $post = $wpdb->get_row( $wpdb->prepare( 'SELECT * FROM ' . $wpdb->get_blog_prefix( $blog_id ) . 'posts WHERE ID = %d', $post_id ) );164 wp_cache_add( $key, $post, 'global-posts' );165 }166 167 162 return $post; 168 163 } 169 164 … … 313 308 * 314 309 * @since MU 1.0 315 310 * 316 * @param int $ _blog_id ID of the source blog.311 * @param int $blog_id ID of the source blog. 317 312 * @param int $post_id ID of the desired post. 318 313 * @return string The post's permalink 319 314 */ 320 function get_blog_permalink( $_blog_id, $post_id ) { 321 $key = "{$_blog_id}-{$post_id}-blog_permalink"; 322 $link = wp_cache_get( $key, 'site-options' ); 323 if ( $link == false ) { 324 switch_to_blog( $_blog_id ); 325 $link = get_permalink( $post_id ); 326 restore_current_blog(); 327 wp_cache_add( $key, $link, 'site-options', 360 ); 328 } 315 function get_blog_permalink( $blog_id, $post_id ) { 316 switch_to_blog( $blog_id ); 317 $link = get_permalink( $post_id ); 318 restore_current_blog(); 319 329 320 return $link; 330 321 } 331 322