Changeset 3919
- Timestamp:
- 09/01/2016 08:47:41 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-performance-optimizations.php
r3916 r3919 16 16 // Query simplification. 17 17 add_filter( 'bbp_after_has_topics_parse_args', array( $this, 'has_topics' ) ); 18 add_filter( 'bbp_after_has_replies_parse_args', array( $this, 'has_replies' ) ); 18 19 add_filter( 'bbp_register_view_no_replies', array( $this, 'no_replies' ) ); 19 20 } … … 33 34 */ 34 35 public function has_topics( $r ) { 36 /** 37 * Feeds 38 */ 39 if ( is_feed() ) { 40 $r['no_found_rows'] = true; 41 add_filter( 'posts_where', array( $this, 'posts_in_last_month' ) ); 42 } 43 35 44 /** 36 45 * Filter queries so they are not sorted by the post meta value of … … 70 79 } 71 80 81 public function has_replies( $r ) { 82 if ( is_feed() ) { 83 $r['no_found_rows'] = true; 84 add_filter( 'posts_where', array( $this, 'posts_in_last_month' ) ); 85 } 86 return $r; 87 } 88 72 89 public function no_replies( $r ) { 73 90 $r['post_parent__not_in'] = array( Plugin::THEMES_FORUM_ID, Plugin::PLUGINS_FORUM_ID, Plugin::REVIEWS_FORUM_ID ); 74 91 return $r; 92 } 93 94 public function posts_in_last_month( $w ) { 95 global $wpdb; 96 97 $bound_id = $this->get_bound_id( '1 MONTH' ); 98 $w .= $wpdb->prepare( " AND ( $wpdb->posts.ID >= %d )", $bound_id ); 99 return $w; 75 100 } 76 101
Note: See TracChangeset
for help on using the changeset viewer.