WordPress.org

Make WordPress Core

Changeset 450 in tests


Ignore:
Timestamp:
10/08/11 22:11:01 (3 years ago)
Author:
ryan
Message:

Network population fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-test.php

    r447 r450  
    9191if ( TEST_MS ) { 
    9292    install_network(); 
    93     $base = '/'; 
    94     populate_network( 1, 'localhost', 'null@localhost.null', 'Test Site', $base, false ); 
     93    $base = $path = '/'; 
     94    $domain = 'localhost'; 
     95    populate_network( 1, $domain, WP_USER_EMAIL, 'Test Site', $base, false ); 
     96    // Pulled from the !is_multiste() blocks in populate_network().  These don't run in 
     97    // the call to populate_network() above due to setting MULTISITE earlier in wp-test.php. 
     98    $site_user = get_user_by( 'email', WP_USER_EMAIL ); 
     99    $site_admins = array( $site_user->user_login ); 
     100    $users = get_users( array( 'fields' => array( 'ID', 'user_login' ) ) ); 
     101    if ( $users ) { 
     102        foreach ( $users as $user ) { 
     103            if ( is_super_admin( $user->ID ) && !in_array( $user->user_login, $site_admins ) ) 
     104                $site_admins[] = $user->user_login; 
     105        } 
     106    } 
     107    update_site_option( 'site_admins', $site_admins ); 
     108 
     109    $wpdb->insert( $wpdb->blogs, array( 'site_id' => 1, 'domain' => $domain, 'path' => $path, 'registered' => current_time( 'mysql' ) ) ); 
     110    $blog_id = $wpdb->insert_id; 
     111    update_user_meta( $site_user->ID, 'source_domain', $domain ); 
     112    update_user_meta( $site_user->ID, 'primary_blog', $blog_id ); 
     113    if ( !$upload_path = get_option( 'upload_path' ) ) { 
     114        $upload_path = substr( WP_CONTENT_DIR, strlen( ABSPATH ) ) . '/uploads'; 
     115        update_option( 'upload_path', $upload_path ); 
     116    } 
     117    update_option( 'fileupload_url', get_option( 'siteurl' ) . '/' . $upload_path ); 
     118 
    95119    // wp-settings.php would normally init this stuff, but that doesn't work because we've 
    96120    // only just installed 
    97121    $GLOBALS['blog_id'] = 1; 
    98122    $GLOBALS['wpdb']->blogid = 1; 
    99     $GLOBALS['current_blog'] = $GLOBALS['wpdb']->get_results('SELECT * from wp_blogs where blog_id=1'); 
     123    $GLOBALS['current_blog'] = $GLOBALS['wpdb']->get_results('SELECT * from wp_blogs where blog_id = 1'); 
    100124} 
    101125 
Note: See TracChangeset for help on using the changeset viewer.