Use wp_cache_add() instead of wp_cache_set() when priming the object term cache in update_object_term_cache(). Pass the real post_type to clean_object_term_cache() instead of hard-coding post. Call clean_object_term_cache() from clean_bookmark_cache(). Props leewillis77. fixes #19690

git-svn-id: http://svn.automattic.com/wordpress/trunk@19729 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2012-01-11 21:26:18 +00:00
parent ed8c96636c
commit 4cf5450a81
3 changed files with 7 additions and 4 deletions

View File

@ -375,7 +375,8 @@ function sanitize_bookmark_field($field, $value, $bookmark_id, $context) {
* @since 2.7.0
* @uses wp_cache_delete() Deletes the contents of 'get_bookmarks'
*/
function clean_bookmark_cache($bookmark_id) {
function clean_bookmark_cache( $bookmark_id ) {
wp_cache_delete( $bookmark_id, 'bookmark' );
wp_cache_delete( 'get_bookmarks', 'bookmark' );
clean_object_term_cache( $bookmark_id, 'link');
}

View File

@ -4330,10 +4330,12 @@ function clean_post_cache($id) {
if ( 0 === $id )
return;
$post = get_post( $id );
wp_cache_delete($id, 'posts');
wp_cache_delete($id, 'post_meta');
clean_object_term_cache($id, 'post');
clean_object_term_cache( $id, $post->post_type );
wp_cache_delete( 'wp_get_archives', 'general' );

View File

@ -2657,7 +2657,7 @@ function update_object_term_cache($object_ids, $object_type) {
$object_terms[$term->object_id][$term->taxonomy][$term->term_id] = $term;
foreach ( $ids as $id ) {
foreach ( $taxonomies as $taxonomy ) {
foreach ( $taxonomies as $taxonomy ) {
if ( ! isset($object_terms[$id][$taxonomy]) ) {
if ( !isset($object_terms[$id]) )
$object_terms[$id] = array();
@ -2668,7 +2668,7 @@ function update_object_term_cache($object_ids, $object_type) {
foreach ( $object_terms as $id => $value ) {
foreach ( $value as $taxonomy => $terms ) {
wp_cache_set($id, $terms, "{$taxonomy}_relationships");
wp_cache_add( $id, $terms, "{$taxonomy}_relationships" );
}
}
}