Changeset 8589
- Timestamp:
- 07/10/2014 10:22:16 PM (10 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-blogs/bp-blogs-functions.php
r8588 r8589 79 79 $blog_ids = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM {$wpdb->base_prefix}blogs WHERE mature = 0 AND spam = 0 AND deleted = 0 AND site_id = %d", $wpdb->siteid ) ); 80 80 81 // If error running this query, set blog ID's to false 82 if ( is_wp_error( $blog_ids ) ) { 83 $blog_ids = false; 84 } 85 81 86 // Large networks are not currently supported 82 87 } else { … … 91 96 // Bail if there are no blogs in the network 92 97 if ( empty( $blog_ids ) ) { 93 return; 94 } 95 96 // Truncate user blogs table and re-record. 97 $wpdb->query( "TRUNCATE {$bp->blogs->table_name}" ); 98 $wpdb->query( "TRUNCATE {$bp->blogs->table_name_blogmeta}" ); 98 return false; 99 } 100 101 // Truncate user blogs table 102 $truncate = $wpdb->query( "TRUNCATE {$bp->blogs->table_name}" ); 103 if ( is_wp_error( $truncate ) ) { 104 return false; 105 } 106 107 // Truncate user blogsmeta table 108 $truncate = $wpdb->query( "TRUNCATE {$bp->blogs->table_name_blogmeta}" ); 109 if ( is_wp_error( $truncate ) ) { 110 return false; 111 } 99 112 100 113 // Loop through users of blogs and record the relationship … … 130 143 } 131 144 } 145 146 // No errors 147 return true; 132 148 } 133 149 -
trunk/src/bp-core/admin/bp-core-tools.php
r8146 r8589 133 133 } 134 134 135 // Blogs: 136 // - user blog count 137 if ( bp_is_active( 'blogs' ) ) { 138 $repair_list[90] = array( 139 'bp-blog-records', 140 __( 'Repopulate blogs records', 'buddypress' ), 141 'bp_admin_repair_blog_records', 142 ); 143 } 144 135 145 ksort( $repair_list ); 136 146 … … 240 250 241 251 /** 252 * Recalculate user-to-blog relationships and useful blog meta data 253 * 254 * @since BuddyPress (2.1.0) 255 * 256 * @return array 257 */ 258 function bp_admin_repair_blog_records() { 259 260 // Description of this tool, dispalyed to the user 261 $statement = __( 'Repopulating Blogs records… %s', 'buddypress' ); 262 263 // Default to failure text 264 $result = __( 'Failed!', 'buddypress' ); 265 266 // Default to unrepaired 267 $repair = false; 268 269 // Run function if blogs component is active 270 if ( bp_is_active( 'blogs' ) ) { 271 $repair = bp_blogs_record_existing_blogs(); 272 } 273 274 // Setup success/fail messaging 275 if ( true === $repair ) { 276 $result = __( 'Complete!', 'buddypress' ); 277 } 278 279 // All done! 280 return array( 0, sprintf( $statement, $result ) ); 281 } 282 283 /** 242 284 * Recalculate the total number of active site members. 243 285 * … … 282 324 case 0: 283 325 return false; 284 break;285 326 286 327 case 1:
Note: See TracChangeset
for help on using the changeset viewer.