Ticket #15170: 15170.diff
File 15170.diff, 3.9 KB (added by , 15 years ago) |
---|
-
wp-includes/ms-default-filters.php
39 39 add_action( 'private_to_published', 'wpmu_update_blogs_date' ); 40 40 add_action( 'publish_phone', 'wpmu_update_blogs_date' ); 41 41 add_action( 'publish_post', 'wpmu_update_blogs_date' ); 42 add_action( 'admin_init', 'wp_schedule_update_checks'); 43 add_action( 'update_network_counts', 'wp_update_network_counts'); 42 44 43 45 // Files 44 46 add_filter( 'wp_upload_bits', 'upload_is_file_too_big' ); … … 57 59 add_filter( 'enable_edit_any_user_configuration', '__return_false' ); 58 60 add_filter( 'force_filtered_html_on_import', '__return_true' ); 59 61 60 61 62 // WP_HOME and WP_SITEURL should not have any effect in MS 62 63 remove_filter( 'option_siteurl', '_config_wp_siteurl' ); 63 64 remove_filter( 'option_home', '_config_wp_home' ); -
wp-includes/ms-functions.php
157 157 * @return int 158 158 */ 159 159 function get_user_count() { 160 global $wpdb; 161 162 $count_ts = get_site_option( 'user_count_ts' ); 163 if ( time() - $count_ts > 3600 ) { 164 $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(ID) as c FROM $wpdb->users WHERE spam = '0' AND deleted = '0'") ); 165 update_site_option( 'user_count', $count ); 166 update_site_option( 'user_count_ts', time() ); 167 } 168 169 $count = get_site_option( 'user_count' ); 170 171 return $count; 160 return get_site_option( 'user_count' ); 172 161 } 173 162 174 163 /** … … 184 173 * @return int 185 174 */ 186 175 function get_blog_count( $id = 0 ) { 187 global $wpdb; 188 189 if ( $id == 0 ) 190 $id = $wpdb->siteid; 191 192 $count_ts = get_site_option( 'blog_count_ts' ); 193 if ( time() - $count_ts > 3600 ) { 194 $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(blog_id) as c FROM $wpdb->blogs WHERE site_id = %d AND spam = '0' AND deleted = '0' and archived = '0'", $id) ); 195 update_site_option( 'blog_count', $count ); 196 update_site_option( 'blog_count_ts', time() ); 197 } 198 199 $count = get_site_option( 'blog_count' ); 200 201 return $count; 176 return get_site_option( 'blog_count' ); 202 177 } 203 178 204 179 /** … … 1533 1508 return $url; 1534 1509 } 1535 1510 1511 /** 1512 * Schedule update of the network-wide counts for the current network. 1513 * 1514 * @since 3.1.0 1515 */ 1516 function wp_schedule_update_network_counts() { 1517 if ( !is_main_site() ) 1518 return; 1519 1520 if ( !wp_next_scheduled('update_network_counts') && !defined('WP_INSTALLING') ) 1521 wp_schedule_event(time(), 'twicedaily', 'update_network_counts'); 1522 } 1523 1524 /** 1525 * Update the network-wide counts for the current network. 1526 * 1527 * @since 3.1.0 1528 */ 1529 function wp_update_network_counts() { 1530 global $wpdb; 1531 1532 $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(blog_id) as c FROM $wpdb->blogs WHERE site_id = %d AND spam = '0' AND deleted = '0' and archived = '0'", $wpdb->siteid) ); 1533 update_site_option( 'blog_count', $count ); 1534 1535 $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(ID) as c FROM $wpdb->users WHERE spam = '0' AND deleted = '0'") ); 1536 update_site_option( 'user_count', $count ); 1537 } 1538 1536 1539 ?> -
wp-admin/includes/default-list-tables.php
2739 2739 $pagenum = $this->get_pagenum(); 2740 2740 2741 2741 $s = isset( $_REQUEST['s'] ) ? stripslashes( trim( $_REQUEST[ 's' ] ) ) : ''; 2742 2743 // Limit is set to 2 for testing. 2744 if ( ! $s && ( get_blog_count() > 2 ) ) { 2745 $total = 0; 2746 $this->items = array(); 2747 $this->set_pagination_args( array( 2748 'total_items' => $total, 2749 'per_page' => $per_page, 2750 ) ); 2751 return; 2752 } 2753 2742 2754 $like_s = esc_sql( like_escape( $s ) ); 2743 2755 2744 2756 $query = "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' ";