Make WordPress Core

Ticket #26969: 26969.2.diff

File 26969.2.diff, 1.4 KB (added by Denis-de-Bernardy, 11 years ago)

Also fix the url for broken sites.

  • wp-admin/includes/schema.php

    diff --git wp-admin/includes/schema.php wp-admin/includes/schema.php
    index 90ab600..ac17abf 100644
    function populate_options() { 
    330330        global $wpdb, $wp_db_version, $wp_current_db_version;
    331331
    332332        $guessurl = wp_guess_url();
     333        // If no wp-config.php file exists in ABSPATH, but does in the parent folder
     334        // alongside an index.php file, assume WP is installed in that folder,
     335        if (!file_exists(ABSPATH . 'wp-config.php')
     336                && file_exists(ABSPATH . '../index.php'
     337                && file_exists(ABSPATH . '../wp-config.php')
     338        ) {
     339        $guess_home_url = dirname($guessurl);
     340        } else {
     341                $guess_home_url = $guessurl;
     342        }
     343
    333344        /**
    334345         * Fires before creating WordPress options and populating their default values.
    335346         *
    function populate_options() { 
    403414        'blog_charset' => 'UTF-8',
    404415        'moderation_keys' => '',
    405416        'active_plugins' => array(),
    406         'home' => $guessurl,
     417        'home' => $guess_home_url,
    407418        'category_base' => '',
    408419        'ping_sites' => 'http://rpc.pingomatic.com/',
    409420        'advanced_edit' => 0,
    function populate_options() { 
    525536                $wpdb->query("INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES " . $insert);
    526537
    527538        // in case it is set, but blank, update "home"
    528         if ( !__get_option('home') ) update_option('home', $guessurl);
     539        if ( !__get_option('home') ) update_option('home', $guess_home_url);
    529540
    530541        // Delete unused options
    531542        $unusedoptions = array(