Ticket #11796: 11796.2.diff
| File 11796.2.diff, 8.2 KB (added by , 16 years ago) |
|---|
-
wp-admin/includes/schema.php
619 619 * 620 620 * @param int $network_id id of network to populate 621 621 */ 622 function populate_network( $network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $ vhost = 'no') {622 function populate_network( $network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $subdomain_install = false ) { 623 623 global $wpdb, $current_site, $wp_version, $wp_db_version, $wp_rewrite; 624 624 625 625 $msg = ''; … … 701 701 update_usermeta( $site_user->ID, 'primary_blog', 1 ); 702 702 } 703 703 704 if ( $ vhost == 'yes' )704 if ( $subdomain_install && $subdomain_install != 'no' ) // back compat vhost value 705 705 update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/'); 706 706 else 707 707 update_option( 'permalink_structure', '/blog/%year%/%monthnum%/%day%/%postname%/'); 708 708 709 709 $wp_rewrite->flush_rules(); 710 710 711 if ( $ vhost == 'yes' ) {711 if ( $subdomain_install && $subdomain_install != 'no' ) // back compat vhost value 712 712 $vhost_ok = false; 713 713 $hostname = substr( md5( time() ), 0, 6 ) . '.' . $domain; // Very random hostname! 714 714 $page = wp_remote_get( 'http://' . $hostname, array( 'timeout' => 5, 'httpversion' => '1.1' ) ); -
wp-admin/includes/wp-config.ms
34 34 35 35 /** Network settings - added by the network settings installer */ 36 36 define('MULTISITE', true); 37 define(' VHOST', 'VHOSTSETTING');37 define('SUBDOMAIN_INSTALL', 'false'); 38 38 $base = 'BASE'; 39 39 define('DOMAIN_CURRENT_SITE', 'current_site_domain' ); 40 40 define('PATH_CURRENT_SITE', 'current_site_path' ); … … 93 93 // remember to change WP_CONTENT too. 94 94 // define( "UPLOADBLOGSDIR", "fileserver" ); 95 95 96 // If VHOST is 'yes'uncomment and set this to a URL to redirect if a blog does not exist or is a 404 on the main blog. (Useful if signup is disabled)96 // If SUBDOMAIN_INSTALL is true uncomment and set this to a URL to redirect if a blog does not exist or is a 404 on the main blog. (Useful if signup is disabled) 97 97 // For example, the browser will redirect to http://examples.com/ for the following: define( 'NOBLOGREDIRECT', 'http://example.com/' ); 98 98 // Set this value to %siteurl% to redirect to the root of the site 99 99 // define( 'NOBLOGREDIRECT', '' ); -
wp-admin/network.php
142 142 <p><?php _e( '<strong>Note</strong> It looks like <code>mod_rewrite</code> is not installed.'); ?></p> 143 143 <?php } ?> 144 144 <p class="blog-address"> 145 <label><input type='radio' name='vhost' value=' yes'<?php if( $rewrite_enabled ) echo ' checked="checked"'; ?> /> <?php _e( 'Sub-domains (like <code>blog1.example.com</code>)' ); ?></label><br />146 <label><input type='radio' name='vhost' value=' no'<?php if( !$rewrite_enabled ) echo ' checked="checked"'; ?> /> <?php _e( 'Sub-directories (like <code>example.com/blog1</code>) '); ?></label>145 <label><input type='radio' name='vhost' value='1'<?php if( $rewrite_enabled ) echo ' checked="checked"'; ?> /> <?php _e( 'Sub-domains (like <code>blog1.example.com</code>)' ); ?></label><br /> 146 <label><input type='radio' name='vhost' value='0'<?php if( !$rewrite_enabled ) echo ' checked="checked"'; ?> /> <?php _e( 'Sub-directories (like <code>example.com/blog1</code>) '); ?></label> 147 147 </p> 148 148 149 149 <h2><?php esc_html_e( 'Server Address' ); ?></h2> … … 195 195 } 196 196 197 197 function step2_config() { 198 global $base, $wpdb , $vhost;198 global $base, $wpdb; 199 199 200 $ vhost = stripslashes($_POST['vhost' ]);201 $prefix = $wpdb->base_prefix;200 $subdomain_install = (bool) $_POST['vhost']; 201 $prefix = $wpdb->base_prefix; 202 202 203 203 $config_sample = ABSPATH . 'wp-admin/includes/wp-config.ms'; 204 204 if ( !file_exists( $config_sample ) ) … … 223 223 case "define('DB_HOST'": 224 224 $output = str_replace("localhost", DB_HOST, $line); 225 225 break; 226 case "define('VHOST',": 227 $output = str_replace("VHOSTSETTING", $vhost, $line); 226 case "define('SUBDOMAI": 227 if ( ! $subdomain_install ) { 228 $output = $line; 229 break; 230 } 231 $output = str_replace('false', 'true', $line); 228 232 break; 229 233 case '$table_prefix =': 230 234 $output = str_replace('wp_', $prefix, $line); … … 285 289 // create network tables 286 290 $domain = get_clean_basedomain(); 287 291 install_network(); 288 populate_network( 1, $domain, sanitize_email( $_POST[ 'email' ] ), $_POST[ 'weblog_title' ], $base, $_POST[ 'vhost' ] );292 populate_network( 1, $domain, sanitize_email( $_POST[ 'email' ] ), $_POST[ 'weblog_title' ], $base, (bool) $_POST[ 'vhost' ] ); 289 293 // create wp-config.php / htaccess 290 294 step2(); 291 295 break; -
wp-includes/default-constants.php
277 277 define('STYLESHEETPATH', get_stylesheet_directory()); 278 278 break; 279 279 280 case 'subdomain_install': 281 282 if ( defined( 'VHOST' ) ) 283 $vhost_deprecated = __( 'The constant <code>VHOST</code> <strong>is deprecated</strong>. Use the boolean constant <code>SUBDOMAIN_INSTALL</code> in wp-config.php to enable a subdomain configuration. Use is_subdomain_install() to check whether a subdomain configuration is enabled.' ); 284 285 if ( defined( 'SUBDOMAIN_INSTALL' ) && defined( 'VHOST' ) ) { 286 if ( SUBDOMAIN_INSTALL == ( 'yes' == VHOST ) ) { 287 _deprecated_argument( 'define()', '3.0', $vhost_deprecated ); 288 } else { 289 trigger_error( __( '<strong>Conflicting values for the constants VHOST and SUBDOMAIN_INSTALL.</strong> The value of SUBDOMAIN_INSTALL will be assumed to be your subdomain configuration setting.' ) . ' ' . $vhost_deprecated, E_USER_WARNING ); 290 } 291 } elseif ( defined( 'SUBDOMAIN_INSTALL' ) ) { 292 define( 'VHOST', SUBDOMAIN_INSTALL ? 'yes' : 'no' ); 293 } elseif ( defined( 'VHOST' ) ) { 294 _deprecated_argument( 'define()', '3.0', $vhost_deprecated ); 295 define( 'SUBDOMAIN_INSTALL', 'yes' == VHOST ); 296 } else { 297 define( 'SUBDOMAIN_INSTALL', false ); 298 define( 'VHOST', 'no' ); 299 } 300 301 break; 302 280 303 } 281 304 282 305 } -
wp-includes/ms-load.php
21 21 22 22 // Fix empty PHP_SELF 23 23 $PHP_SELF = $_SERVER['PHP_SELF']; 24 if ( empty($PHP_SELF) || ( empty($PHP_SELF) && constant( 'VHOST' ) == 'no'&& $current_blog->path != '/' ) )24 if ( empty($PHP_SELF) || ( empty($PHP_SELF) && !is_subdomain_install() && $current_blog->path != '/' ) ) 25 25 $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]); 26 26 27 27 wp_cache_init(); // need to init cache again after blog_id is set -
wp-includes/ms-settings.php
1 1 <?php 2 2 3 wp_default_constants( 'subdomain_install' ); 3 4 /** 4 * Whether a subdomain configuration is enabled 5 * Whether a subdomain configuration is enabled. 5 6 * 6 7 * @since 3.0 7 8 * 8 9 * @return bool True if subdomain configuration is enabled, false otherwise. 9 10 */ 10 11 function is_subdomain_install() { 11 if ( defined('VHOST') && VHOST == 'yes' ) 12 return true; 13 14 return false; 12 return SUBDOMAIN_INSTALL; 15 13 } 16 14 17 15 if ( isset( $current_site ) && isset( $current_blog ) ) -
wp-includes/wp-db.php
456 456 foreach ( $this->global_tables as $table ) 457 457 $this->$table = $prefix . $table; 458 458 459 if ( defined('VHOST') && empty($this->blogid) )459 if ( is_multisite() && empty($this->blogid) ) 460 460 return $old_prefix; 461 461 462 462 $this->prefix = $this->get_blog_prefix( $this->blogid );