From cb779b4655ff219bf92032b0564d6002eb2c9dc4 Mon Sep 17 00:00:00 2001 From: Ron Rennick Date: Tue, 19 Jan 2010 00:18:52 +0000 Subject: [PATCH] options network page, db variable change, See #11644 git-svn-id: https://develop.svn.wordpress.org/trunk@12757 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/menu.php | 3 + wp-admin/options-network.php | 333 +++++++++++++++++++++++++++++++++++ wp-includes/wp-db.php | 2 +- 3 files changed, 337 insertions(+), 1 deletion(-) create mode 100644 wp-admin/options-network.php diff --git a/wp-admin/menu.php b/wp-admin/menu.php index 2d5a729363..81bc034942 100644 --- a/wp-admin/menu.php +++ b/wp-admin/menu.php @@ -158,6 +158,9 @@ $menu[80] = array( __('Settings'), 'manage_options', 'options-general.php', '', $submenu['options-general.php'][40] = array(__('Permalinks'), 'manage_options', 'options-permalink.php'); if ( is_super_admin() ) $submenu['options-general.php'][45] = array(__('Miscellaneous'), 'manage_options', 'options-misc.php'); + if ( !is_multisite() && is_super_admin() ) { + $submenu['options-general.php'][50] = array(__('Network'), 'manage_options', 'options-network.php'); + } $_wp_last_utility_menu = 80; // The index of the last top-level menu in the utility menu group diff --git a/wp-admin/options-network.php b/wp-admin/options-network.php new file mode 100644 index 0000000000..d7beab393f --- /dev/null +++ b/wp-admin/options-network.php @@ -0,0 +1,333 @@ +Network Settings')); + +include('./admin-header.php'); +/* +This option panel does not save data to the options table. +It contains a multi-step process allowing the user to enable a network of WordPress sites. +*/ + +$dirs = array( substr( ABSPATH, 0, -1), ABSPATH . "wp-content" ); +?> +
+ +

+ +
+Server Summary"; + print "

If you post a message to the WordPress support forum at http://wordpress.org/support/ then copy and paste the following information into your message:

"; + + print "
"; + print "
ERROR: $err
"; + clearstatcache(); + $files = array( "htaccess.dist", ".htaccess" ); + + foreach ( (array) $files as $val ) { + $stats = @stat( $val ); + if( $stats ) { + print "

$val

"; + print "    uid/gid: " . $stats[ 'uid' ] . "/" . $stats[ 'gid' ] . "
\n"; + print "    size: " . $stats[ 'size' ] . "
"; + print "    perms: " . substr( sprintf('%o', fileperms( $val ) ), -4 ) . "
"; + print "    readable: "; + print is_readable( $val ) == true ? "yes" : "no"; + print "
"; + print "    writeable: "; + print is_writeable( $val ) == true ? "yes" : "no"; + print "
"; + } elseif( file_exists( $val ) == false ) { + print "

$val

