Changeset 18871
- Timestamp:
- 10/03/2011 04:30:07 PM (13 years ago)
- Location:
- trunk/wp-admin/includes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/class-wp-ms-sites-list-table.php
r18562 r18871 38 38 $like_s = esc_sql( like_escape( $s ) ); 39 39 40 $large_network = false;41 40 // If the network is large and a search is not being performed, show only the latest blogs with no paging in order 42 41 // to avoid expensive count queries. 43 if ( !$s && ( get_blog_count() >= 10000) ) {42 if ( !$s && wp_is_large_network() ) { 44 43 if ( !isset($_REQUEST['orderby']) ) 45 44 $_GET['orderby'] = $_REQUEST['orderby'] = ''; 46 45 if ( !isset($_REQUEST['order']) ) 47 46 $_GET['order'] = $_REQUEST['order'] = 'DESC'; 48 $large_network = true;49 47 } 50 48 … … 105 103 106 104 // Don't do an unbounded count on large networks 107 if ( ! $large_network)105 if ( ! wp_is_large_network() ) 108 106 $total = $wpdb->get_var( str_replace( 'SELECT *', 'SELECT COUNT( blog_id )', $query ) ); 109 107 … … 111 109 $this->items = $wpdb->get_results( $query, ARRAY_A ); 112 110 113 if ( $large_network)111 if ( wp_is_large_network() ) 114 112 $total = count($this->items); 115 113 -
trunk/wp-admin/includes/class-wp-ms-users-list-table.php
r18562 r18871 33 33 ); 34 34 35 $args['search'] = ltrim($args['search'], '*'); 35 if ( wp_is_large_network( 'users' ) ) 36 $args['search'] = ltrim( $args['search'], '*' ); 36 37 37 38 if ( $role == 'super' ) { … … 42 43 // If the network is large and a search is not being performed, show only the latest users with no paging in order 43 44 // to avoid expensive count queries. 44 if ( !$usersearch && ( get_blog_count() >= 10000) ) {45 if ( !$usersearch && wp_is_large_network( 'users' ) ) { 45 46 if ( !isset($_REQUEST['orderby']) ) 46 47 $_GET['orderby'] = $_REQUEST['orderby'] = 'id'; -
trunk/wp-admin/includes/ms.php
r18504 r18871 776 776 } 777 777 778 /** 779 * Whether or not we have a large network. 780 * 781 * The default criteria for a large network is either more than 10,000 users or more than 10,000 sites. 782 * Plugins can alter this criteria using the 'wp_is_large_network' filter. 783 * 784 * @since 3.3.0 785 * @param string $using 'sites or 'users'. Default is 'sites'. 786 * @return bool True if the network meets the criteria for large. False otherwise. 787 */ 788 function wp_is_large_network( $using = 'sites' ) { 789 if ( 'users' == $using ) { 790 $count = get_user_count(); 791 return apply_filters( 'wp_is_large_network', $count > 10000, 'users', $count ); 792 } 793 794 $count = get_blog_count(); 795 return apply_filters( 'wp_is_large_network', $count > 10000, 'sites', $count ); 796 } 778 797 ?>
Note: See TracChangeset
for help on using the changeset viewer.