Skip to:
Content

BuddyPress.org

Changeset 3736 for trunk/bp-core.php


Ignore:
Timestamp:
01/18/2011 10:46:09 PM (14 years ago)
Author:
boonebgorges
Message:

Modifies upgrade routine so that a site's front-end can continue to be accessible after a BP upgrade but before the wizard has been completed. Adds upgrade nags to the Dashboard. Fixes #2789. Props r-a-y and DJPaul for earlier patches and help testing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core.php

    r3734 r3736  
    4444    require ( BP_PLUGIN_DIR . '/bp-core/bp-core-adminbar.php' );
    4545
    46 // Register BuddyPress themes contained within the bp-theme folder
    47 register_theme_directory( WP_PLUGIN_DIR . '/buddypress/bp-themes' );
    48 
    4946/** "And now for something completely different" ******************************/
    5047
     
    208205 * These can be overridden manually by defining these slugs in wp-config.php.
    209206 *
     207 * The fallback values are only used during initial BP page creation, when no slugs have been
     208 * explicitly defined.
     209 *
    210210 * @package BuddyPress Core Core
    211211 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
     
    216216    if ( !defined( 'BP_MEMBERS_SLUG' ) )
    217217        define( 'BP_MEMBERS_SLUG', $bp->pages->members->slug );
    218 
     218   
    219219    if ( !defined( 'BP_REGISTER_SLUG' ) )
    220220        define( 'BP_REGISTER_SLUG', $bp->pages->register->slug );
    221 
     221   
    222222    if ( !defined( 'BP_ACTIVATION_SLUG' ) )
    223223        define( 'BP_ACTIVATION_SLUG', $bp->pages->activate->slug );
     224   
    224225}
    225226add_action( 'bp_setup_globals', 'bp_core_define_slugs' );
     
    258259    $page_ids = bp_core_get_page_meta();
    259260
    260     if ( empty( $page_ids ) )
    261         return false;
     261    $pages = new stdClass;
     262
     263    // When upgrading to BP 1.3+ from a version of BP that does not use WP pages, $bp->pages
     264    // must be populated with dummy info to avoid crashing the site while the db is upgraded
     265    if ( empty( $page_ids ) ) {
     266        $dummy_components = array(
     267            'members',
     268            'groups',
     269            'activity',
     270            'forums',
     271            'activate',
     272            'register',
     273            'blogs'
     274        );
     275       
     276        foreach ( $dummy_components as $dc ) {
     277            $pages->{$dc}->name     = $dc;
     278            $pages->{$dc}->slug     = $dc;
     279            $pages->{$dc}->id   = $dc;
     280        }
     281       
     282        return $pages;
     283    }
    262284
    263285    $posts_table_name = is_multisite() && !defined( 'BP_ENABLE_MULTIBLOG' ) ? $wpdb->get_blog_prefix( BP_ROOT_BLOG ) . 'posts' : $wpdb->posts;
     
    266288
    267289    $page_names = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM {$posts_table_name} WHERE ID IN ({$page_ids_sql}) " ) );
    268     $pages = new stdClass;
    269290
    270291    foreach ( (array)$page_ids as $key => $page_id ) {
     
    348369    if ( !is_super_admin() )
    349370        return false;
     371   
     372    // Don't add this version of the admin menu if a BP upgrade is in progress
     373    // See bp_core_update_add_admin_menu()
     374    if ( defined( 'BP_IS_UPGRADE' ) && BP_IS_UPGRADE )
     375        return false;
    350376
    351377    // Add the administration tab under the "Site Admin" tab for site administrators
Note: See TracChangeset for help on using the changeset viewer.