Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/wp-admin/upgrade-functions.php

    r4772 r5431  
    2222    update_option('blog_public', $public);
    2323    $schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
    24     $guessurl = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
     24
     25    if ( defined('WP_SITEURL') && '' != WP_SITEURL )
     26        $guessurl = WP_SITEURL;
     27    else
     28        $guessurl = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
     29
    2530    update_option('siteurl', $guessurl);
    2631
     
    171176        upgrade_130();
    172177    }
     178   
     179    maybe_disable_automattic_widgets();
    173180
    174181    if ( $wp_current_db_version < 3308 )
     
    653660function __get_option($setting) {
    654661    global $wpdb;
    655 
     662   
     663    if ( $setting == 'home' && defined( 'WP_HOME' ) ) {
     664        return preg_replace( '|/+$|', '', constant( 'WP_HOME' ) );
     665    }
     666   
     667    if ( $setting == 'siteurl' && defined( 'WP_SITEURL' ) ) {
     668        return preg_replace( '|/+$|', '', constant( 'WP_SITEURL' ) );
     669    }
     670   
    656671    $option = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = '$setting'");
    657672
     
    923938        if ($oldfile == 'index.php') { // Check to make sure it's not a new index
    924939            $index = implode('', file("$oldpath/$oldfile"));
    925             if ( strstr( $index, 'WP_USE_THEMES' ) ) {
     940            if (strpos($index, 'WP_USE_THEMES') !== false) {
    926941                if (! @copy(ABSPATH . 'wp-content/themes/default/index.php', "$site_dir/$newfile"))
    927942                    return false;
     
    9951010
    9961011        foreach ($stylelines as $line) {
    997             if (strstr($line, "Theme Name:")) $line = "Theme Name: $theme_name";
    998             elseif (strstr($line, "Theme URI:")) $line = "Theme URI: " . __get_option('siteurl');
    999             elseif (strstr($line, "Description:")) $line = "Description: Your theme";
    1000             elseif (strstr($line, "Version:")) $line = "Version: 1";
    1001             elseif (strstr($line, "Author:")) $line = "Author: You";
    1002             fwrite($f, "{$line}\n");
     1012            if (strpos($line, 'Theme Name:') !== false) $line = 'Theme Name: ' . $theme_name;
     1013            elseif (strpos($line, 'Theme URI:') !== false) $line = 'Theme URI: ' . __get_option('url');
     1014            elseif (strpos($line, 'Description:') !== false) $line = 'Description: Your theme.';
     1015            elseif (strpos($line, 'Version:') !== false) $line = 'Version: 1';
     1016            elseif (strpos($line, 'Author:') !== false) $line = 'Author: You';
     1017            fwrite($f, $line . "\n");
    10031018        }
    10041019        fclose($f);
     
    10951110}
    10961111
     1112function maybe_disable_automattic_widgets() {
     1113    $plugins = __get_option( 'active_plugins' );
     1114   
     1115    foreach ( (array) $plugins as $plugin ) {
     1116        if ( basename( $plugin ) == 'widgets.php' ) {
     1117            array_splice( $plugins, array_search( $plugin, $plugins ), 1 );
     1118            update_option( 'active_plugins', $plugins );
     1119            break;
     1120        }
     1121    }
     1122}
     1123
    10971124?>
Note: See TracChangeset for help on using the changeset viewer.