Changeset 10354 for trunk/src/bp-core/admin/bp-core-admin-tools.php
- Timestamp:
- 11/15/2015 06:56:24 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/src/bp-core/admin/bp-core-admin-tools.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/admin/bp-core-admin-tools.php
r10229 r10354 75 75 check_admin_referer( 'bp-do-counts' ); 76 76 77 // Stores messages 77 // Stores messages. 78 78 $messages = array(); 79 79 … … 104 104 // Members: 105 105 // - member count 106 // - last_activity migration (2.0) 106 // - last_activity migration (2.0). 107 107 $repair_list[20] = array( 108 108 'bp-total-member-count', … … 118 118 119 119 // Friends: 120 // - user friend count 120 // - user friend count. 121 121 if ( bp_is_active( 'friends' ) ) { 122 122 $repair_list[0] = array( … … 128 128 129 129 // Groups: 130 // - user group count 130 // - user group count. 131 131 if ( bp_is_active( 'groups' ) ) { 132 132 $repair_list[10] = array( … … 138 138 139 139 // Blogs: 140 // - user blog count 140 // - user blog count. 141 141 if ( bp_is_active( 'blogs' ) ) { 142 142 $repair_list[90] = array( … … 183 183 $bp = buddypress(); 184 184 185 // Walk through all users on the site 185 // Walk through all users on the site. 186 186 $total_users = $wpdb->get_row( "SELECT count(ID) as c FROM {$wpdb->users}" )->c; 187 187 … … 191 191 $offset = 0; 192 192 while ( $offset < $total_users ) { 193 // Only bother updating counts for users who actually have friendships 193 // Only bother updating counts for users who actually have friendships. 194 194 $friendships = $wpdb->get_results( $wpdb->prepare( "SELECT initiator_user_id, friend_user_id FROM {$bp->friends->table_name} WHERE is_confirmed = 1 AND ( ( initiator_user_id > %d AND initiator_user_id <= %d ) OR ( friend_user_id > %d AND friend_user_id <= %d ) )", $offset, $offset + $per_query, $offset, $offset + $per_query ) ); 195 195 196 196 // The previous query will turn up duplicates, so we 197 // filter them here 197 // filter them here. 198 198 foreach ( $friendships as $friendship ) { 199 199 if ( ! isset( $updated[ $friendship->initiator_user_id ] ) ) { … … 241 241 $bp = buddypress(); 242 242 243 // Walk through all users on the site 243 // Walk through all users on the site. 244 244 $total_users = $wpdb->get_row( "SELECT count(ID) as c FROM {$wpdb->users}" )->c; 245 245 … … 248 248 $offset = 0; 249 249 while ( $offset < $total_users ) { 250 // But only bother to update counts for users that have groups 250 // But only bother to update counts for users that have groups. 251 251 $users = $wpdb->get_col( $wpdb->prepare( "SELECT user_id FROM {$bp->groups->table_name_members} WHERE is_confirmed = 1 AND is_banned = 0 AND user_id > %d AND user_id <= %d", $offset, $offset + $per_query ) ); 252 252 … … 273 273 function bp_admin_repair_blog_records() { 274 274 275 // Description of this tool, displayed to the user 275 // Description of this tool, displayed to the user. 276 276 $statement = __( 'Repopulating Blogs records… %s', 'buddypress' ); 277 277 278 // Default to failure text 278 // Default to failure text. 279 279 $result = __( 'Failed!', 'buddypress' ); 280 280 281 // Default to unrepaired 281 // Default to unrepaired. 282 282 $repair = false; 283 283 284 // Run function if blogs component is active 284 // Run function if blogs component is active. 285 285 if ( bp_is_active( 'blogs' ) ) { 286 286 $repair = bp_blogs_record_existing_blogs(); 287 287 } 288 288 289 // Setup success/fail messaging 289 // Setup success/fail messaging. 290 290 if ( true === $repair ) { 291 291 $result = __( 'Complete!', 'buddypress' ); … … 328 328 * @param string $message Feedback message. 329 329 * @param string|bool $class Unused. 330 *331 330 * @return bool 332 331 */
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)