Changeset 5598 for trunk/wp-includes/post.php
- Timestamp:
- 05/30/2007 03:36:59 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/post.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post.php
r5592 r5598 1657 1657 1658 1658 function clean_post_cache($id) { 1659 global $post_cache, $post_meta_cache, $ category_cache, $tag_cache, $blog_id;1659 global $post_cache, $post_meta_cache, $post_term_cache, $blog_id; 1660 1660 1661 1661 if ( isset( $post_cache[$blog_id][$id] ) ) … … 1665 1665 unset( $post_meta_cache[$blog_id][$id] ); 1666 1666 1667 if ( isset( $category_cache[$blog_id][$id]) ) 1668 unset ( $category_cache[$blog_id][$id] ); 1669 1670 if ( isset( $tag_cache[$blog_id][$id]) ) 1671 unset ( $tag_cache[$blog_id][$id] ); 1667 if ( isset( $post_term_cache[$blog_id][$id]) ) 1668 unset ( $post_term_cache[$blog_id][$id] ); 1672 1669 } 1673 1670 … … 1695 1692 } 1696 1693 1697 function update_post_category_cache($post_ids) { 1698 global $wpdb, $term_cache, $blog_id; 1699 // TODO 1700 return; 1694 function &get_post_term_cache($id, $taxonomy) { 1695 global $post_term_cache, $blog_id; 1696 1697 if ( isset($post_term_cache[$blog_id][$id][$taxonomy]) ) 1698 return $post_term_cache[$blog_id][$id][$taxonomy]; 1699 1700 return false; 1701 } 1702 1703 // TODO abstract this to work for any object. 1704 function update_post_term_cache($post_ids) { 1705 global $wpdb, $post_term_cache, $blog_id; 1706 1701 1707 if ( empty($post_ids) ) 1702 1708 return; … … 1709 1715 for ( $i = 0; $i < $count; $i++ ) { 1710 1716 $post_id = (int) $post_id_array[ $i ]; 1711 if ( isset( $ term_cache[$blog_id][$post_id] ) ) {1717 if ( isset( $post_term_cache[$blog_id][$post_id] ) ) { 1712 1718 unset( $post_id_array[ $i ] ); 1713 1719 continue; … … 1717 1723 return; 1718 1724 1719 $ dogs = get_object_terms($post_id_array, array('category', 'post_tag'));1720 1721 if ( empty($ dogs) )1725 $terms = get_object_terms($post_id_array, array('category', 'post_tag'), 'fields=all_with_object_id'); 1726 1727 if ( empty($terms) ) 1722 1728 return; 1723 1729 1724 foreach ($dogs as $catt) { 1725 $term_cache[$blog_id][$catt->post_id][$catt->taxonomy][$catt->category_id] = &get_category($catt->category_id); 1730 foreach ( $terms as $term ) 1731 $post_term_cache[$blog_id][$term->object_id][$term->taxonomy][$term->term_id] = $term; 1732 1733 foreach ( $post_id_array as $id ) { 1734 if ( ! isset($post_term_cache[$blog_id][$id]) ) { 1735 $post_term_cache[$blog_id][$id]['category'] = array(); 1736 $post_term_cache[$blog_id][$id]['post_tag'] = array(); 1737 } 1726 1738 } 1727 1739 } … … 1743 1755 $post_id_list = implode(',', $post_id_array); 1744 1756 1745 update_post_ category_cache($post_id_list);1757 update_post_term_cache($post_id_list); 1746 1758 1747 1759 update_postmeta_cache($post_id_list);
Note: See TracChangeset
for help on using the changeset viewer.