Changeset 16137
- Timestamp:
- 11/01/2010 05:53:03 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/class-wp-ms-sites-list-table.php
r16128 r16137 32 32 $s = isset( $_REQUEST['s'] ) ? stripslashes( trim( $_REQUEST[ 's' ] ) ) : ''; 33 33 $like_s = esc_sql( like_escape( $s ) ); 34 35 $large_network = false; 36 // If the network is large and a search is not being performed, show only the latest blogs with no paging in order 37 // to avoid expensive count queries. 38 if ( !$s && ( get_blog_count() >= 10000 ) ) { 39 if ( !isset($_REQUEST['orderby']) ) 40 $_GET['orderby'] = $_REQUEST['orderby'] = 'registered'; 41 if ( !isset($_REQUEST['order']) ) 42 $_GET['order'] = $_REQUEST['order'] = 'DESC'; 43 $large_network = true; 44 } 34 45 35 46 $query = "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' "; … … 64 75 $query .= $order; 65 76 66 $total = $wpdb->get_var( str_replace( 'SELECT *', 'SELECT COUNT( blog_id )', $query ) ); 77 // Don't do an unbounded count on large networks 78 if ( ! $large_network ) 79 $total = $wpdb->get_var( str_replace( 'SELECT *', 'SELECT COUNT( blog_id )', $query ) ); 67 80 68 81 $query .= " LIMIT " . intval( ( $pagenum - 1 ) * $per_page ) . ", " . intval( $per_page ); 69 82 $this->items = $wpdb->get_results( $query, ARRAY_A ); 83 84 if ( $large_network ) 85 $total = count($this->items); 70 86 71 87 $this->set_pagination_args( array(
Note: See TracChangeset
for help on using the changeset viewer.