Ticket #18464: 18464.diff
| File 18464.diff, 3.4 KB (added by , 15 years ago) |
|---|
-
wp-admin/includes/ms.php
775 775 <?php 776 776 } 777 777 778 /** 779 * Whether or not we have a large network 780 * 781 * @since 3.3.0 782 * @param string $using sites/users 783 */ 784 function wp_is_large_network( $using = 'sites' ) { 785 if ( 'users' == $using ) { 786 $count = get_user_count(); 787 return apply_filters( 'wp_is_large_network', $count > 10000, 'users', $count ); 788 } 789 790 $count = get_blog_count(); 791 return apply_filters( 'wp_is_large_network', $count > 10000, 'sites', $count ); 792 } 778 793 ?> -
wp-admin/includes/class-wp-ms-sites-list-table.php
37 37 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 51 49 $query = "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' "; … … 104 102 } 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 110 108 $query .= " LIMIT " . intval( ( $pagenum - 1 ) * $per_page ) . ", " . intval( $per_page ); 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 116 114 $this->set_pagination_args( array( … … 127 125 $actions = array(); 128 126 if ( current_user_can( 'delete_sites' ) ) 129 127 $actions['delete'] = __( 'Delete' ); 128 if ( current_user_can( 'promote_users' ) ) 129 $actions['addusers'] = __( 'Add existing user' ); 130 130 $actions['spam'] = _x( 'Mark as Spam', 'site' ); 131 131 $actions['notspam'] = _x( 'Not Spam', 'site' ); 132 132 -
wp-admin/includes/class-wp-ms-users-list-table.php
32 32 'fields' => 'all_with_meta' 33 33 ); 34 34 35 $args['search'] = ltrim($args['search'], '*'); 35 if ( wp_is_large_network( 'users' ) ) 36 $args['search'] = ltrim( $args['search'], '*' ); 37 else 38 $args['search'] = '*' . $args['search'] . '*'; 36 39 37 40 if ( $role == 'super' ) { 38 41 $logins = implode( "', '", get_super_admins() ); … … 41 44 42 45 // If the network is large and a search is not being performed, show only the latest users with no paging in order 43 46 // to avoid expensive count queries. 44 if ( !$usersearch && ( get_blog_count() >= 10000) ) {47 if ( !$usersearch && wp_is_large_network( 'users' ) ) { 45 48 if ( !isset($_REQUEST['orderby']) ) 46 49 $_GET['orderby'] = $_REQUEST['orderby'] = 'id'; 47 50 if ( !isset($_REQUEST['order']) )