Make WordPress Core

Changeset 5093


Ignore:
Timestamp:
03/23/2007 05:45:40 PM (18 years ago)
Author:
ryan
Message:

Allow siteurl and home to be defined as constants in wp-config, bypassing the DB. Props filosofo and charleshooper. fixes #4003

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/options-general.php

    r4802 r5093  
    2626<tr valign="top">
    2727<th scope="row"><?php _e('WordPress address (URL):') ?></th>
    28 <td><input name="siteurl" type="text" id="siteurl" value="<?php form_option('siteurl'); ?>" size="40" class="code" /></td>
     28<td><input name="siteurl" type="text" id="siteurl" value="<?php form_option('siteurl'); ?>" size="40" class="code<?php if ( defined( 'WP_SITEURL' ) ) : ?> disabled" disabled="disabled"<?php else: ?>"<?php endif; ?> /></td>
    2929</tr>
    3030<tr valign="top">
    3131<th scope="row"><?php _e('Blog address (URL):') ?></th>
    32 <td><input name="home" type="text" id="home" value="<?php form_option('home'); ?>" size="40" class="code" /><br /><?php _e('If you want your blog homepage <a href="http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">to be different than the directory</a> you installed WordPress in, enter that address here.'); ?></td>
     32<td><input name="home" type="text" id="home" value="<?php form_option('home'); ?>" size="40" class="code<?php if ( defined( 'WP_HOME' ) ) : ?> disabled" disabled="disabled"<?php else: ?>"<?php endif; ?> /><br /><?php _e('If you want your blog homepage <a href="http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">to be different than the directory</a> you installed WordPress in, enter that address here.'); ?></td>
    3333</tr>
    3434<tr valign="top">
  • trunk/wp-admin/upgrade-functions.php

    r4990 r5093  
    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
  • trunk/wp-includes/default-filters.php

    r5039 r5093  
    146146add_filter('option_ping_sites', 'privacy_ping_filter');
    147147add_filter('option_blog_charset', 'wp_specialchars');
     148add_filter('option_home', '_config_wp_home');
     149add_filter('option_siteurl', '_config_wp_siteurl');
    148150add_filter('mce_plugins', '_mce_load_rtl_plugin');
    149151add_filter('mce_buttons', '_mce_add_direction_buttons');
  • trunk/wp-includes/functions.php

    r5087 r5093  
    994994    $installed = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'");
    995995    $wpdb->show_errors();
    996     return $installed;
     996
     997    $install_status = !empty( $installed ) ? TRUE : FALSE;
     998    return $install_status;
    997999}
    9981000
     
    13501352<?php
    13511353    die();
     1354}
     1355
     1356function _config_wp_home($url = '') {
     1357    if ( defined( 'WP_HOME' ) )
     1358        return WP_HOME;
     1359    else return $url;
     1360}
     1361
     1362function _config_wp_siteurl($url = '') {
     1363    if ( defined( 'WP_SITEURL' ) )
     1364        return WP_SITEURL;
     1365    else return $url;
    13521366}
    13531367
Note: See TracChangeset for help on using the changeset viewer.