Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/09/2013 01:05:45 AM (11 years ago)
Author:
boonebgorges
Message:

Add support for multisite.xml unit tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/includes/install.php

    r6942 r7028  
    3838
    3939// Check if BuddyPress has already been installed
    40 $db_version = bp_get_db_version_raw();
     40$db_version = buddypress()->db_version;
     41$hash = $db_version . ' ' . (int) $multisite . ' ' . sha1_file( $config_file_path );
    4142
    4243if ( $db_version && file_exists( BP_TESTS_DB_VERSION_FILE ) ) {
    43     $file_version = file_get_contents( BP_TESTS_DB_VERSION_FILE );
     44    $version_file = file_get_contents( BP_TESTS_DB_VERSION_FILE );
    4445
    45     if ( $db_version == (int) $file_version )
     46    if ( $hash === $version_file ) {
    4647        return;
     48    }
    4749}
    4850
    4951echo "Installing BuddyPress...\n";
    5052
     53// Make sure that BP has been cleaned from all blogs before reinstalling
     54$blogs = is_multisite() ? $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs}" ) : array( 1 );
     55foreach ( $blogs as $blog ) {
     56    if ( is_multisite() ) {
     57        switch_to_blog();
     58    }
     59
     60    $wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE '%bp%'" );
     61
     62    if ( is_multisite() ) {
     63        restore_current_blog();
     64    }
     65}
     66
    5167// Install BuddyPress
    5268bp_version_updater();
    5369
    54 file_put_contents( BP_TESTS_DB_VERSION_FILE, bp_get_db_version_raw() );
     70file_put_contents( BP_TESTS_DB_VERSION_FILE, $hash );
Note: See TracChangeset for help on using the changeset viewer.