Changeset 5721 for trunk/bp-loader.php
- Timestamp:
- 02/11/2012 08:10:10 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.