Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/17/2014 12:42:05 AM (8 years ago)
Author:
boonebgorges
Message:

Install default options at installation time and at upgrade to 2.0

When BuddyPress is installed, all basic config options should be saved to the
database, even when the setting is empty (0). This ensures that the options
will be pre-fetched by the first call to wp_load_alloptions() and stored in the
non-persistent cache, removing the necessity to make additional failed queries
to the wp_options table.

This changeset also includes logic to add missing default options to existing
default installations when upgrading to 2.0.

Fixes #5385

File:
1 edited

Legend:

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

    r7860 r7904  
    233233
    234234        // 2.0
    235         if ( $raw_db_version < 7859 ) {
     235        if ( $raw_db_version < 7892 ) {
    236236            bp_update_to_2_0();
    237237        }
     
    338338 * - Ensure that the activity tables are installed, for last_activity storage.
    339339 * - Migrate last_activity data from usermeta to activity table
     340 * - Add values for all BuddyPress options to the options table
    340341 */
    341342function bp_update_to_2_0() {
    342343    global $wpdb;
    343344
    344     // Install activity tables
     345    /** Install activity tables for 'last_activity' **********************/
    345346    bp_core_install_activity_streams();
    346347
    347348    $bp = buddypress();
    348349
    349     // Migrate data
     350    /** Migrate 'last_activity' data *************************************/
     351
    350352    // The "NOT IN" clause prevents duplicates
    351353    $sql = "INSERT INTO {$bp->members->table_name_last_activity} (`user_id`, `component`, `type`, `date_recorded` ) (
     
    363365
    364366    $wpdb->query( $sql );
     367
     368    /** Add BP options to the options table ******************************/
     369    bp_add_options();
    365370}
    366371
     
    405410    // Force refresh theme roots.
    406411    delete_site_transient( 'theme_roots' );
     412
     413    // Add options
     414    bp_add_options();
    407415
    408416    // Use as of (1.6)
Note: See TracChangeset for help on using the changeset viewer.