From b3f2e25df3339736a9feeaa818c538e03ffc4b9a Mon Sep 17 00:00:00 2001
From: fgirardey <fgirardey@groupeforum.net>
Date: Tue, 22 Sep 2015 09:24:50 +0200
Subject: [PATCH] Use WP_HOME in `populate_options` Use the network siteurl
path in `install_blog`
---
src/wp-admin/includes/schema.php | 7 +++++--
src/wp-includes/ms-functions.php | 13 +++++++++++--
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git src/wp-admin/includes/schema.php src/wp-admin/includes/schema.php
index dd36834..561f082 100644
|
|
$wp_queries = wp_get_db_schema( 'all' ); |
344 | 344 | function populate_options() { |
345 | 345 | global $wpdb, $wp_db_version, $wp_current_db_version; |
346 | 346 | |
347 | | $guessurl = wp_guess_url(); |
| 347 | $guessurl = $homeurl = wp_guess_url(); |
| 348 | if ( defined( 'WP_HOME' ) && ! empty( WP_HOME ) ) { // wp_guess_url() checked WP_SITEURL constant. |
| 349 | $homeurl = rtrim( WP_HOME, '/' ); |
| 350 | } |
348 | 351 | /** |
349 | 352 | * Fires before creating WordPress options and populating their default values. |
350 | 353 | * |
… |
… |
function populate_options() { |
379 | 382 | |
380 | 383 | $options = array( |
381 | 384 | 'siteurl' => $guessurl, |
382 | | 'home' => $guessurl, |
| 385 | 'home' => $homeurl, |
383 | 386 | 'blogname' => __('My Site'), |
384 | 387 | /* translators: blog tagline */ |
385 | 388 | 'blogdescription' => __('Just another WordPress site'), |
diff --git src/wp-includes/ms-functions.php src/wp-includes/ms-functions.php
index aedc36c..499e3db 100644
|
|
function install_blog( $blog_id, $blog_title = '' ) { |
1397 | 1397 | die( '<h1>' . __( 'Already Installed' ) . '</h1><p>' . __( 'You appear to have already installed WordPress. To reinstall please clear your old database tables first.' ) . '</p></body></html>' ); |
1398 | 1398 | $wpdb->suppress_errors( $suppress ); |
1399 | 1399 | |
1400 | | $url = get_blogaddress_by_id( $blog_id ); |
| 1400 | $url = $siteurl = get_blogaddress_by_id( $blog_id ); |
| 1401 | |
| 1402 | // Get the correct siteurl path based on the main network |
| 1403 | if ( is_subdomain_install() ) { |
| 1404 | $network_siteurl = parse_url( get_blog_option( get_main_network_id(), 'siteurl' ) ); |
| 1405 | if ( isset( $network_siteurl['path'] ) ) { |
| 1406 | $siteurl = untrailingslashit( $siteurl ) . $network_siteurl['path']; |
| 1407 | } |
| 1408 | } |
1401 | 1409 | |
1402 | 1410 | // Set everything up |
1403 | 1411 | make_db_current_silent( 'blog' ); |
… |
… |
function install_blog( $blog_id, $blog_title = '' ) { |
1408 | 1416 | $wp_roles = new WP_Roles(); |
1409 | 1417 | |
1410 | 1418 | $url = untrailingslashit( $url ); |
| 1419 | $siteurl = untrailingslashit( $siteurl ); |
1411 | 1420 | |
1412 | | update_option( 'siteurl', $url ); |
| 1421 | update_option( 'siteurl', $siteurl ); |
1413 | 1422 | update_option( 'home', $url ); |
1414 | 1423 | |
1415 | 1424 | if ( get_site_option( 'ms_files_rewriting' ) ) |