diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-10-24 13:37:10 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-10-24 13:37:10 +0000 |
commit | a1149064b86eac35bcead169cc34b0c2a3bb9c93 (patch) | |
tree | 94b4c9668129c48029f0c285afa9ae6af966d3c9 /wp-includes/taxonomy.php | |
parent | d0b9489c96a012dfab70136e0fe7953a7d019c04 (diff) | |
download | wordpress-mu-a1149064b86eac35bcead169cc34b0c2a3bb9c93.tar.gz wordpress-mu-a1149064b86eac35bcead169cc34b0c2a3bb9c93.tar.xz wordpress-mu-a1149064b86eac35bcead169cc34b0c2a3bb9c93.zip |
WP Merge to revision 6287
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1130 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/taxonomy.php')
-rw-r--r-- | wp-includes/taxonomy.php | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 5c60ad4..fb40b2e 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -1431,15 +1431,7 @@ function clean_term_cache($ids, $taxonomy = '') { * @return bool|array Empty array if $terms found, but not $taxonomy. False if nothing is in cache for $taxonomy and $id. */ function &get_object_term_cache($id, $taxonomy) { - $terms = wp_cache_get($id, 'object_terms'); - if ( false !== $terms ) { - if ( isset($terms[$taxonomy]) ) - return $terms[$taxonomy]; - else - return array(); - } - - return false; + return wp_cache_get($id, "{$taxonomy}_relationships"); } /** @@ -1467,28 +1459,42 @@ function update_object_term_cache($object_ids, $object_type) { $object_ids = array_map('intval', $object_ids); + $taxonomies = get_object_taxonomies($object_type); + $ids = array(); foreach ( (array) $object_ids as $id ) { - if ( false === wp_cache_get($id, 'object_terms') ) - $ids[] = $id; + foreach ( $taxonomies as $taxonomy ) { + if ( false === wp_cache_get($id, "{$taxonomy}_relationships") ) { + $ids[] = $id; + break; + } + } } if ( empty( $ids ) ) return false; - $terms = wp_get_object_terms($ids, get_object_taxonomies($object_type), 'fields=all_with_object_id'); + $terms = wp_get_object_terms($ids, $taxonomies, 'fields=all_with_object_id'); $object_terms = array(); foreach ( (array) $terms as $term ) $object_terms[$term->object_id][$term->taxonomy][$term->term_id] = $term; foreach ( $ids as $id ) { - if ( ! isset($object_terms[$id]) ) - $object_terms[$id] = array(); + foreach ( $taxonomies as $taxonomy ) { + if ( ! isset($object_terms[$id][$taxonomy]) ) { + if ( !isset($object_terms[$id]) ) + $object_terms[$id] = array(); + $object_terms[$id][$taxonomy] = array(); + } + } } - foreach ( $object_terms as $id => $value ) - wp_cache_set($id, $value, 'object_terms'); + foreach ( $object_terms as $id => $value ) { + foreach ( $value as $taxonomy => $terms ) { + wp_cache_set($id, $terms, "{$taxonomy}_relationships"); + } + } } /** |