Changeset 5721
- Timestamp:
- 02/11/2012 08:10:10 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/admin/bp-core-update.php
r5717 r5721 27 27 28 28 /** 29 * @var int Are we currently network activated30 */31 var $is_network_activate;32 33 /**34 29 * @var string What kind of setup/update are we performing 35 30 */ … … 52 47 $this->db_version_raw = !empty( $bp->db_version_raw ) ? (int) $bp->db_version_raw : 0; 53 48 54 if ( !empty( $bp->is_network_activate ) ) { 55 $this->is_network_activate = $bp->is_network_activate; 56 57 } elseif ( !$this->current_step() ) { 58 setcookie( 'bp-wizard-step', 0, time() + 60 * 60 * 24, COOKIEPATH ); 59 $_COOKIE['bp-wizard-step'] = 0; 60 } 49 setcookie( 'bp-wizard-step', 0, time() + 60 * 60 * 24, COOKIEPATH ); 50 $_COOKIE['bp-wizard-step'] = 0; 61 51 62 52 $this->db_version = bp_get_db_version(); 63 $this->setup_type = !empty( $bp->maintenance_mode ) ? $bp->maintenance_mode : '';53 $this->setup_type = $bp->maintenance_mode; 64 54 $this->current_step = $this->current_step(); 65 55 … … 79 69 $current_step = (int)$_POST['step'] + 1; 80 70 } else { 81 if ( !empty( $_COOKIE['bp-wizard-step'] ) ) 71 if ( !empty( $_COOKIE['bp-wizard-step'] ) ) { 82 72 $current_step = $_COOKIE['bp-wizard-step']; 83 else73 } else { 84 74 $current_step = 0; 75 } 85 76 } 86 77 … … 104 95 // Update wizard steps 105 96 } else { 106 if ( $this->is_network_activate )107 $steps[] = __( 'Multisite Update', 'buddypress' );108 97 109 98 if ( $this->db_version_raw < (int) $this->db_version ) … … 113 102 if ( $this->db_version_raw < 1801 || !bp_core_get_directory_page_ids() ) { 114 103 $steps[] = __( 'Components', 'buddypress' ); 115 $steps[] = __( 'Pages', 'buddypress' );104 $steps[] = __( 'Pages', 'buddypress' ); 116 105 } 117 106 … … 134 123 break; 135 124 136 case 'ms_update':137 $result = $this->step_ms_update_save();138 break;139 140 case 'ms_pages':141 $result = $this->step_ms_update_save();142 break;143 144 125 case 'components': 145 126 $result = $this->step_components_save(); … … 244 225 break; 245 226 246 case __( 'Multisite Update', 'buddypress') :247 $this->step_ms_update();248 break;249 250 case __( 'Site Directory', 'buddypress') :251 $this->step_ms_update();252 break;253 254 227 case __( 'Components', 'buddypress') : 255 228 $this->step_components(); … … 303 276 } 304 277 305 function step_ms_update() { 306 global $wpdb; 278 function step_components() { 279 if ( !current_user_can( 'activate_plugins' ) ) 280 return false; 281 282 if ( !function_exists( 'bp_core_admin_components_options' ) ) 283 require ( WP_PLUGIN_DIR . '/buddypress/bp-core/admin/bp-core-components.php' ); ?> 284 285 <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> 286 287 <?php bp_core_admin_components_options(); ?> 288 289 <div class="submit clear"> 290 <input type="hidden" name="save" value="components" /> 291 <input type="hidden" name="step" value="<?php echo esc_attr( $this->current_step ); ?>" /> 292 293 <?php wp_nonce_field( 'bpwizard_components' ); ?> 294 295 </div> 296 297 <?php 298 } 299 300 function step_pages() { 301 global $bp, $wpdb; 307 302 308 303 // Make sure that page info is pulled from bp_get_root_blog_id() (except when in … … 314 309 return false; 315 310 316 $ active_components = bp_get_option( 'bp-active-components');317 318 if ( defined( 'BP_BLOGS_SLUG' ))319 $blogs_slug = constant( 'BP_BLOGS_SLUG' );320 else321 $blogs_slug = 'blogs';322 323 // Call up old bp-pages to see if a page has been previously linked to Blogs 324 $existing_pages = bp_get_option( 'bp-pages' );311 $existing_pages = bp_core_update_get_page_meta(); 312 313 // Provide empty indexes to avoid PHP errors with wp_dropdown_pages() 314 $indexes = array( 'members', 'activity', 'groups', 'forums', 'blogs', 'register', 'activate' ); 315 foreach ( $indexes as $index ) { 316 if ( !isset( $existing_pages[$index] ) ) { 317 $existing_pages[$index] = ''; 318 } 319 } 325 320 326 321 if ( !empty( $existing_pages['blogs'] ) ) … … 328 323 else 329 324 $existing_blog_page = ''; 325 326 // Get active components 327 $active_components = apply_filters( 'bp_active_components', bp_get_option( 'bp-active-components' ) ); 328 329 // Check for defined slugs 330 $members_slug = !empty( $bp->members->slug ) ? $bp->members->slug : __( 'members', 'buddypress' ); 331 332 // Groups 333 $groups_slug = !empty( $bp->groups->slug ) ? $bp->groups->slug : __( 'groups', 'buddypress' ); 334 335 // Activity 336 $activity_slug = !empty( $bp->activity->slug ) ? $bp->activity->slug : __( 'activity', 'buddypress' ); 337 338 // Forums 339 $forums_slug = !empty( $bp->forums->slug ) ? $bp->forums->slug : __( 'forums', 'buddypress' ); 340 341 // Blogs 342 $blogs_slug = !empty( $bp->blogs->slug ) ? $bp->blogs->slug : __( 'blogs', 'buddypress' ); 343 344 // Register 345 $register_slug = !empty( $bp->register->slug ) ? $bp->register->slug : __( 'register', 'buddypress' ); 346 347 // Activation 348 $activation_slug = !empty( $bp->activation->slug ) ? $bp->activation->slug : __( 'activate', 'buddypress' ); 349 330 350 ?> 331 351 … … 338 358 </script> 339 359 340 <p><?php printf( __( 'BuddyPress has detected a recent change to WordPress Multisite, which allows members of your community to have their own WordPress sites. You can enable or disable this feature at any time at <a href="%s">Network Options</a>.', 'buddypress' ), network_admin_url( 'settings.php' ) ); ?></p> 341 342 <p><?php __( "Please select the WordPress page you would like to use to display the site 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> 343 344 <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> 345 346 <p><?php _e( 'Would you like to enable site tracking, which tracks blog posts and comments from across your network?', 'buddypress' ); ?></p> 347 348 <table class="form-table"> 349 350 <tr valign="top"> 351 <th scope="row"><?php _e( "Enable Site Tracking?", 'buddypress' ) ?></th> 352 353 <td> 354 <label for="bp_components[blogs]"> 355 <input id="site-tracking-enabled" type="checkbox" id="bp_components[blogs]" name="bp_components[blogs]" value="1"<?php checked( isset( $active_components['blogs'] ) ); ?> /> 356 357 <?php _e( "Track new sites, new posts and new comments across your entire network.", 'buddypress' ) ?> 358 359 </label> 360 361 </td> 362 </tr> 363 364 <tr valign="top" id="site-tracking-page-selector"> 365 <th scope="row"><?php _e( 'Select a WordPress page for the Sites directory.', 'buddypress' ); ?></th> 366 367 <td> 368 <p><input type="radio" name="bp_pages[blogs]" checked="checked" value="<?php echo $blogs_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ); ?> <?php echo site_url( $blogs_slug ); ?>/</p> 369 370 <?php if ( $page_dropdown = wp_dropdown_pages( "name=bp-blogs-page&echo=0&show_option_none=" . __( '- Select -', 'buddypress' ) . $existing_blog_page ) ) : ?> 371 372 <p><input type="radio" name="bp_pages[blogs]" value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?><?php echo $page_dropdown ?></p> 373 374 <?php endif ?> 375 </td> 376 </tr> 377 378 </table> 379 380 381 <div class="submit clear"> 382 <input type="hidden" name="save" value="ms_update" /> 383 <input type="hidden" name="step" value="<?php echo esc_attr( $this->current_step ); ?>" /> 384 385 <?php wp_nonce_field( 'bpwizard_ms_update' ); ?> 386 387 </div> 388 389 <?php 390 391 restore_current_blog(); 392 } 393 394 function step_components() { 395 if ( !current_user_can( 'activate_plugins' ) ) 396 return false; 397 398 if ( !function_exists( 'bp_core_admin_components_options' ) ) 399 require ( WP_PLUGIN_DIR . '/buddypress/bp-core/admin/bp-core-components.php' ); ?> 400 401 <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> 402 403 <?php bp_core_admin_components_options(); ?> 404 405 <div class="submit clear"> 406 <input type="hidden" name="save" value="components" /> 407 <input type="hidden" name="step" value="<?php echo esc_attr( $this->current_step ); ?>" /> 408 409 <?php wp_nonce_field( 'bpwizard_components' ); ?> 410 411 </div> 412 413 <?php 414 } 415 416 function step_pages() { 417 global $bp, $wpdb; 418 419 // Make sure that page info is pulled from bp_get_root_blog_id() (except when in 420 // multisite mode) 421 if ( !empty( $wpdb->blogid ) && ( $wpdb->blogid != bp_get_root_blog_id() ) && ( !defined( 'BP_ENABLE_MULTIBLOG' ) ) ) 422 switch_to_blog( bp_get_root_blog_id() ); 423 424 if ( !current_user_can( 'activate_plugins' ) ) 425 return false; 426 427 $existing_pages = bp_core_update_get_page_meta(); 428 429 // Provide empty indexes to avoid PHP errors with wp_dropdown_pages() 430 $indexes = array( 'members', 'activity', 'groups', 'forums', 'blogs', 'register', 'activate' ); 431 foreach ( $indexes as $index ) { 432 if ( !isset( $existing_pages[$index] ) ) 433 $existing_pages[$index] = ''; 434 } 435 436 if ( !empty( $existing_pages['blogs'] ) ) 437 $existing_blog_page = '&selected=' . $existing_pages['blogs']; 438 else 439 $existing_blog_page = ''; 440 441 // Get active components 442 $active_components = apply_filters( 'bp_active_components', bp_get_option( 'bp-active-components' ) ); 443 444 // Check for defined slugs 445 $members_slug = !empty( $bp->members->slug ) ? $bp->members->slug : __( 'members', 'buddypress' ); 446 447 // Groups 448 $groups_slug = !empty( $bp->groups->slug ) ? $bp->groups->slug : __( 'groups', 'buddypress' ); 449 450 // Activity 451 $activity_slug = !empty( $bp->activity->slug ) ? $bp->activity->slug : __( 'activity', 'buddypress' ); 452 453 // Forums 454 $forums_slug = !empty( $bp->forums->slug ) ? $bp->forums->slug : __( 'forums', 'buddypress' ); 455 456 // Blogs 457 $blogs_slug = !empty( $bp->blogs->slug ) ? $bp->blogs->slug : __( 'blogs', 'buddypress' ); 458 459 // Register 460 $register_slug = !empty( $bp->register->slug ) ? $bp->register->slug : __( 'register', 'buddypress' ); 461 462 // Activation 463 $activation_slug = !empty( $bp->activation->slug ) ? $bp->activation->slug : __( 'activate', 'buddypress' ); 464 465 ?> 466 467 <script type="text/javascript"> 468 jQuery( document ).ready( function() { 469 jQuery( 'select' ).change( function() { 470 jQuery( this ).siblings( 'input[@type=radio]' ).click(); 471 }); 472 }); 473 </script> 474 475 <p><?php _e( 'BuddyPress now uses WordPress pages to display content. This allows you to easily change the names of pages or move them to a sub page.', 'buddypress' ); ?></p> 476 477 <p><?php _e( 'Either choose an existing page or let BuddyPress auto-create pages for you. To manually create custom pages, come back to this step once you are finished.', 'buddypress' ); ?></p> 478 479 <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> 360 <p><?php _e( 'BuddyPress uses WordPress pages to display directories. This allows you to easily change their titles and relocate them.', 'buddypress' ); ?></p> 361 362 <p><?php _e( 'Choose an existing page, have one auto-created, or create them manually and come back here once you are finished.', 'buddypress' ); ?></p> 480 363 481 364 <table class="form-table"> … … 496 379 </td> 497 380 </tr> 498 499 <?php if ( isset( $active_components['activity'] ) ) : ?>500 501 <tr valign="top">502 <th scope="row">503 <h5><?php _e( 'Site Activity', 'buddypress' ); ?></h5>504 <p><?php _e( "Displays the activity for the entire site, a member's friends, groups and @mentions.", 'buddypress' ); ?></p>505 </th>506 <td>507 <p><label><input type="radio" name="bp_pages[activity]" <?php checked( empty( $existing_pages['activity'] ) ); ?> value="<?php echo $activity_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ); ?> <?php echo home_url( $activity_slug ); ?>/</label></p>508 509 <?php if ( $activity_page_dropdown = wp_dropdown_pages( "name=bp-blogs-page&echo=0&selected={$existing_pages['activity']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?>510 <p><label><input type="radio" name="bp_pages[activity]" <?php checked( !empty( $existing_pages['activity'] ) ); ?> value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?> <?php echo $activity_page_dropdown ?></label></p>511 <?php endif ?>512 </td>513 </tr>514 515 <?php endif; ?>516 381 517 382 <?php if ( isset( $active_components['groups'] ) ) : ?> … … 533 398 <?php endif; ?> 534 399 400 <?php /* The Blogs component only needs a directory page when Multisite is enabled */ ?> 401 <?php if ( is_multisite() && isset( $active_components['blogs'] ) ) : ?> 402 403 <tr valign="top"> 404 <th scope="row"> 405 <h5><?php _e( 'Blogs', 'buddypress' ); ?></h5> 406 <p><?php _e( 'Displays a directory of the blogs in your network.', 'buddypress' ); ?></p> 407 </th> 408 <td> 409 <p><label><input type="radio" name="bp_pages[blogs]" <?php checked( empty( $existing_pages['blogs'] ) ); ?> value="<?php echo $blogs_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ); ?> <?php echo home_url( $blogs_slug ); ?>/</label></p> 410 411 <?php if ( $blogs_page_dropdown = wp_dropdown_pages( "name=bp-blogs-page&echo=0&selected={$existing_pages['blogs']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?> 412 <p><label><input type="radio" name="bp_pages[blogs]" <?php checked( !empty( $existing_pages['blogs'] ) ); ?> value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?> <?php echo $blogs_page_dropdown ?></label></p> 413 <?php endif ?> 414 </td> 415 </tr> 416 417 <?php endif; ?> 418 419 <?php if ( isset( $active_components['activity'] ) ) : ?> 420 421 <tr valign="top"> 422 <th scope="row"> 423 <h5><?php _e( 'Activity', 'buddypress' ); ?></h5> 424 <p><?php _e( "Displays the activity for the entire site, a member's friends, groups and @mentions.", 'buddypress' ); ?></p> 425 </th> 426 <td> 427 <p><label><input type="radio" name="bp_pages[activity]" <?php checked( empty( $existing_pages['activity'] ) ); ?> value="<?php echo $activity_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ); ?> <?php echo home_url( $activity_slug ); ?>/</label></p> 428 429 <?php if ( $activity_page_dropdown = wp_dropdown_pages( "name=bp-blogs-page&echo=0&selected={$existing_pages['activity']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?> 430 <p><label><input type="radio" name="bp_pages[activity]" <?php checked( !empty( $existing_pages['activity'] ) ); ?> value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?> <?php echo $activity_page_dropdown ?></label></p> 431 <?php endif ?> 432 </td> 433 </tr> 434 435 <?php endif; ?> 436 535 437 <?php if ( isset( $active_components['forums'] ) ) : ?> 536 438 … … 545 447 <?php if ( $forums_page_dropdown = wp_dropdown_pages( "name=bp-blogs-page&echo=0&selected={$existing_pages['forums']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?> 546 448 <p><label><input type="radio" name="bp_pages[forums]" <?php checked( !empty( $existing_pages['forums'] ) ); ?> value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?> <?php echo $forums_page_dropdown ?></label></p> 547 <?php endif ?>548 </td>549 </tr>550 551 <?php endif; ?>552 553 <?php /* The Blogs component only needs a directory page when Multisite is enabled */ ?>554 <?php if ( is_multisite() && isset( $active_components['blogs'] ) ) : ?>555 556 <tr valign="top">557 <th scope="row">558 <h5><?php _e( 'Sites', 'buddypress' ); ?></h5>559 <p><?php _e( 'Displays a directory of the sites in your network.', 'buddypress' ); ?></p>560 </th>561 <td>562 <p><label><input type="radio" name="bp_pages[blogs]" <?php checked( empty( $existing_pages['blogs'] ) ); ?> value="<?php echo $blogs_slug; ?>" /> <?php _e( 'Automatically create a page at:', 'buddypress' ); ?> <?php echo home_url( $blogs_slug ); ?>/</label></p>563 564 <?php if ( $blogs_page_dropdown = wp_dropdown_pages( "name=bp-blogs-page&echo=0&selected={$existing_pages['blogs']}&show_option_none=" . __( '- Select -', 'buddypress' ) ) ) : ?>565 <p><label><input type="radio" name="bp_pages[blogs]" <?php checked( !empty( $existing_pages['blogs'] ) ); ?> value="page" /> <?php _e( 'Use an existing page:', 'buddypress' ); ?> <?php echo $blogs_page_dropdown ?></label></p>566 449 <?php endif ?> 567 450 </td> … … 622 505 // If we're using permalinks already, adjust text accordingly 623 506 if ( !empty( $permalink_structure ) ) 624 $permalink_setup_text = __( ' Congratulations! You are already using pretty permalinks, which BuddyPress requires. If you\'d like to change your settings, you may do so now. If you\'re happy with your current settings, click Save & Next to continue.', 'buddypress' );507 $permalink_setup_text = __( 'Your permalink settings are compatible with BuddyPress.', 'buddypress' ); 625 508 else 626 $permalink_setup_text = __( ' To make sure the pages created in the previous step work correctly, pretty permalinks must be active on your site.', 'buddypress' );509 $permalink_setup_text = __( 'Pretty permalinks must be active on your site.', 'buddypress' ); 627 510 628 511 if ( !got_mod_rewrite() && !iis7_supports_permalinks() ) … … 630 513 631 514 <p><?php echo $permalink_setup_text; ?></p> 632 <p><?php printf( __( ' Please select the permalink setting you would like to use. For more advanced options please visit the <a href="%s">permalink settings page</a> first, and complete this setup wizardlater.', 'buddypress' ), admin_url( 'options-permalink.php' ) ); ?>515 <p><?php printf( __( 'For more advanced options please visit the <a href="%s">permalink settings page</a> now and come back here later.', 'buddypress' ), admin_url( 'options-permalink.php' ) ); ?> 633 516 634 517 <table class="form-table"> … … 707 590 </script> 708 591 709 <p><?php _e( "BuddyPress introduces a whole range of new screens to display content. To display these screens, you need to decide how you want to handle them in your current theme.", 'buddypress' ); ?></p>710 711 592 <table class="form-table"> 712 593 <tr> … … 716 597 </th> 717 598 <td> 718 <p><?php _e( ' BuddyPress Default contains everything you needto get up and running out of the box. It supports all features and is highly customizable.', 'buddypress' ); ?></p>719 <p><strong><?php _e( 'This is the best choice if you do not have an existing WordPress theme, orwant to start using BuddyPress immediately.', 'buddypress' ); ?></strong></p>599 <p><?php _e( 'The default BuddyPress theme comes with the basics, to get up and running out of the box. It supports all features and is highly customizable.', 'buddypress' ); ?></p> 600 <p><strong><?php _e( 'This is the best choice if you want to start using BuddyPress immediately.', 'buddypress' ); ?></strong></p> 720 601 <p><label><input type="radio" name="theme" value="bp_default" checked="checked" /> <?php _e( 'Yes, please!', 'buddypress' ); ?></label></p> 721 602 </td> … … 729 610 </th> 730 611 <td> 731 <p><?php _e( " We've found that you already have some other BuddyPress-compatible themes available. To use one of those, pick it from this list.", 'buddypress' ); ?></p>612 <p><?php _e( "You have some other BuddyPress compatible themes available. Pick one of them from this list to use it.", 'buddypress' ); ?></p> 732 613 <p> 733 614 <label> … … 737 618 738 619 <?php foreach( (array) $bp_themes as $theme ) : ?> 620 739 621 <option value="<?php echo $theme['Template'] . ',' . $theme['Stylesheet']; ?>"><?php echo $theme['Name']; ?></option> 622 740 623 <?php endforeach; ?> 741 624 … … 749 632 <th> 750 633 <h5><?php _e( 'Manually update current theme', 'buddypress' ); ?></h5> 634 751 635 <?php if ( !empty( $screenshot ) ) : ?> 636 752 637 <img src="<?php echo esc_url( $screenshot ); ?>" alt="<?php _e( 'Your existing theme', 'buddypress' ); ?>" /> 638 753 639 <?php endif; ?> 640 754 641 </th> 755 642 <td> 756 <p><?php _e( 'The BuddyPress Template Pack plugin will guide you through the process of manually upgrading your existing WordPress theme. This usually involves following the step-by-step instructions and copying the BuddyPress template files into your theme. This option requires a working knowledge of CSS and HTML, as you will need to tweak the new templates to match your existing theme.', 'buddypress' ); ?></p>643 <p><?php _e( 'The BuddyPress Template Pack will guide you through the process of manually editing your existing theme. It comes with a step-by-step guide and involves copying the BuddyPress template files into your theme. <strong>This option requires knowledge of CSS and HTML.</strong> You will need to tweak the new templates to match your existing theme.', 'buddypress' ); ?></p> 757 644 758 645 <?php if ( empty( $template_pack_installed ) ) : ?> … … 776 663 <td> 777 664 <p><?php _e( "You are happy with your current theme and plan on changing it later.", 'buddypress' ); ?></p> 778 <p><strong><?php _e( 'This is the best choice if you have a highly customized theme on your site already, and want to later manually integrate BuddyPress into your site.', 'buddypress' ); ?></strong></p>665 <p><strong><?php _e( 'This is the best choice if you have a custom theme already and want to manually integrate BuddyPress later.', 'buddypress' ); ?></strong></p> 779 666 780 667 <p><label><input type="radio" name="theme" value="do_not_change" /> <?php _e( "Don't change my current theme", 'buddypress' ); ?></label></p> … … 870 757 } 871 758 872 function step_ms_update_save() {873 global $wpdb;874 875 if ( isset( $_POST['submit'] ) ) {876 check_admin_referer( 'bpwizard_ms_update' );877 878 if ( !$active_components = bp_get_option( 'bp-active-components' ) )879 $active_components = array();880 881 // Transfer important settings from blog options to site options882 $options = array(883 '_bp_db_version' => $this->db_version,884 'bp-active-components' => $active_components,885 'avatar-default' => get_option( 'avatar-default' )886 );887 bp_core_activate_site_options( $options );888 889 if ( isset( $_POST['bp_components']['blogs'] ) ) {890 $active_components['blogs'] = 1;891 892 // Make sure that the pages are created on the bp_get_root_blog_id(), no matter which Dashboard the setup is being run on893 if ( !empty( $wpdb->blogid ) && ( $wpdb->blogid != bp_get_root_blog_id() ) && ( !defined( 'BP_ENABLE_MULTIBLOG' ) ) )894 switch_to_blog( bp_get_root_blog_id() );895 896 // Move bp-pages data from the blog options table to site options897 $existing_pages = bp_get_option( 'bp-pages' );898 $bp_pages = $this->setup_pages( (array)$_POST['bp_pages'] );899 $bp_pages = array_merge( (array)$existing_pages, (array)$bp_pages );900 901 bp_update_option( 'bp-pages', $bp_pages );902 903 if ( !empty( $wpdb->blogid ) && ( $wpdb->blogid != bp_get_root_blog_id() ) && ( !defined( 'BP_ENABLE_MULTIBLOG' ) ) )904 restore_current_blog();905 906 bp_core_install( $active_components );907 }908 909 // Delete the old site option910 delete_site_option( 'bp-db-version' );911 912 // Update the active components913 bp_update_option( 'bp-active-components', $active_components );914 915 return true;916 }917 918 return false;919 }920 921 922 759 function step_components_save() { 923 760 … … 1139 976 check_admin_referer( 'bpwizard_admin_bar' ); 1140 977 1141 if ( !empty( $_POST['keep_buddybar'] ) ) 1142 bp_update_option( 'bp-force-buddybar', 1 ); 978 if ( !empty( $_POST['keep_buddybar'] ) ) { 979 bp_update_option( '_bp_force_buddybar', 1 ); 980 } 1143 981 1144 982 return true; … … 1149 987 1150 988 function step_finish_save() { 989 1151 990 if ( isset( $_POST['submit'] ) ) { 991 1152 992 check_admin_referer( 'bpwizard_finish' ); 993 994 // Delete possible site options 995 delete_site_option( 'bp-db-version' ); 996 delete_site_option( '_bp_db_version' ); 997 delete_site_option( 'bp-core-db-version' ); 998 delete_site_option( '_bp-core-db-version' ); 999 1000 // Delete possible blog options 1001 delete_blog_option( bp_get_root_blog_id(), 'bp-db-version' ); 1002 delete_blog_option( bp_get_root_blog_id(), 'bp-core-db-version' ); 1003 delete_site_option( bp_get_root_blog_id(), '_bp-core-db-version' ); 1004 delete_site_option( bp_get_root_blog_id(), '_bp_db_version' ); 1153 1005 1154 1006 // Update the DB version in the database 1155 1007 // Stored in sitemeta. Do not use bp_update_option() 1156 update_site_option( 'bp-db-version', $this->db_version ); 1157 delete_site_option( 'bp-core-db-version' ); 1008 update_blog_option( bp_get_root_blog_id(), '_bp_db_version', $this->db_version ); 1158 1009 1159 1010 // Delete the setup cookie … … 1168 1019 $redirect = bp_core_update_do_network_admin() ? add_query_arg( array( 'page' => 'bp-components' ), network_admin_url( 'settings.php' ) ) : add_query_arg( array( 'page' => 'bp-components' ), admin_url( 'options-general.php' ) ); 1169 1020 1170 wp_ redirect( $redirect );1021 wp_safe_redirect( $redirect ); 1171 1022 1172 1023 return true; … … 1332 1183 add_action( 'admin_footer', 'bp_core_wizard_thickbox' ); 1333 1184 1185 function bp_core_update_add_admin_menu_styles() { 1186 if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { 1187 wp_enqueue_style( 'bp-admin-css', apply_filters( 'bp_core_admin_css', plugins_url( '/buddypress' ) . '/bp-core/css/admin.dev.css' ), array(), '20110723' ); 1188 wp_enqueue_script( 'bp-update-js', apply_filters( 'bp_core_update_js', plugins_url( '/buddypress' ) . '/bp-core/js/update.dev.js' ), array( 'jquery' ), '20110723' ); 1189 } else { 1190 wp_enqueue_style( 'bp-admin-css', apply_filters( 'bp_core_admin_css', plugins_url( '/buddypress' ) . '/bp-core/css/admin.css' ), array(), '20110723' ); 1191 wp_enqueue_script( 'bp-update-js', apply_filters( 'bp_core_update_js', plugins_url( '/buddypress' ) . '/bp-core/js/update.js' ), array( 'jquery' ), '20110723' ); 1192 } 1193 1194 wp_enqueue_script( 'thickbox' ); 1195 wp_enqueue_style( 'thickbox' ); ?> 1196 1197 <style type="text/css"> 1198 /* Wizard Icon */ 1199 ul#adminmenu li.toplevel_page_bp-wizard .wp-menu-image a img { display: none; } 1200 ul#adminmenu li.toplevel_page_bp-wizard .wp-menu-image a { background-image: url( <?php echo plugins_url( 'buddypress/bp-core/images/admin_menu_icon.png' ) ?> ) !important; background-position: -1px -32px; } 1201 ul#adminmenu li.toplevel_page_bp-wizard:hover .wp-menu-image a, 1202 ul#adminmenu li.toplevel_page_bp-wizard.wp-has-current-submenu .wp-menu-image a { 1203 background-position: -1px 0; 1204 } 1205 1206 /* Settings Icon */ 1207 ul#adminmenu li.toplevel_page_bp-general-config .wp-menu-image a img { display: none; } 1208 ul#adminmenu li.toplevel_page_bp-general-config .wp-menu-image a { background-image: url( <?php echo plugins_url( 'buddypress/bp-core/images/admin_menu_icon.png' ) ?> ) !important; background-position: -1px -32px; } 1209 ul#adminmenu li.toplevel_page_bp-general-config:hover .wp-menu-image a, 1210 ul#adminmenu li.toplevel_page_bp-general-config.wp-has-current-submenu .wp-menu-image a { 1211 background-position: -1px 0; 1212 } 1213 </style> 1214 1215 <?php 1216 } 1217 add_action( 'admin_head', 'bp_core_update_add_admin_menu_styles' ); 1218 1219 /** 1220 * Fetches BP pages from the meta table 1221 * 1222 * @package BuddyPress Core 1223 * @since 1.5 1224 * 1225 * @return array $page_ids 1226 */ 1227 function bp_core_update_get_page_meta() { 1228 $page_ids = bp_get_option( 'bp-pages' ); 1229 if ( empty( $page_ids ) ) 1230 $page_ids = array(); 1231 1232 return apply_filters( 'bp_core_update_get_page_meta', $page_ids ); 1233 } 1234 1235 function bp_core_update_do_network_admin() { 1236 $do_network_admin = false; 1237 1238 if ( is_multisite() && ( !defined( 'BP_ENABLE_MULTIBLOG' ) || !BP_ENABLE_MULTIBLOG ) ) 1239 $do_network_admin = true; 1240 1241 return apply_filters( 'bp_core_do_network_admin', $do_network_admin ); 1242 } 1243 1244 function bp_core_update_admin_hook() { 1245 $hook = bp_core_update_do_network_admin() ? 'network_admin_menu' : 'admin_menu'; 1246 1247 return apply_filters( 'bp_core_admin_hook', $hook ); 1248 } 1249 1334 1250 /** 1335 1251 * Adds the "BuddyPress" admin submenu item to the Site Admin tab. … … 1347 1263 return false; 1348 1264 1349 if ( !current_user_can( ' activate_plugins' ) )1265 if ( !current_user_can( 'manage_options' ) ) 1350 1266 return false; 1351 1267 1352 1268 if ( 'install' == $bp_wizard->setup_type ) 1353 $status = __( ' Setup', 'buddypress' );1269 $status = __( 'BuddyPress Setup', 'buddypress' ); 1354 1270 else 1355 $status = __( 'Update ','buddypress' );1271 $status = __( 'Update BuddyPress', 'buddypress' ); 1356 1272 1357 1273 // Add the administration tab under the "Site Admin" tab for site administrators 1358 add_menu_page( __( 'BuddyPress', 'buddypress' ), __( 'BuddyPress', 'buddypress' ), 'manage_options', 'bp-wizard', '' ); 1359 $hook = add_submenu_page( 'bp-wizard', $status, $status, 'manage_options', 'bp-wizard', array( $bp_wizard, 'html' ) ); 1274 if ( ! is_multisite() || bp_is_multiblog_mode() ) 1275 $hook = add_dashboard_page( $status, $status, 'manage_options', 'bp-wizard', array( $bp_wizard, 'html' ) ); 1276 else 1277 $hook = add_submenu_page( 'update-core.php', $status, $status, 'manage_options', 'bp-wizard', array( $bp_wizard, 'html' ) ); 1360 1278 1361 1279 // Add a hook for css/js … … 1363 1281 } 1364 1282 add_action( bp_core_update_admin_hook(), 'bp_core_update_add_admin_menu', 9 ); 1365 1366 function bp_core_update_add_admin_menu_styles() {1367 if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {1368 wp_enqueue_style( 'bp-admin-css', apply_filters( 'bp_core_admin_css', plugins_url( '/buddypress' ) . '/bp-core/css/admin.dev.css' ), array(), '20110723' );1369 wp_enqueue_script( 'bp-update-js', apply_filters( 'bp_core_update_js', plugins_url( '/buddypress' ) . '/bp-core/js/update.dev.js' ), array( 'jquery' ), '20110723' );1370 } else {1371 wp_enqueue_style( 'bp-admin-css', apply_filters( 'bp_core_admin_css', plugins_url( '/buddypress' ) . '/bp-core/css/admin.css' ), array(), '20110723' );1372 wp_enqueue_script( 'bp-update-js', apply_filters( 'bp_core_update_js', plugins_url( '/buddypress' ) . '/bp-core/js/update.js' ), array( 'jquery' ), '20110723' );1373 }1374 1375 wp_enqueue_script( 'thickbox' );1376 wp_enqueue_style( 'thickbox' ); ?>1377 1378 <style type="text/css">1379 /* Wizard Icon */1380 ul#adminmenu li.toplevel_page_bp-wizard .wp-menu-image a img { display: none; }1381 ul#adminmenu li.toplevel_page_bp-wizard .wp-menu-image a { background-image: url( <?php echo plugins_url( 'buddypress/bp-core/images/admin_menu_icon.png' ) ?> ) !important; background-position: -1px -32px; }1382 ul#adminmenu li.toplevel_page_bp-wizard:hover .wp-menu-image a,1383 ul#adminmenu li.toplevel_page_bp-wizard.wp-has-current-submenu .wp-menu-image a {1384 background-position: -1px 0;1385 }1386 1387 /* Settings Icon */1388 ul#adminmenu li.toplevel_page_bp-general-config .wp-menu-image a img { display: none; }1389 ul#adminmenu li.toplevel_page_bp-general-config .wp-menu-image a { background-image: url( <?php echo plugins_url( 'buddypress/bp-core/images/admin_menu_icon.png' ) ?> ) !important; background-position: -1px -32px; }1390 ul#adminmenu li.toplevel_page_bp-general-config:hover .wp-menu-image a,1391 ul#adminmenu li.toplevel_page_bp-general-config.wp-has-current-submenu .wp-menu-image a {1392 background-position: -1px 0;1393 }1394 </style>1395 1396 <?php1397 }1398 add_action( 'admin_head', 'bp_core_update_add_admin_menu_styles' );1399 1400 /**1401 * Fetches BP pages from the meta table1402 *1403 * @package BuddyPress Core1404 * @since 1.51405 *1406 * @return array $page_ids1407 */1408 function bp_core_update_get_page_meta() {1409 if ( !$page_ids = bp_get_option( 'bp-pages' ) )1410 $page_ids = array();1411 1412 return apply_filters( 'bp_core_update_get_page_meta', $page_ids );1413 }1414 1415 function bp_core_update_do_network_admin() {1416 $do_network_admin = false;1417 1418 if ( is_multisite() && ( !defined( 'BP_ENABLE_MULTIBLOG' ) || !BP_ENABLE_MULTIBLOG ) )1419 $do_network_admin = true;1420 1421 return apply_filters( 'bp_core_do_network_admin', $do_network_admin );1422 }1423 1424 function bp_core_update_admin_hook() {1425 $hook = bp_core_update_do_network_admin() ? 'network_admin_menu' : 'admin_menu';1426 1427 return apply_filters( 'bp_core_admin_hook', $hook );1428 }1429 1283 1430 1284 /** … … 1438 1292 global $bp_wizard, $pagenow; 1439 1293 1294 // Bail if no wizard 1440 1295 if ( empty( $bp_wizard->setup_type ) ) 1441 1296 return; 1442 1297 1443 if ( !bp_current_user_can( 'bp_moderate' ) ) 1298 // Bail if user cannot manage options 1299 if ( ! current_user_can( 'manage_options' ) ) 1444 1300 return; 1445 1301 1446 if ( 'admin.php' == $pagenow && ( empty( $_GET['page'] ) || 'bp-wizard' == $_GET['page'] ) ) 1447 return; 1448 1449 $url = bp_core_update_do_network_admin() ? network_admin_url( 'admin.php?page=bp-wizard' ) : admin_url( 'admin.php?page=bp-wizard' ); 1450 1302 // Are we looking at a network? 1303 if ( bp_core_update_do_network_admin() ) { 1304 1305 // Bail if looking at wizard page 1306 if ( ( 'admin.php' == $pagenow ) && ( !empty( $_GET['page'] ) && ( 'bp-wizard' == $_GET['page'] ) ) ) { 1307 return; 1308 } 1309 1310 // Set the url for the nag 1311 $url = network_admin_url( 'admin.php?page=bp-wizard' ); 1312 1313 // Single site 1314 } else { 1315 1316 // Bail if looking at wizard page 1317 if ( ( 'index.php' == $pagenow ) && ( !empty( $_GET['page'] ) && ( 'bp-wizard' == $_GET['page'] ) ) ) { 1318 return; 1319 } 1320 1321 // Set the url for the nag 1322 $url = admin_url( 'index.php?page=bp-wizard' ); 1323 } 1324 1325 // What does the nag say? 1451 1326 switch( $bp_wizard->setup_type ) { 1452 case 'update': 1327 1328 // Update text 1329 case 'update' : 1453 1330 $msg = sprintf( __( 'BuddyPress has been updated! Please run the <a href="%s">update wizard</a>.', 'buddypress' ), $url ); 1454 1331 break; 1455 1332 1456 default:1457 case 'install' :1458 $msg = sprintf( __( 'BuddyPress was successfully installed! Please run the <a href="%s">installation wizard</a>.', 'buddypress' ), $url );1333 // First install text 1334 case 'install' : default : 1335 $msg = sprintf( __( 'BuddyPress was successfully activated! Please run the <a href="%s">installation wizard</a>.', 'buddypress' ), $url ); 1459 1336 break; 1460 } 1461 1462 echo '<div class="update-nag">' . $msg . '</div>'; 1337 } ?> 1338 1339 <div class="update-nag"><?php echo $msg; ?></div> 1340 1341 <?php 1463 1342 } 1464 add_action( 'admin_notices', 'bp_core_update_nag', 5 );1343 add_action( 'admin_notices', 'bp_core_update_nag', 5 ); 1465 1344 add_action( 'network_admin_notices', 'bp_core_update_nag', 5 ); 1466 1345 -
trunk/bp-core/bp-core-functions.php
r5719 r5721 963 963 964 964 // Has the admin chosen to use the BuddyBar during an upgrade? 965 elseif ( (bool) bp_get_option( ' bp-force-buddybar', false ) )965 elseif ( (bool) bp_get_option( '_bp_force_buddybar', false ) ) 966 966 $use_admin_bar = false; 967 967 -
trunk/bp-core/bp-core-loader.php
r5704 r5721 55 55 56 56 /** Components ********************************************************/ 57 58 // Move active components from sitemeta, if necessary59 // Provides backpat with earlier versions of BP60 if ( is_multisite() && $active_components = get_site_option( 'bp-active-components' ) )61 bp_update_option( 'bp-active-components', $active_components );62 57 63 58 // Set the included and optional components. -
trunk/bp-core/bp-core-options.php
r5585 r5721 83 83 // Users from all sites can post 84 84 '_bp_enable_akismet' => true, 85 86 /** BuddyBar **********************************************************/ 87 88 // Force the BuddyBar 89 '_bp_force_buddybar' => false 85 90 ); 86 91 … … 191 196 * When switching from single to multisite we need to copy blog options to 192 197 * site options. 198 * 199 * This function is no longer used 193 200 * 194 201 * @package BuddyPress Core 195 * @ todo Does this need to be here anymore after the introduction of bp_get_option etc?202 * @deprecated Since BuddyPress (1.6) 196 203 */ 197 204 function bp_core_activate_site_options( $keys = array() ) { … … 205 212 $bp->site_options[ $key ] = bp_get_option( $key, $default ); 206 213 207 if ( !bp_update_option( $key, $bp->site_options[ $key ] ) ) 214 if ( !bp_update_option( $key, $bp->site_options[ $key ] ) ) { 208 215 $errors = true; 216 } 209 217 } 210 218 } 211 219 212 if ( empty( $errors ) ) 220 if ( empty( $errors ) ) { 213 221 return true; 222 } 214 223 } 215 224 … … 310 319 * @param $default bool Optional.Default value true 311 320 * 312 * @uses get_option() To get the profile sync option321 * @uses bp_get_option() To get the profile sync option 313 322 * @return bool Is profile sync enabled or not 314 323 */ 315 324 function bp_disable_profile_sync( $default = true ) { 316 return (bool) apply_filters( 'bp_disable_profile_sync', (bool) get_option( 'bp-disable-profile-sync', $default ) );325 return (bool) apply_filters( 'bp_disable_profile_sync', (bool) bp_get_option( 'bp-disable-profile-sync', $default ) ); 317 326 } 318 327 … … 324 333 * @param $default bool Optional.Default value true 325 334 * 326 * @uses get_option() To get the logged out admin bar option335 * @uses bp_get_option() To get the logged out admin bar option 327 336 * @return bool Is logged out admin bar enabled or not 328 337 */ 329 338 function bp_hide_loggedout_adminbar( $default = true ) { 330 return (bool) apply_filters( 'bp_hide_loggedout_adminbar', (bool) get_option( 'hide-loggedout-adminbar', $default ) );339 return (bool) apply_filters( 'bp_hide_loggedout_adminbar', (bool) bp_get_option( 'hide-loggedout-adminbar', $default ) ); 331 340 } 332 341 … … 338 347 * @param $default bool Optional. Default value true 339 348 * 340 * @uses get_option() To get the avatar uploads option349 * @uses bp_get_option() To get the avatar uploads option 341 350 * @return bool Are avatar uploads allowed? 342 351 */ 343 352 function bp_disable_avatar_uploads( $default = true ) { 344 return (bool) apply_filters( 'bp_disable_avatar_uploads', (bool) get_option( 'bp-disable-avatar-uploads', $default ) );353 return (bool) apply_filters( 'bp_disable_avatar_uploads', (bool) bp_get_option( 'bp-disable-avatar-uploads', $default ) ); 345 354 } 346 355 … … 352 361 * @param $default bool Optional. Default value 353 362 * 354 * @uses get_option() To get the account deletion option363 * @uses bp_get_option() To get the account deletion option 355 364 * @return bool Is account deletion allowed? 356 365 */ 357 366 function bp_disable_account_deletion( $default = false ) { 358 return apply_filters( 'bp_disable_account_deletion', (bool) get_option( 'bp-disable-account-deletion', $default ) );367 return apply_filters( 'bp_disable_account_deletion', (bool) bp_get_option( 'bp-disable-account-deletion', $default ) ); 359 368 } 360 369 … … 366 375 * @param $default bool Optional. Default value false 367 376 * @todo split and move into blog and forum components 368 * @uses get_option() To get the blog/forum comments option377 * @uses bp_get_option() To get the blog/forum comments option 369 378 * @return bool Is blog/forum comments allowed? 370 379 */ 371 380 function bp_disable_blogforum_comments( $default = false ) { 372 return (bool) apply_filters( 'bp_disable_blogforum_comments', (bool) get_option( 'bp-disable-blogforum-comments', $default ) );381 return (bool) apply_filters( 'bp_disable_blogforum_comments', (bool) bp_get_option( 'bp-disable-blogforum-comments', $default ) ); 373 382 } 374 383 … … 381 390 * 382 391 * @todo Move into groups component 383 * @uses get_option() To get the group creation392 * @uses bp_get_option() To get the group creation 384 393 * @return bool Allow group creation? 385 394 */ 386 395 function bp_restrict_group_creation( $default = true ) { 387 return (bool) apply_filters( 'bp_restrict_group_creation', (bool) get_option( 'bp_restrict_group_creation', $default ) );396 return (bool) apply_filters( 'bp_restrict_group_creation', (bool) bp_get_option( 'bp_restrict_group_creation', $default ) ); 388 397 } 389 398 … … 396 405 * 397 406 * @todo Move into groups component 398 * @uses get_option() To get the WP editor option407 * @uses bp_get_option() To get the WP editor option 399 408 * @return bool Use WP editor? 400 409 */ 401 410 function bp_force_buddybar( $default = true ) { 402 return (bool) apply_filters( 'bp_force_buddybar', (bool) get_option( 'bp-force-buddybar', $default ) );411 return (bool) apply_filters( 'bp_force_buddybar', (bool) bp_get_option( '_bp_force_buddybar', $default ) ); 403 412 } 404 413 … … 410 419 * @param $default bool Optional. Default value true 411 420 * 412 * @uses get_option() To get the WP editor option421 * @uses bp_get_option() To get the WP editor option 413 422 * @return bool Use WP editor? 414 423 */ 415 424 function bp_use_wp_editor( $default = true ) { 416 return (bool) apply_filters( 'bp_use_wp_editor', (bool) get_option( '_bp_use_wp_editor', $default ) );425 return (bool) apply_filters( 'bp_use_wp_editor', (bool) bp_get_option( '_bp_use_wp_editor', $default ) ); 417 426 } 418 427 … … 434 443 * @param $default bool Optional. Default value 0 435 444 * 436 * @uses get_option() To get the maximum title length445 * @uses bp_get_option() To get the maximum title length 437 446 * @return int Is anonymous posting allowed? 438 447 */ 439 448 function bp_get_group_forums_root_id( $default = '0' ) { 440 return (int) apply_filters( 'bp_get_group_forums_root_id', (int) get_option( '_bbp_group_forums_root_id', $default ) );449 return (int) apply_filters( 'bp_get_group_forums_root_id', (int) bp_get_option( '_bbp_group_forums_root_id', $default ) ); 441 450 } 442 451 … … 448 457 * @param $default bool Optional. Default value true 449 458 * 450 * @uses get_option() To get the group forums option459 * @uses bp_get_option() To get the group forums option 451 460 * @return bool Is group forums enabled or not 452 461 */ 453 462 function bp_is_group_forums_active( $default = true ) { 454 return (bool) apply_filters( 'bp_is_group_forums_active', (bool) get_option( '_bbp_enable_group_forums', $default ) );463 return (bool) apply_filters( 'bp_is_group_forums_active', (bool) bp_get_option( '_bbp_enable_group_forums', $default ) ); 455 464 } 456 465 … … 462 471 * @param $default bool Optional. Default value true 463 472 * 464 * @uses get_option() To get the Akismet option473 * @uses bp_get_option() To get the Akismet option 465 474 * @return bool Is Akismet enabled or not 466 475 */ 467 476 function bp_is_akismet_active( $default = true ) { 468 return (bool) apply_filters( 'bp_is_akismet_active', (bool) get_option( '_bp_enable_akismet', $default ) );477 return (bool) apply_filters( 'bp_is_akismet_active', (bool) bp_get_option( '_bp_enable_akismet', $default ) ); 469 478 } 470 479 -
trunk/bp-loader.php
r5716 r5721 68 68 * @var string State of BuddyPress installation 69 69 */ 70 public $maintenance_mode = '';70 public $maintenance_mode = false; 71 71 72 72 /** … … 439 439 require( BP_PLUGIN_DIR . '/bp-core/bp-core-wpabstraction.php' ); 440 440 441 // Get the possible DB versions 441 // Get the possible DB versions (boy is this gross) 442 442 $versions = array(); 443 $versions['1.2'] = get_site_option( 'bp-core-db-version' ); 444 $versions['1.5-multi'] = get_site_option( 'bp-db-version' ); 445 $versions['1.6-multi'] = get_site_option( '_bp_db_version' ); 446 $versions['1.5-single'] = get_blog_option( $this->root_blog_id, 'bp-db-version' ); 447 $versions['1.6-single'] = get_blog_option( $this->root_blog_id, '_bp_db_version' ); 448 449 // Remove empty array items 450 $versions = array_filter( $versions ); 443 $versions['1.6-single'] = get_blog_option( $this->root_blog_id, '_bp_db_version' ); 444 445 // 1.6-single exists, so trust it 446 if ( !empty( $versions['1.6-single'] ) ) { 447 $this->db_version_raw = (int) $versions['1.6-single']; 451 448 452 449 // If no 1.6-single exists, use the max of the others 453 if ( empty( $versions['1.6-single'] ) ) 454 $this->db_version_raw = !empty( $versions ) ? (int) max( $versions ) : 0; 455 456 // 1.6-single exists, so trust it 457 else 458 $this->db_version_raw = $versions['1.6-single']; 459 460 // Is this an upgrade to WordPress Network Mode? 461 // We know by checking to see whether the db version is saved in sitemeta 462 if ( is_multisite() && ( empty( $versions['1.5-multi'] ) && empty( $versions['1.6-multi'] ) ) ) 463 $this->is_network_activate = true; 450 } else { 451 $versions['1.2'] = get_site_option( 'bp-core-db-version' ); 452 $versions['1.5-multi'] = get_site_option( 'bp-db-version' ); 453 $versions['1.6-multi'] = get_site_option( '_bp_db_version' ); 454 $versions['1.5-single'] = get_blog_option( $this->root_blog_id, 'bp-db-version' ); 455 456 // Remove empty array items 457 $versions = array_filter( $versions ); 458 $this->db_version_raw = (int) ( !empty( $versions ) ) ? (int) max( $versions ) : 0; 459 } 464 460 465 461 /** Update/Install ****************************************************/ 466 462 467 463 // This is a new installation 468 if ( empty( $this->db_version_raw ) ) { 469 $this->maintenance_mode = 'install'; 470 464 if ( is_admin() ) { 465 466 // New installation 467 if ( empty( $this->db_version_raw ) ) { 468 $this->maintenance_mode = 'install'; 469 470 // Update 471 } elseif ( (int) $this->db_version_raw < (int) $this->db_version ) { 472 $this->maintenance_mode = 'update'; 473 } 474 471 475 // The installation process requires a few BuddyPress core libraries 472 require( $this->plugin_dir . 'bp-core/bp-core-functions.php' ); 473 require( $this->plugin_dir . 'bp-core/bp-core-update.php' ); 474 require( $this->plugin_dir . 'bp-core/bp-core-caps.php' ); 475 476 require( $this->plugin_dir . 'bp-core/admin/bp-core-update.php' ); 477 478 // There is a previous installation 479 } else { 476 if ( !empty( $this->maintenance_mode ) ) { 477 require( $this->plugin_dir . 'bp-core/bp-core-functions.php' ); 478 require( $this->plugin_dir . 'bp-core/bp-core-update.php' ); 479 require( $this->plugin_dir . 'bp-core/bp-core-caps.php' ); 480 require( $this->plugin_dir . 'bp-core/admin/bp-core-update.php' ); 481 } 482 } 483 484 // Not in maintenance made 485 if ( empty( $this->maintenance_mode ) ) { 480 486 481 487 // Setup the BuddyPress theme directory … … 507 513 require( $this->plugin_dir . 'bp-core/deprecated/1.6.php' ); 508 514 } 509 510 // Check if an update is required511 if ( ( (int) $this->db_version_raw < (int) $this->db_version ) || ( !empty( $this->is_network_activate ) ) ) {512 513 // BuddyPress needs an update514 $this->maintenance_mode = 'update';515 516 // Only include core updater if in the admin area517 if ( is_admin() ) {518 require( $this->plugin_dir . 'bp-core/admin/bp-core-update.php' );519 }520 }521 515 } 522 516 }
Note: See TracChangeset
for help on using the changeset viewer.