Changeset 1014

Show
Ignore:
Timestamp:
08/06/07 11:58:48 (1 year ago)
Author:
donncha
Message:

Make the installer more verbose.
Normalise the name (as much as possible)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/index-install.php

    r1011 r1014  
    99} 
    1010define('WP_INSTALLING', true); 
     11 
     12$dirs = array( dirname(__FILE__), dirname(__FILE__) . "/wp-content/" ); 
    1113 
    1214function printheader() { 
     
    6466<body> 
    6567 
    66 <h1><img src="wp-includes/images/wordpress-mu.png" alt="WordPress MU" /></h1> 
     68<h1><img src="wp-includes/images/wordpress-mu.png" alt="WordPress &micro;" /></h1> 
    6769<?php 
    68 } 
    69  
    70 function check_writeable_dir( $dir, $ret ) { 
    71         if( is_writeable( $dir  ) == false ) { 
    72                 print $dir." : <b style='color: #f55'>FAILED</b><br />Quick Fix: <code>chmod 777 $dir</code><br />"; 
    73                 return false; 
    74         } else { 
    75                 if( $ret == true ) { 
    76                         return true; 
    77                 } else { 
    78                         return false; 
    79                 } 
    80         } 
    8170} 
    8271 
    8372function filestats( $err ) { 
    8473        print "<h1>Server Summary</h1>"; 
    85         print "<p>If you post a message to the MU support forum at <a target='_blank' href='http://mu.wordpress.org/forums/'>http://mu.wordpress.org/forums/</a> then copy and paste the following information into your message:</p>"; 
     74        print "<p>If you post a message to the &micro; support forum at <a target='_blank' href='http://mu.wordpress.org/forums/'>http://mu.wordpress.org/forums/</a> then copy and paste the following information into your message:</p>"; 
    8675 
    8776        print "<blockquote style='background: #eee; border: 1px solid #333; padding: 5px;'>"; 
     
    173162 
    174163function checkdirs() { 
     164        global $dirs; 
     165 
    175166        $ret = true; 
    176         $ret = check_writeable_dir( dirname(__FILE__), $ret ); 
    177         $ret = check_writeable_dir( dirname(__FILE__) . "/wp-content/", $ret ); 
    178  
    179         if( $ret == false ) { 
    180                 print "<h2>Warning!</h2>"; 
    181                 print "<div style='border: 1px solid #ccc'>"; 
    182                 print "<p style='font-weight: bold; padding-left: 10px'>One or more of the above directories must be made writeable by the webserver.<br>"; 
    183                 print "Please <code>chmod 777 <q>directory-name</q></code> or <code>chown</code> that directory to the user the web server runs as (usually nobody, apache, or www-data)<br>"; 
    184                 print "Refresh this page when you're done!<br></p>"; 
    185                 print "</div>"; 
     167        foreach( $dirs as $dir ) { 
     168                if( false == is_writeable( $dir ) ) { 
     169                        $err[] = $dir; 
     170                } 
     171        } 
     172 
     173        if( is_array( $err ) ) { 
     174                ?><h2>Warning!</h2> 
     175                <div style='border: 1px solid #ccc'> 
     176                <p style='font-weight: bold; padding-left: 10px'>One or more of the directories must be made writeable by the webserver. You will be reminded to reset the permissions at the end of the install.<br> 
     177                Please <code>chmod 777 <q>directory-name</q></code> or <code>chown</code> that directory to the user the web server runs as (usually nobody, apache, or www-data)<br> 
     178                Refresh this page when you're done!<br></p> 
     179                </div> 
     180                <p>Quick fix:<br /> <code>chmod&nbsp;777&nbsp;<?php 
     181                foreach( $err as $dir ) { 
     182                        echo "$dir&nbsp;"; 
     183                } 
     184                ?></code></p><?php 
     185                $ret = false; 
    186186        } 
    187187        if( file_exists( "./.htaccess" ) && is_writeable( "./.htaccess" ) == false ) { 
     
    197197 
    198198function step1() { 
    199         print "<h2>Installing WP&micro;</h2>"; 
     199        ?><h2>Installing WordPress &micro;</h2> 
     200        <p><strong>Welcome to WordPress &micro;.</strong> I will help you install this software by asking you a few questions and asking that you change the permissions on a few directories so I can create configuration files and make a directory to store all your uploaded files.</p> 
     201        <p>If you have installed the single-blog version of WordPress before, please note that the WordPress &micro; installer is different and trying to create the configuration file wp-config.php youself may result in a broken site. It's much easier to use this installer to get the job done.</p> 
     202        <h3>What do I need?</h3> 
     203        <p><ul><li>Access to your server to change directory permissions. This can be done through ssh or ftp for example.</li><li>A valid email where your password and administrative emails will be sent.</li><li>An empty MySQL database.Tables are prefixed with <code>wp_</code> which may conflict with an existing WordPress install.</li><li> Wildcard dns records if you're going to use the virtual host functionality. Check the <a href='http://trac.mu.wordpress.org/browser/trunk/README.txt'>README</a> for further details.</li></ul><p> 
     204        <?php 
    200205        $mod_rewrite_msg = "<p>If the <code>mod_rewrite</code> module is disabled ask your administrator to enable that module, or look at the <a href='http://httpd.apache.org/docs/mod/mod_rewrite.html'>Apache documentation</a> or <a href='http://www.google.com/search?q=apache+mod_rewrite'>elsewhere</a> for help setting it up.</p>"; 
    201206        if( function_exists( "apache_get_modules" ) ) { 
     
    228233 
    229234function printstep1form( $dbname = 'wordpress', $uname = 'username', $pwd = 'password', $dbhost = 'localhost', $vhost = 'yes', $prefix = 'wp_' ) { 
    230         $weblog_title = 'My new WPMU Site'; 
     235        $weblog_title = 'My new WordPress MU Site'; 
    231236        $email = ''; 
    232237        $hostname = $_SERVER[ 'HTTP_HOST' ]; 
     
    237242    <input type='hidden' name='action' value='step2'> 
    238243    <h2>Blog Addresses</h2> 
    239         <p>Please choose whether you would like blogs for the MU install to use sub-domains or sub-directories. You can not change this later. We recommend sub-domains.</p> 
     244        <p>Please choose whether you would like blogs for the WordPress &micro; install to use sub-domains or sub-directories. You can not change this later. We recommend sub-domains.</p> 
    240245        <p><label><input type='radio' name='vhost' value='yes' <?php if( $vhost == 'yes' ) echo 'checked '; ?> /> Sub-domains (like <code>blog1.example.com</code>)</label><br /> 
    241246        <label><input type='radio' name='vhost' value='no' <?php if( $vhost == 'no' ) echo 'checked '; ?> /> Sub-directories (like <code>example.com/blog1</code></label></p> 
     
    308313        printheader(); 
    309314 
    310         print "Creating Database Config File: "; 
    311  
    312315        $handle = fopen('wp-config.php', 'w'); 
    313316 
     
    342345        fclose($handle); 
    343346        chmod('wp-config.php', 0644); 
    344         print "<b style='color: #00aa00; font-weight: bold'>DONE</b><br />"; 
    345347        define( 'VHOST', $vhost ); 
    346348} 
    347349 
    348350function step3() { 
    349         global $wpdb, $current_site
     351        global $wpdb, $current_site, $dirs, $wp_version
    350352        $base = stripslashes( dirname( $_SERVER["SCRIPT_NAME"] ) ); 
    351353        if( $base != "/") { 
     
    399401        update_blog_option( 1, 'permalink_structure', '/blog/%year%/%monthnum%/%day%/%postname%/'); 
    400402        update_blog_option( 1, 'rewrite_rules', ''); 
    401         $msg = "Your new WPMU site has been created at\nhttp://{$domain}{$base}\n\nLogin details:\nUsername: admin\nPassword: $pass\nLogin: http://{$domain}{$base}wp-login.php\n"; 
    402         wp_mail( $email, "Your new WPMU site is ready!", $msg, "From: wordpress@" . $_SERVER[ 'HTTP_HOST' ]  ); 
    403         print "<p>Congrats! Your <a href='http://{$domain}{$base}'>WPMU site</a> has been set up and you have been sent details of your login and password in an email.</p>"; 
    404         print "<p>You can <a href='wp-login.php'>log in</a> using the username 'admin' and password '{$pass}'</p>"; 
     403        $msg = "Your new WordPress MU site has been created at\nhttp://{$domain}{$base}\n\nLogin details:\nUsername: admin\nPassword: $pass\nLogin: http://{$domain}{$base}wp-login.php\n"; 
     404        wp_mail( $email, "Your new WordPress MU site is ready!", $msg, "From: wordpress@" . $_SERVER[ 'HTTP_HOST' ]  ); 
     405        ?><h2>Installation Finished!</h2> 
     406        <p>Congratulations! Your <a href='http://<?php echo $domain . $base; ?>'>WordPress &micro; site</a> has been configured.</p> 
     407        <p>You can <a href='wp-login.php'>log in</a> using the username "admin" and password "<?php echo $pass; ?>"</p> 
     408        <h3>Directory Permissions</h3> 
     409        <p>Please remember to reset the permissions on the following directories:<ul> 
     410        <?php 
     411        reset( $dirs ); 
     412        foreach( $dirs as $dir ) { 
     413                echo "<li> $dir</li>"; 
     414        } 
     415        ?></ul></p> 
     416        <p>You can probably use the following command to fix the permissions but check with your host if it doubt:<br /><code>chmod&nbsp;755&nbsp;<?php 
     417        reset( $dirs ); 
     418        foreach( $dirs as $dir ) { 
     419                echo "$dir&nbsp;"; 
     420        } 
     421        ?></code></p> 
     422        <h3>Further reading</h3> 
     423        <p><ul><li>If you run into problems, please search the <a href='http://mu.wordpress.org/forums/'>WordPress &micro; Forums</a> where you will most likely find a solution. Please don't post there before searching. It's not polite.</li> 
     424        <li>There is also the <a href='http://trac.mu.wordpress.org/'>WordPress &micro; Trac</a>. That's our bug tracker.</li></ul></p> 
     425        <p>Thanks for installing WordPress &micro;!<br /><br /> 
     426         
     427        Donncha<br /> 
     428        <code>wpmu version: <?php echo $wp_version ?></code></p> 
     429        <?php 
    405430} 
    406431 
     
    409434        ?> 
    410435        <h1>No-www</h1> 
    411         <p>WordPress MU 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 <em><?php echo $_POST[ 'basedomain' ] ?></em> but any links will not have the "www" prefix. They will instead point at <?php echo $nowww ?>.</p> 
     436        <p>WordPress &micro; 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 <em><?php echo $_POST[ 'basedomain' ] ?></em> but any links will not have the "www" prefix. They will instead point at <?php echo $nowww ?>.</p> 
    412437        <p>The preferred method of hosting blogs is without the "www" prefix as it's more compact and simple.</p><p>You can still use "<?php echo $_POST[ 'basedomain' ] ?>" and URLs like "www.blog1.<?php echo $nowww; ?>" to address your site and blogs after installation but internal links will use the <?php echo $nowww ?> format.</p> 
    413438        <p><a target='_blank' href="http://no-www.org/">www. is depreciated</a> has a lot more information on why 'www.' isn't needed any more.</p>