Changeset 8312
- Timestamp:
- 04/23/2014 04:33:46 AM (11 years ago)
- Location:
- branches/2.0
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0/bp-core/bp-core-update.php
r8311 r8312 238 238 239 239 // 2.0.1 240 if ( $raw_db_version < 83 00) {240 if ( $raw_db_version < 8311 ) { 241 241 bp_update_to_2_0_1(); 242 242 } … … 449 449 450 450 /** 451 * Check if the signups table already exists452 *453 * @since BuddyPress (2.0.1)454 *455 * @global WPDB $wpdb456 *457 * @return bool If signups table exists458 */459 function bp_core_signups_table_exists() {460 global $wpdb;461 462 // Some installations may already have a signups table (multisite, plugins, etc...)463 if ( ! empty( $wpdb->signups ) ) {464 return true;465 }466 467 // Suppress errors because users shouldn't see this468 $old_suppress = $wpdb->suppress_errors();469 470 // Never use bp_core_get_table_prefix() for any global users tables471 // We also don't use $wpdb->signups because we want decisive evidence.472 $table_exists = $wpdb->get_results( "DESCRIBE {$wpdb->base_prefix}signups;" );473 474 // Restore previous error suppression setting475 $wpdb->suppress_errors( $old_suppress );476 477 // Return whether or not the table exists478 return (bool) $table_exists;479 }480 481 /**482 * Check if the signups table already exists483 *484 * @since BuddyPress (2.0.1)485 *486 * @global WPDB $wpdb487 *488 * @link https://core.trac.wordpress.org/changeset/25179489 *490 * @return bool If signup_id column exists491 */492 function bp_core_signups_id_column_exists() {493 global $wpdb;494 495 // No signups table to query, so bail and return false496 if ( empty( $wpdb->signups ) ) {497 return false;498 }499 500 // Suppress errors because users shouldn't see this501 $old_suppress = $wpdb->suppress_errors();502 503 // Never use bp_core_get_table_prefix() for any global users tables504 $column_exists = $wpdb->query( "SHOW COLUMNS FROM {$wpdb->signups} LIKE 'signup_id'" );505 506 // Restore previous error suppression setting507 $wpdb->suppress_errors( $old_suppress );508 509 // Column does not exist510 return $column_exists;511 }512 513 /**514 451 * Check if the signups table needs to be created. 515 452 * … … 527 464 } 528 465 466 global $wpdb; 467 468 // The table to run queries against 469 $signups_table = $wpdb->base_prefix . 'signups'; 470 471 // Suppress errors because users shouldn't see what happens next 472 $old_suppress = $wpdb->suppress_errors(); 473 474 // Never use bp_core_get_table_prefix() for any global users tables 475 $table_exists = (bool) $wpdb->get_results( "DESCRIBE {$signups_table};" ); 476 529 477 // Table already exists, so maybe upgrade instead? 530 if ( bp_core_signups_table_exists() ) { 478 if ( true === $table_exists ) { 479 480 // Look for the 'signup_id' column 481 $column_exists = $wpdb->query( "SHOW COLUMNS FROM {$signups_table} LIKE 'signup_id'" ); 531 482 532 483 // 'signup_id' column doesn't exist, so run the upgrade 533 if ( ! bp_core_signups_id_column_exists() ) {484 if ( empty( $column_exists ) ) { 534 485 bp_core_upgrade_signups(); 535 486 } 536 487 537 // Table does not exist, and not multisite, so install the signups table 488 // Table does not exist, and we are a single site, so install the multisite 489 // signups table using WordPress core's database schema. 538 490 } elseif ( ! is_multisite() ) { 539 491 bp_core_install_signups(); 540 492 } 493 494 // Restore previous error suppression setting 495 $wpdb->suppress_errors( $old_suppress ); 541 496 } 542 497 -
branches/2.0/bp-loader.php
r8301 r8312 305 305 306 306 $this->version = '2.0.1'; 307 $this->db_version = 83 00;307 $this->db_version = 8311; 308 308 309 309 /** Loading ***************************************************/
Note: See TracChangeset
for help on using the changeset viewer.