Changeset 8313
- Timestamp:
- 04/23/2014 04:37:18 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-update.php
r8310 r8313 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 exists 452 * 453 * @since BuddyPress (2.0.1) 454 * 455 * @global WPDB $wpdb 456 * 457 * @return bool If signups table exists 458 */ 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 this 468 $old_suppress = $wpdb->suppress_errors(); 469 470 // Never use bp_core_get_table_prefix() for any global users tables 471 // 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 setting 475 $wpdb->suppress_errors( $old_suppress ); 476 477 // Return whether or not the table exists 478 return (bool) $table_exists; 479 } 480 481 /** 482 * Check if the signups table already exists 483 * 484 * @since BuddyPress (2.0.1) 485 * 486 * @global WPDB $wpdb 487 * 488 * @link https://core.trac.wordpress.org/changeset/25179 489 * 490 * @return bool If signup_id column exists 491 */ 492 function bp_core_signups_id_column_exists() { 493 global $wpdb; 494 495 // No signups table to query, so bail and return false 496 if ( empty( $wpdb->signups ) ) { 497 return false; 498 } 499 500 // Suppress errors because users shouldn't see this 501 $old_suppress = $wpdb->suppress_errors(); 502 503 // Never use bp_core_get_table_prefix() for any global users tables 504 $column_exists = $wpdb->query( "SHOW COLUMNS FROM {$wpdb->signups} LIKE 'signup_id'" ); 505 506 // Restore previous error suppression setting 507 $wpdb->suppress_errors( $old_suppress ); 508 509 // Column does not exist 510 return $column_exists; 511 } 512 513 /** 514 * Check if the signups table needs to be created. 451 * Check if the signups table needs to be created or upgraded. 515 452 * 516 453 * @since BuddyPress (2.0.0) … … 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 -
trunk/bp-loader.php
r8302 r8313 305 305 306 306 $this->version = '2.1-alpha'; 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.