1 | diff --git a/bin/install.php b/bin/install.php |
---|
2 | index c3aa298..1b8a0db 100644 |
---|
3 | --- a/bin/install.php |
---|
4 | +++ b/bin/install.php |
---|
5 | @@ -7,12 +7,11 @@ |
---|
6 | error_reporting( E_ALL & ~E_DEPRECATED & ~E_STRICT ); |
---|
7 | |
---|
8 | $config_file_path = $argv[1]; |
---|
9 | - |
---|
10 | -$config_dir = dirname( $config_file_path ); |
---|
11 | +$multisite = true; |
---|
12 | |
---|
13 | define( 'WP_INSTALLING', true ); |
---|
14 | require_once $config_file_path; |
---|
15 | -require_once $config_dir . '/lib/functions.php'; |
---|
16 | +require_once dirname( $config_file_path ) . '/lib/functions.php'; |
---|
17 | |
---|
18 | $_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1'; |
---|
19 | $_SERVER['HTTP_HOST'] = WP_TESTS_DOMAIN; |
---|
20 | @@ -26,18 +25,18 @@ |
---|
21 | define( 'WP_TESTS_VERSION_FILE', ABSPATH . '.wp-tests-version' ); |
---|
22 | |
---|
23 | $wpdb->suppress_errors(); |
---|
24 | -$wpdb->hide_errors(); |
---|
25 | $installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" ); |
---|
26 | +$wpdb->suppress_errors( false ); |
---|
27 | + |
---|
28 | +$hash = get_option( 'db_version' ) . ' ' . (int) $multisite . ' ' . sha1_file( $config_file_path ); |
---|
29 | |
---|
30 | if ( $installed && file_exists( WP_TESTS_VERSION_FILE ) && file_get_contents( WP_TESTS_VERSION_FILE ) == $hash ) |
---|
31 | return; |
---|
32 | |
---|
33 | -$wpdb->query( 'SET storage_engine = INNODB;' ); |
---|
34 | -$wpdb->query( 'DROP DATABASE IF EXISTS '.DB_NAME.";" ); |
---|
35 | -$wpdb->query( 'CREATE DATABASE '.DB_NAME.";" ); |
---|
36 | +$wpdb->query( 'SET storage_engine = INNODB' ); |
---|
37 | $wpdb->select( DB_NAME, $wpdb->dbh ); |
---|
38 | |
---|
39 | -echo "Installing…" . PHP_EOL; |
---|
40 | +echo "Installing..." . PHP_EOL; |
---|
41 | |
---|
42 | foreach ( $wpdb->tables() as $table => $prefixed_table ) { |
---|
43 | $wpdb->query( "DROP TABLE IF EXISTS $prefixed_table" ); |
---|
44 | @@ -46,19 +45,23 @@ |
---|
45 | foreach ( $wpdb->tables( 'ms_global' ) as $table => $prefixed_table ) { |
---|
46 | $wpdb->query( "DROP TABLE IF EXISTS $prefixed_table" ); |
---|
47 | |
---|
48 | - if ( defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE ) { |
---|
49 | + // We need to create references to ms global tables. |
---|
50 | + if ( $multisite ) |
---|
51 | $wpdb->$table = $prefixed_table; |
---|
52 | } |
---|
53 | |
---|
54 | -if ( defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE ) { |
---|
55 | +wp_install( WP_TESTS_TITLE, 'admin', WP_TESTS_EMAIL, true, null, 'password' ); |
---|
56 | + |
---|
57 | +if ( $multisite ) { |
---|
58 | echo "Installing network..." . PHP_EOL; |
---|
59 | |
---|
60 | define( 'WP_INSTALLING_NETWORK', true ); |
---|
61 | |
---|
62 | - install_network(); |
---|
63 | - populate_network( 1, WP_TESTS_DOMAIN, WP_TESTS_EMAIL, WP_TESTS_NETWORK_TITLE, '/', WP_TESTS_SUBDOMAIN_INSTALL ); |
---|
64 | + $title = WP_TESTS_TITLE . ' Network'; |
---|
65 | + $subdomain_install = false; |
---|
66 | |
---|
67 | - //system( WP_PHP_BINARY . ' ' . escapeshellarg( dirname( __FILE__ ) . '/ms-install.php' ) . ' ' . escapeshellarg( $config_file_path ) ); |
---|
68 | + install_network(); |
---|
69 | + populate_network( 1, WP_TESTS_DOMAIN, WP_TESTS_EMAIL, $title, '/', $subdomain_install ); |
---|
70 | } |
---|
71 | |
---|
72 | -file_put_contents( WP_TESTS_VERSION_FILE, test_version_check_hash() ); |
---|
73 | \ No newline at end of file |
---|
74 | +file_put_contents( WP_TESTS_VERSION_FILE, $hash ); |
---|
75 | \ No newline at end of file |
---|