Skip to:
Content

BuddyPress.org

Changeset 4203


Ignore:
Timestamp:
04/14/2011 01:36:19 PM (14 years ago)
Author:
boonebgorges
Message:

Keeps bp-default from loading during MS upgrade process. Fixes #3015. Refactors parts of the upgrade wizard to make MS upgrades recognize previous installations of BP. Refactors parts of the upgrade wizard to use bp-active-components rather than the deprecated bp-deactivated-components. Ensures that MS upgrades are seen as upgrades rather than new installations.

Location:
trunk
Files:
4 edited

Legend:

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

    r4198 r4203  
    253253            return false;
    254254
     255        $active_components = get_site_option( 'bp-active-components' );
     256
    255257        if ( defined( 'BP_BLOGS_SLUG' ) )
    256258            $blogs_slug = constant( 'BP_BLOGS_SLUG' );
     
    277279        </script>
    278280
    279         <p><?php printf( __( 'BuddyPress has detected a recent change to WordPress Multisite, which allows members of your community to have their own WordPress blogs. You can enable or disable this feature at any time at <a href="%s">Network Options</a>.', 'buddypress' ), admin_url( 'ms-options.php' ) ); ?></p>
    280 
    281         <p><?php _e( "Please select the WordPress page you would like to use to display the blog directory. You can either choose an existing page or let BuddyPress auto-create a page for you. If you'd like to manually create pages, please go ahead and do that now, you can come back to this step once you are finished.", 'buddypress' ) ?></p>
     281        <p><?php printf( __( 'BuddyPress has detected a recent change to WordPress Multisite, which allows members of your community to have their own WordPress blogs. You can enable or disable this feature at any time at <a href="%s">Network Options</a>.', 'buddypress' ), network_admin_url( 'settings.php' ) ); ?></p>
     282
     283        <p><?php __( "Please select the WordPress page you would like to use to display the blog directory. You can either choose an existing page or let BuddyPress auto-create a page for you. If you'd like, you can go to manually create pages now, and return to this step when you are finished.", 'buddypress' ) ?></p>
    282284
    283285        <p><strong><?php _e( 'Please Note:', 'buddypress' ) ?></strong> <?php _e( "If you have manually added BuddyPress navigation links in your theme you may need to remove these from your header.php to avoid duplicate links.", 'buddypress' ) ?></p>
     
    306308
    307309                <div class="radio">
    308                     <input type="radio" name="bp_components[bp-blogs.php]" value="1"<?php if ( !isset( $disabled_components['bp-blogs.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Enabled', 'buddypress' ) ?> &nbsp;
    309                     <input type="radio" name="bp_components[bp-blogs.php]" value="0"<?php if ( isset( $disabled_components['bp-blogs.php'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Disabled', 'buddypress' ) ?>
     310                    <input type="radio" name="bp_components[blogs]" value="1"<?php if ( isset( $active_components['blogs'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Enabled', 'buddypress' ) ?> &nbsp;
     311                    <input type="radio" name="bp_components[blogs]" value="0"<?php if ( !isset( $active_components['blogs'] ) ) : ?> checked="checked" <?php endif; ?>/> <?php _e( 'Disabled', 'buddypress' ) ?>
    310312                </div>
    311313
     
    333335
    334336        if ( !function_exists( 'bp_core_admin_component_options' ) )
    335             require ( WP_PLUGIN_DIR . '/buddypress/bp-core/admin/bp-core-admin.php' );
    336 
    337         $disabled_components = apply_filters( 'bp_deactivated_components', get_site_option( 'bp-deactivated-components' ) ); ?>
     337            require ( WP_PLUGIN_DIR . '/buddypress/bp-core/admin/bp-core-admin.php' ); ?>
    338338
    339339        <p><?php _e( "BuddyPress bundles several individual social components together, each one adding a distinct feature. This first step decides which features are enabled on your site; all features are enabled by default. Don't worry, you can change your mind at any point in the future.", 'buddypress' ); ?></p>
     
    364364            $existing_pages = get_option( 'bp-pages' );
    365365
    366         // Get disabled components
    367         $disabled_components = apply_filters( 'bp_deactivated_components', get_site_option( 'bp-deactivated-components' ) );
     366        // Get active components
     367        $active_components = apply_filters( 'bp_active_components', get_site_option( 'bp-active-components' ) );
    368368
    369369        // Check for defined slugs
     
    417417            </tr>
    418418
    419             <?php if ( !isset( $disabled_components['bp-activity.php'] ) ) : ?>
     419            <?php if ( isset( $active_components['activity'] ) ) : ?>
    420420
    421421                <tr valign="top">
     
    432432            <?php endif; ?>
    433433
    434             <?php if ( !isset( $disabled_components['bp-groups.php'] ) ) : ?>
     434            <?php if ( isset( $active_components['groups'] ) ) : ?>
    435435
    436436                <tr valign="top">
     
    447447            <?php endif; ?>
    448448
    449             <?php if ( !isset( $disabled_components['bp-forums.php'] ) ) : ?>
     449            <?php if ( isset( $active_components['forums'] ) ) : ?>
    450450
    451451                <tr valign="top">
     
    462462            <?php endif; ?>
    463463
    464             <?php if ( is_multisite() && !isset( $disabled_components['bp-blogs.php'] ) ) : ?>
     464            <?php if ( is_multisite() && isset( $active_components['blogs'] ) ) : ?>
    465465
    466466                <tr valign="top">
     
    752752            check_admin_referer( 'bpwizard_ms_update' );
    753753
    754             if ( !$disabled = get_option( 'bp-deactivated-components' ) )
    755                 $disabled = array();
     754            if ( !$active_components = get_option( 'bp-active-components' ) )
     755                $active_components = array();
    756756
    757757            // Transfer important settings from blog options to site options
    758758            $options = array(
    759                 'bp-db-version'             => $this->database_version,
    760                 'bp-deactivated-components' => $disabled,
    761                 'avatar-default'            => get_option( 'avatar-default' )
     759                'bp-db-version'     => $this->database_version,
     760                'bp-active-components'  => $active_components,
     761                'avatar-default'    => get_option( 'avatar-default' )
    762762            );
    763763            bp_core_activate_site_options( $options );
    764764
    765             if ( !(int) $_POST['bp_components']['bp-blogs.php'] ) {
    766                 if ( empty( $disabled ) ) {
    767                     $disabled = array();
    768                 }
    769 
    770                 $disabled['bp-blogs.php'] = 1;
    771 
    772             } else {
     765            if ( isset( $_POST['bp_components']['blogs'] ) ) {
     766                $active_components['blogs'] = 1;
    773767
    774768                // Make sure that the pages are created on the BP_ROOT_BLOG, no matter which Dashboard the setup is being run on
     
    785779                    restore_current_blog();
    786780
    787                 unset( $disabled['bp-blogs.php'] );
    788 
    789                 bp_core_install( $disabled );
     781                bp_core_install( $active_components );
    790782            }
    791783
    792             update_site_option( 'bp-deactivated-components', $disabled );
     784            update_site_option( 'bp-active-components', $active_components );
    793785
    794786            return true;
     
    10611053add_action( is_multisite() ? 'network_admin_menu' : 'admin_menu', 'bp_core_setup_wizard_init', 7 );
    10621054
    1063 function bp_core_install( $disabled = false ) {
     1055function bp_core_install( $active_components = false ) {
    10641056    global $wpdb;
    10651057
    1066     if ( empty( $disabled ) )
    1067         $disabled = apply_filters( 'bp_deactivated_components', get_site_option( 'bp-deactivated-components' ) );
     1058    if ( empty( $active_components ) )
     1059        $active_components = apply_filters( 'bp_active_components', get_site_option( 'bp-active-components' ) );
    10681060
    10691061    require_once( dirname( __FILE__ ) . '/bp-core-schema.php' );
    1070 
     1062   
    10711063    // Core DB Tables
    10721064    bp_core_install_notifications();
    10731065
    10741066    // Activity Streams
    1075     if ( empty( $disabled['bp-activity.php'] ) )
     1067    if ( !empty( $active_components['activity'] ) )
    10761068        bp_core_install_activity_streams();
    10771069
    10781070    // Friend Connections
    1079     if ( empty( $disabled['bp-friends.php'] ) )
     1071    if ( !empty( $active_components['friends'] ) )
    10801072        bp_core_install_friends();
    10811073
    10821074    // Extensible Groups
    1083     if ( empty( $disabled['bp-groups.php'] ) )
     1075    if ( !empty( $active_components['groups'] ) )
    10841076        bp_core_install_groups();
    10851077
    10861078    // Private Messaging
    1087     if ( empty( $disabled['bp-messages.php'] ) )
     1079    if ( !empty( $active_components['messages'] ) )
    10881080        bp_core_install_private_messaging();
    10891081
    10901082    // Extended Profiles
    1091     if ( empty( $disabled['bp-xprofile.php'] ) )
     1083    if ( !empty( $active_components['xprofile'] ) )
    10921084        bp_core_install_extended_profiles();
    10931085
    10941086    // Only install blog tables if this is a multisite installation
    1095     if ( is_multisite() && empty( $disabled['bp-blogs.php'] ) )
     1087    if ( is_multisite() && !empty( $active_components['blogs'] ) )
    10961088        bp_core_install_blog_tracking();
    10971089}
     
    13201312}
    13211313add_action( 'admin_notices', 'bp_core_update_nag', 5 );
     1314add_action( 'network_admin_notices', 'bp_core_update_nag', 5 );
    13221315
    13231316?>
  • trunk/bp-core/bp-core-functions.php

    r4183 r4203  
    256256    // On multisite installs, don't log on a non-root blog
    257257    if ( !bp_is_root_blog() )
     258        return;
     259       
     260    // Don't show these messages during setup or upgrade
     261    if ( isset( $bp->maintenence_mode ) )
    258262        return;
    259263
     
    942946function bp_core_add_root_component( $slug ) {
    943947    global $bp;
    944 
     948   
    945949    if ( empty( $bp->pages ) )
    946950        $bp->pages = bp_core_get_page_names();
  • trunk/bp-loader.php

    r4030 r4203  
    5757
    5858// Test to see whether this is a new installation or an upgraded version of BuddyPress
    59 if ( !$bp->database_version = get_site_option( 'bp-db-version' ) )
    60     $bp->database_version = get_site_option( 'bp-core-db-version' );  // BP 1.2 option name
     59if ( !$bp->database_version = get_site_option( 'bp-db-version' ) ) {
     60    if ( $bp->database_version = get_option( 'bp-db-version' ) ) {
     61        $bp->is_ms_activate = 1;
     62    } else {
     63        $bp->database_version = get_site_option( 'bp-core-db-version' );  // BP 1.2 option
     64    }
     65}
    6166
    6267// This is a new installation.
     
    7176
    7277    // Check if an update is required
    73     if ( (int)$bp->database_version < (int)constant( 'BP_DB_VERSION' ) ) {
     78    if ( (int)$bp->database_version < (int)constant( 'BP_DB_VERSION' ) || isset( $bp->is_ms_activate ) ) {
    7479        $bp->maintenence_mode = 'update';
    7580        require_once( WP_PLUGIN_DIR . '/buddypress/bp-core/admin/bp-core-update.php' );
  • trunk/bp-themes/bp-default/functions.php

    r4188 r4203  
    2727 * @since 1.2
    2828 */
     29
     30if ( !function_exists( 'bp_is_active' ) )
     31    return;
    2932
    3033// If BuddyPress is not activated, switch back to the default WP theme
Note: See TracChangeset for help on using the changeset viewer.