WordPress.org

Make WordPress Core

Ticket #23066: fourth_try.patch

File fourth_try.patch, 4.4 KB (added by chriscct7, 12 months ago)

Fourth Try Patch

  • bin/install.php

    From 3400b823567ecd4cdefdf59866bb245a8fc3121b Mon Sep 17 00:00:00 2001
    From: Sunny Ratilal <ratilal.sunny@gmail.com>
    Date: Tue, 9 Apr 2013 09:40:43 +0100
    Subject: [PATCH 1/3] Fix install script
    
    ---
     bin/install.php | 31 +++++++++++++++++--------------
     1 file changed, 17 insertions(+), 14 deletions(-)
    
    diff --git a/bin/install.php b/bin/install.php
    index c3aa298..1b8a0db 100644
    a b  
    77error_reporting( E_ALL & ~E_DEPRECATED & ~E_STRICT ); 
    88 
    99$config_file_path = $argv[1]; 
    10  
    11 $config_dir = dirname( $config_file_path ); 
     10$multisite = true; 
    1211 
    1312define( 'WP_INSTALLING', true ); 
    1413require_once $config_file_path; 
    15 require_once $config_dir . '/lib/functions.php'; 
     14require_once dirname( $config_file_path ) . '/lib/functions.php'; 
    1615 
    1716$_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1'; 
    1817$_SERVER['HTTP_HOST'] = WP_TESTS_DOMAIN; 
    require_once ABSPATH . '/wp-includes/wp-db.php'; 
    2625define( 'WP_TESTS_VERSION_FILE', ABSPATH . '.wp-tests-version' ); 
    2726 
    2827$wpdb->suppress_errors(); 
    29 $wpdb->hide_errors(); 
    3028$installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" ); 
     29$wpdb->suppress_errors( false ); 
     30 
     31$hash = get_option( 'db_version' ) . ' ' . (int) $multisite . ' ' . sha1_file( $config_file_path ); 
    3132 
    3233if ( $installed && file_exists( WP_TESTS_VERSION_FILE ) && file_get_contents( WP_TESTS_VERSION_FILE ) == $hash ) 
    3334        return; 
    3435 
    35 $wpdb->query( 'SET storage_engine = INNODB;' ); 
    36 $wpdb->query( 'DROP DATABASE IF EXISTS '.DB_NAME.";" ); 
    37 $wpdb->query( 'CREATE DATABASE '.DB_NAME.";" ); 
     36$wpdb->query( 'SET storage_engine = INNODB' ); 
    3837$wpdb->select( DB_NAME, $wpdb->dbh ); 
    3938 
    40 echo "Installing" . PHP_EOL; 
     39echo "Installing..." . PHP_EOL; 
    4140 
    4241foreach ( $wpdb->tables() as $table => $prefixed_table ) { 
    4342        $wpdb->query( "DROP TABLE IF EXISTS $prefixed_table" ); 
    foreach ( $wpdb->tables() as $table => $prefixed_table ) { 
    4645foreach ( $wpdb->tables( 'ms_global' ) as $table => $prefixed_table ) { 
    4746        $wpdb->query( "DROP TABLE IF EXISTS $prefixed_table" ); 
    4847 
    49         if ( defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE ) { 
     48        // We need to create references to ms global tables. 
     49        if ( $multisite ) 
    5050                $wpdb->$table = $prefixed_table; 
    5151} 
    5252 
    53 if ( defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE ) { 
     53wp_install( WP_TESTS_TITLE, 'admin', WP_TESTS_EMAIL, true, null, 'password' ); 
     54 
     55if ( $multisite ) { 
    5456        echo "Installing network..." . PHP_EOL; 
    5557 
    5658        define( 'WP_INSTALLING_NETWORK', true ); 
    5759 
    58         install_network(); 
    59         populate_network( 1, WP_TESTS_DOMAIN, WP_TESTS_EMAIL, WP_TESTS_NETWORK_TITLE, '/', WP_TESTS_SUBDOMAIN_INSTALL ); 
     60        $title = WP_TESTS_TITLE . ' Network'; 
     61        $subdomain_install = false; 
    6062 
    61         //system( WP_PHP_BINARY . ' ' . escapeshellarg( dirname( __FILE__ ) . '/ms-install.php' ) . ' ' . escapeshellarg( $config_file_path ) ); 
     63        install_network(); 
     64        populate_network( 1, WP_TESTS_DOMAIN, WP_TESTS_EMAIL, $title, '/', $subdomain_install ); 
    6265} 
    6366 
    64 file_put_contents( WP_TESTS_VERSION_FILE, test_version_check_hash() ); 
    65  No newline at end of file 
     67file_put_contents( WP_TESTS_VERSION_FILE, $hash ); 
     68 No newline at end of file 
  • bin/install.php

    -- 
    1.8.0.msysgit.0
    
    
    From ef793c0a182ff6b331cab5c938f6c8bc05fd45e9 Mon Sep 17 00:00:00 2001
    From: Sunny Ratilal <ratilal.sunny@gmail.com>
    Date: Tue, 9 Apr 2013 14:12:02 +0100
    Subject: [PATCH 2/3] Added check to see if multisite was called
    
    ---
     bin/install.php | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/bin/install.php b/bin/install.php
    index 1b8a0db..dd4fe5b 100644
    a b  
    77error_reporting( E_ALL & ~E_DEPRECATED & ~E_STRICT ); 
    88 
    99$config_file_path = $argv[1]; 
    10 $multisite = true; 
     10$multisite = ! empty( $argv[2] );; 
    1111 
    1212define( 'WP_INSTALLING', true ); 
    1313require_once $config_file_path; 
  • bin/install.php

    -- 
    1.8.0.msysgit.0
    
    
    From f4e566e388e0b218dc1abf1cdd1de48370816967 Mon Sep 17 00:00:00 2001
    From: Sunny Ratilal <ratilal.sunny@gmail.com>
    Date: Tue, 9 Apr 2013 14:15:08 +0100
    Subject: [PATCH 3/3] Remove double semicolons
    
    ---
     bin/install.php | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/bin/install.php b/bin/install.php
    index dd4fe5b..b846eef 100644
    a b  
    77error_reporting( E_ALL & ~E_DEPRECATED & ~E_STRICT ); 
    88 
    99$config_file_path = $argv[1]; 
    10 $multisite = ! empty( $argv[2] );; 
     10$multisite = ! empty( $argv[2] ); 
    1111 
    1212define( 'WP_INSTALLING', true ); 
    1313require_once $config_file_path;