"; + print "    FILE NOT FOUND: $val
"; + } + } + print "
"; +} + +function step2_htaccess() { + global $base; + + // remove ending slash from $base and $url + $htaccess = ''; + if( substr($base, -1 ) == '/') { + $base = substr($base, 0, -1); + } + $htaccess_sample = ABSPATH . 'wp-admin/includes/htaccess.ms'; + if ( !file_exists( $htaccess_sample ) ) + wp_die("Sorry, I need a {$htaccess_sample} to work from. Please re-upload this file to your WordPress installation."); + + $htaccess_file = file( $htaccess_sample ); + $fp = @fopen( $htaccess_sample, "r" ); + if( $fp ) { + while( !feof( $fp ) ) { + $htaccess .= fgets( $fp, 4096 ); + } + fclose( $fp ); + $htaccess_file = str_replace( "BASE", $base, $htaccess ); + } else { + wp_die("Sorry, I need to be able to read {$htaccess_sample}. Please check the permissions on this file."); + } + + //@todo: check for super-cache in use +?> +
  • Replace the contents of your .htaccess with the following:

    + +
  • + +

    Installing Network of WordPress Sites

    +

    I will help you enable the features for creating a network of sites by asking you a few questions so that you can create configuration files and make a directory to store all your uploaded files.

    + +

    What do I need?

    +
      +
    • Access to your server to change directory permissions. This can be done through ssh or ftp for example.
    • +
    • A valid email where your password and administrative emails will be sent.
    • +
    • Wildcard dns records if you're going to use the virtual host (sub-domain) functionality. Check the README for further details.
    • +
    + If the mod_rewrite module is disabled ask your administrator to enable that module, or look at the Apache documentation or elsewhere for help setting it up.

    "; + + if( function_exists( "apache_get_modules" ) ) { + $modules = apache_get_modules(); + if( in_array( "mod_rewrite", $modules ) == false ) { + echo "

    Warning! It looks like mod_rewrite is not installed.

    " . $mod_rewrite_msg; + } else { + $rewrite_enabled = true; + } + } else { + ?>

    Please make sure mod_rewrite is installed as it will be activated at the end of this install.

    + +

    Site Addresses

    +

    Please choose whether you would like sites in your WordPress install to use sub-domains or sub-directories. You can not change this later.

    + +

    Note It looks like mod_rewrite is not installed.

    + +

    +
    + +

    + +

    Server Address

    + + + + + +
    Server Address +

    What is the Internet address of your site? You should enter the shortest address possible. For example, use example.com instead of www.example.com but if you are going to use an address like blogs.example.com then enter that unaltered in the box below.

    + +

    Do not use an IP address (like 127.0.0.1) or a single word hostname like localhost as your server address, use localhost.localdomain instead.

    +
    + +

    Site Details

    + + + + + + + + + +
    Site Title + +
    What would you like to call your site? +
    Email + +
    Your email address. +
    +

    + +

    Enabling WordPress Sites

    +

    Complete the following steps to enable the features for creating a network of sites. Note: We recommend you make a backup copy of your existing wp-config.php and .htaccess files.

    +
      +
    1. Create a blogs.dir directory in your wp-content directory. This directory is used to stored uploaded media for your additional sites and must be writeable by the web server.
    2. + + +
    +base_prefix; + + $config_sample = ABSPATH . 'wp-admin/includes/wp-config.ms'; + if ( !file_exists( $config_sample ) ) + wp_die("Sorry, I need a {$config_sample} to work from. Please re-upload this file to your WordPress installation."); + + $wp_config_file = file( $config_sample ); +?> +
  • Replace the contents of your wp-config.php with the following:

    + +
  • +escape( $_POST[ 'basedomain' ] ); + $domain = str_replace( 'http://', '', $domain ); + if( substr( $domain, 0, 4 ) == 'www.' ) + $domain = substr( $domain, 4 ); + if( strpos( $domain, '/' ) ) + $domain = substr( $domain, 0, strpos( $domain, '/' ) ); + return $domain; +} + +function nowww() { + $nowww = str_replace( 'www.', '', $_POST[ 'basedomain' ] ); + ?> +

    No-www

    +

    WordPress strips the string "www" from the URLs of sites using this software. It is still possible to visit your site using the "www" prefix with an address like but any links will not have the "www" prefix. They will instead point at .

    +

    The preferred method of hosting sites is without the "www" prefix as it's more compact and simple.

    +

    You can still use "" and URLs like "www.blog1." to address your site and blogs after installation but internal links will use the format.

    + +

    www. is depreciated has a lot more information on why 'www.' isn't needed any more.

    +

    + + ' /> + ' /> + ' /> + + + +

    + +
    +
    + + diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index 8221ac0949..3d71b70d0b 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -491,7 +491,7 @@ class wpdb { function get_blog_prefix( $blog_id = '' ) { if ( $blog_id ) { if( defined('MULTISITE') && ( $blog_id == 0 || $blog_id == 1) ) { - return $this->prefix; + return $this->base_prefix; } else { return $this->base_prefix . $blog_id . '_'; }