Skip to:
Content

BuddyPress.org

Changeset 6672


Ignore:
Timestamp:
12/25/2012 11:09:51 PM (8 years ago)
Author:
djpaul
Message:

Make new BuddyPress installs run the DB table schema and set the Activity and XProfile components to be active by default. Fixes #4733. See #4671.

Also fixes a problem with the 1.5/1.6 upgrade code not being run by sites upgrading from pre-1.5.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-update.php

    r6581 r6672  
    177177    $raw_db_version = (int) bp_get_db_version_raw();
    178178
    179     /** 1.6 Branch ************************************************************/
    180 
    181     // 1.6
    182     if ( $raw_db_version < 6067 ) {
    183         // Do nothing
     179    // Install BP schema and activate only Activity and XProfile
     180    if ( bp_is_install() ) {
     181
     182        require_once( BP_PLUGIN_DIR . '/bp-core/admin/bp-core-schema.php' );
     183
     184        $default_components = apply_filters( 'bp_new_install_default_components', array( 'activity' => 1, 'xprofile' => 1, ) );
     185        bp_core_install( $default_components );
     186        bp_update_option( 'bp-active-components', $default_components );
     187
     188    // Upgrades
     189    } else {
     190
     191        // 1.5
     192        if ( $raw_db_version < 1801 )
     193            bp_update_to_1_5();
     194
     195        // 1.6
     196        if ( $raw_db_version < 6067 )
     197            bp_update_to_1_6();
    184198    }
    185199
     
    188202    // Bump the version
    189203    bp_version_bump();
     204}
     205
     206/**
     207 * Database update methods based on version numbers
     208 *
     209 * @since BuddyPress (1.7)
     210 */
     211function bp_update_to_1_5() {
     212
     213    // Delete old database version options
     214    delete_site_option( 'bp-activity-db-version' );
     215    delete_site_option( 'bp-blogs-db-version'    );
     216    delete_site_option( 'bp-friends-db-version'  );
     217    delete_site_option( 'bp-groups-db-version'   );
     218    delete_site_option( 'bp-messages-db-version' );
     219    delete_site_option( 'bp-xprofile-db-version' );
     220}
     221
     222/**
     223 * Database update methods based on version numbers
     224 *
     225 * @since BuddyPress (1.7)
     226 */
     227function bp_update_to_1_6() {
     228
     229    // Delete possible site options
     230    delete_site_option( 'bp-db-version'       );
     231    delete_site_option( '_bp_db_version'      );
     232    delete_site_option( 'bp-core-db-version'  );
     233    delete_site_option( '_bp-core-db-version' );
     234
     235    // Delete possible blog options
     236    delete_blog_option( bp_get_root_blog_id(), 'bp-db-version'       );
     237    delete_blog_option( bp_get_root_blog_id(), 'bp-core-db-version'  );
     238    delete_site_option( bp_get_root_blog_id(), '_bp-core-db-version' );
     239    delete_site_option( bp_get_root_blog_id(), '_bp_db_version'      );
    190240}
    191241
Note: See TracChangeset for help on using the changeset viewer.