Ticket #15170: 15170.2.diff
File 15170.2.diff, 1.7 KB (added by , 14 years ago) |
---|
-
wp-admin/includes/list-table-sites.php
32 32 $s = isset( $_REQUEST['s'] ) ? stripslashes( trim( $_REQUEST[ 's' ] ) ) : ''; 33 33 $like_s = esc_sql( like_escape( $s ) ); 34 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 } 45 35 46 $query = "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' "; 36 47 37 48 if ( isset( $_REQUEST['searchaction'] ) ) { … … 63 74 $order = ( isset( $_REQUEST['order'] ) && 'DESC' == strtoupper( $_REQUEST['order'] ) ) ? "DESC" : "ASC"; 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 ); 70 83 84 if ( $large_network ) 85 $total = count($this->items); 86 71 87 $this->set_pagination_args( array( 72 88 'total_items' => $total, 73 89 'per_page' => $per_page,