Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/27/2016 05:21:20 AM (8 years ago)
Author:
r-a-y
Message:

Blogs: Improve how bp_blogs_record_existing_blogs() operates.

When the "Repopulate blogs records" is used from the "Tools > BuddyPress"
page, on large site installs, this option isn't very effective.

This commit improves bp_blogs_record_existing_blogs() by:

  • Recording an offset so the blog record repopulation can be resumed on failure.
  • Only recording the root blog for the current user if run from single site. (See #6940.)
  • Fixing issues with blog count caches.
  • Giving each blog a better last activity timestamp by using the last_updated column from the wp_blogs DB table.
  • Supporting passing selected blog IDs in case a dev wants to re-record specific blogs.

Fixes #6370.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/admin/bp-core-admin-tools.php

    r10583 r10815  
    474474    return array( 0, __( 'Emails have been successfully reinstalled.', 'buddypress' ) );
    475475}
     476
     477/**
     478 * Add notice on the "Tools > BuddyPress" page if more sites need recording.
     479 *
     480 * This notice only shows up in the network admin dashboard.
     481 *
     482 * @since 2.6.0
     483 */
     484function bp_core_admin_notice_repopulate_blogs_resume() {
     485    $screen = get_current_screen();
     486    if ( 'tools_page_bp-tools-network' !== $screen->id ) {
     487        return;
     488    }
     489
     490    if ( '' === bp_get_option( '_bp_record_blogs_offset' ) ) {
     491        return;
     492    }
     493
     494    echo '<div class="error"><p>' . __( 'It looks like you have more sites to record. Resume recording by checking the "Repopulate site tracking records" option.', 'buddypress' ) . '</p></div>';
     495}
     496add_action( 'network_admin_notices', 'bp_core_admin_notice_repopulate_blogs_resume' );
Note: See TracChangeset for help on using the changeset viewer.