Changeset 5592 for trunk/wp-includes/post.php
- Timestamp:
- 05/29/2007 04:52:31 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post.php
r5586 r5592 231 231 232 232 $query = "SELECT DISTINCT * FROM $wpdb->posts "; 233 $query .= empty( $category ) ? '' : ", $wpdb-> post2cat";233 $query .= empty( $category ) ? '' : ", $wpdb->term_relationships, $wpdb->term_taxonomy "; 234 234 $query .= empty( $meta_key ) ? '' : ", $wpdb->postmeta "; 235 235 $query .= " WHERE 1=1 "; … … 237 237 $query .= empty( $post_status ) ? '' : "AND post_status = '$post_status' "; 238 238 $query .= "$exclusions $inclusions " ; 239 $query .= empty( $category ) ? '' : "AND ($wpdb->posts.ID = $wpdb-> post2cat.post_id AND $wpdb->post2cat.category_id = " . $category. ") ";239 $query .= empty( $category ) ? '' : "AND ($wpdb->posts.ID = $wpdb->term_relationships.object_id AND $wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id AND $wpdb->term_taxonomy.term_id = " . $category. ") "; 240 240 $query .= empty( $post_parent ) ? '' : "AND $wpdb->posts.post_parent = '$post_parent' "; 241 241 $query .= empty( $meta_key ) | empty($meta_value) ? '' : " AND ($wpdb->posts.ID = $wpdb->postmeta.post_id AND $wpdb->postmeta.meta_key = '$meta_key' AND $wpdb->postmeta.meta_value = '$meta_value' )"; … … 1696 1696 1697 1697 function update_post_category_cache($post_ids) { 1698 global $wpdb, $ category_cache, $tag_cache, $blog_id;1698 global $wpdb, $term_cache, $blog_id; 1699 1699 // TODO 1700 1700 return; … … 1709 1709 for ( $i = 0; $i < $count; $i++ ) { 1710 1710 $post_id = (int) $post_id_array[ $i ]; 1711 if ( isset( $ category_cache[$blog_id][$post_id] ) ) {1711 if ( isset( $term_cache[$blog_id][$post_id] ) ) { 1712 1712 unset( $post_id_array[ $i ] ); 1713 1713 continue; … … 1716 1716 if ( count( $post_id_array ) == 0 ) 1717 1717 return; 1718 $post_id_list = join( ',', $post_id_array ); // with already cached stuff removed 1719 1720 $dogs = $wpdb->get_results("SELECT post_id, category_id, rel_type FROM $wpdb->post2cat WHERE post_id IN ($post_id_list)"); 1718 1719 $dogs = get_object_terms($post_id_array, array('category', 'post_tag')); 1721 1720 1722 1721 if ( empty($dogs) ) … … 1724 1723 1725 1724 foreach ($dogs as $catt) { 1726 if ( 'category' == $catt->rel_type ) 1727 $category_cache[$blog_id][$catt->post_id][$catt->category_id] = &get_category($catt->category_id); 1728 elseif ( 'tag' == $catt->rel_type ) 1729 $tag_cache[$blog_id][$catt->post_id][$catt->category_id] = &get_category($catt->category_id); 1725 $term_cache[$blog_id][$catt->post_id][$catt->taxonomy][$catt->category_id] = &get_category($catt->category_id); 1730 1726 } 1731 1727 } 1732 1728 1733 1729 function update_post_caches(&$posts) { 1734 global $post_cache , $category_cache, $post_meta_cache, $tag_cache;1730 global $post_cache; 1735 1731 global $wpdb, $blog_id; 1736 1732
Note: See TracChangeset
for help on using the changeset viewer.