Note recent PG changes.
[lhc/web/wiklou.git] / config / index.php
index d9507cc..29250a4 100644 (file)
@@ -343,33 +343,8 @@ if( ini_get( "safe_mode" ) ) {
 }
 
 $sapi = php_sapi_name();
-$conf->prettyURLs = true;
 print "<li>PHP server API is $sapi; ";
-switch( $sapi ) {
-case "apache":
-case "apache2handler":
-       print "ok, using pretty URLs (<tt>index.php/Page_Title</tt>)";
-       break;
-case "cgi":
-case "cgi-fcgi":
-       // For some reason cgi.fix_pathinfo isn't retrievable via ini_get()
-       if( isset( $_SERVER['ORIG_PATH_INFO'] ) ) {
-               echo "cgi.fix_pathinfo is set, good; ";
-       } else {
-               echo "cgi.fix_pathinfo is not set, assuming PATH_INFO broken; ";
-               $conf->prettyURLs = false;
-       }
-       break;
-case "apache2filter":
-case "isapi":
-       // Pretty sure these two break from past tests
-       $conf->prettyURLs = false;
-       break;
-default:
-       print "unknown, assuming PATH_INFO broken for safety; ";
-       $conf->prettyURLs = false;
-}
-if( $conf->prettyURLs ) {
+if( $wgUsePathInfo ) {
        print "ok, using pretty URLs (<tt>index.php/Page_Title</tt>)";
 } else {
        print "using ugly URLs (<tt>index.php?title=Page_Title</tt>)";
@@ -440,7 +415,7 @@ if ( $conf->eaccel ) {
 
 if( !$conf->turck && !$conf->eaccel && !$conf->apc ) {
        echo( '<li>Couldn\'t find <a href="http://turck-mmcache.sourceforge.net">Turck MMCache</a>,
-               <a href="http://eaccelerator.sourceforge.net">eAccelerator</a> or
+               <a href="http://eaccelerator.sourceforge.net">eAccelerator</a>, or
                <a href="http://www.php.net/apc">APC</a>. Object caching functions cannot be used.</li>' );
 }
 
@@ -529,7 +504,8 @@ print "<li style='font-weight:bold;color:green;font-size:110%'>Environment check
        $conf->SysopPass = importPost( "SysopPass" );
        $conf->SysopPass2 = importPost( "SysopPass2" );
        $conf->RootUser = importPost( "RootUser", "root" );
-       $conf->RootPW = importPost( "RootPW", "-" );
+       $conf->RootPW = importPost( "RootPW", "" );
+       $useRoot = importCheck( 'useroot', false );
 
        ## MySQL specific:
        $conf->DBprefix     = importPost( "DBprefix" );
@@ -664,8 +640,6 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) {
                require_once( "includes/Setup.php" );
                chdir( "config" );
 
-               require_once( "maintenance/InitialiseMessages.inc" );
-
                $wgTitle = Title::newFromText( "Installation script" );
                error_reporting( E_ALL );
                print "<li>Loading class: $dbclass";
@@ -682,16 +656,13 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) {
                        $ok = true; # Let's be optimistic
                        
                        # Decide if we're going to use the superuser or the regular database user
-                       if( $conf->RootPW == '-' ) {
-                               # Regular user
-                               $conf->Root = false;
-                               $db_user = $wgDBuser;
-                               $db_pass = $wgDBpassword;
-                       } else {
-                               # Superuser
-                               $conf->Root = true;
+                       $conf->Root = $useRoot;
+                       if( $conf->Root ) {
                                $db_user = $conf->RootUser;
                                $db_pass = $conf->RootPW;
+                       } else {
+                               $db_user = $wgDBuser;
+                               $db_pass = $wgDBpassword;
                        }
                        
                        # Attempt to connect
@@ -742,7 +713,7 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) {
                        error_reporting( E_ALL );
                        $wgSuperUser = '';
                        ## Possible connect as a superuser
-                       if( $conf->RootPW != '-' and strlen($conf->RootPW)) {
+                       if( $conf->Root ) {
                                $wgDBsuperuser = $conf->RootUser;
                                echo( "<li>Attempting to connect to database \"postgres\" as superuser \"$wgDBsuperuser\"..." );
                                $wgDatabase = $dbc->newFromParams($wgDBserver, $wgDBsuperuser, $conf->RootPW, "postgres", 1);
@@ -795,11 +766,16 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) {
                                print "<li>Database <tt>" . htmlspecialchars( $wgDBname ) . "</tt> exists</li>\n";
                        } else {
                                $err = mysql_errno();
-                               if ( $err != 1049 ) {
-                                       print "<ul><li>Error selecting database $wgDBname: $err " .
-                                               htmlspecialchars( mysql_error() ) . "</li></ul>";
+                               $databaseSafe = htmlspecialchars( $wgDBname );
+                               if( $err == 1102 /* Invalid database name */ ) {
+                                       print "<ul><li><strong>{$databaseSafe}</strong> is not a valid database name.</li></ul>";
+                                       continue;
+                               } elseif( $err != 1049 /* Database doesn't exist */ ) {
+                                       print "<ul><li>Error selecting database <strong>{$databaseSafe}</strong>: {$err} ";
+                                       print htmlspecialchars( mysql_error() ) . "</li></ul>";
                                        continue;
                                }
+                               print "<li>Attempting to create database...</li>";
                                $res = $wgDatabase->query( "CREATE DATABASE `$wgDBname`" );
                                if( !$res ) {
                                        print "<li>Couldn't create database <tt>" .
@@ -931,8 +907,6 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) {
                                ) );
                        $revid = $revision->insertOn( $wgDatabase );
                        $article->updateRevisionOn( $wgDatabase, $revision );
-
-                       initialiseMessages( false, false, 'printListItem' );
                }
 
                /* Write out the config file now that all is well */
@@ -1013,7 +987,7 @@ if( count( $errs ) ) {
                </select>
        </div>
        <p class="config-desc">
-               Select the language for your wiki's interface. Some localizations aren't fully complete. Unicode (UTF-8) used for all localizations.
+               Select the language for your wiki's interface. Some localizations aren't fully complete. Unicode (UTF-8) is used for all localizations.
        </p>
 
        <div class="config-input">
@@ -1032,7 +1006,7 @@ if( count( $errs ) ) {
                        ?>
                <?php if( $conf->License == "cc" ) { ?>
                        <ul>
-                               <li><?php aField( $conf, "RightsIcon", "<img src=\"" . htmlspecialchars( $conf->RightsIcon ) . "\" alt='icon' />", "hidden" ); ?></li>
+                               <li><?php aField( $conf, "RightsIcon", "<img src=\"" . htmlspecialchars( $conf->RightsIcon ) . "\" alt='(Creative Commons icon)' />", "hidden" ); ?></li>
                                <li><?php aField( $conf, "RightsText", htmlspecialchars( $conf->RightsText ), "hidden" ); ?></li>
                                <li><?php aField( $conf, "RightsCode", "code: " . htmlspecialchars( $conf->RightsCode ), "hidden" ); ?></li>
                                <li><?php aField( $conf, "RightsUrl", "<a href=\"" . htmlspecialchars( $conf->RightsUrl ) . "\">" . htmlspecialchars( $conf->RightsUrl ) . "</a>", "hidden" ); ?></li>
@@ -1089,7 +1063,7 @@ if( count( $errs ) ) {
        <p class="config-desc">
                Using a shared memory system such as Turck MMCache, APC, eAccelerator, or Memcached 
                will speed up MediaWiki significantly. Memcached is the best solution but needs to be
-               installed. Specify the server addresses and ports in a comma-separted list. Only
+               installed. Specify the server addresses and ports in a comma-separated list. Only
                use Turck shared memory if the wiki will be running on a single Apache server.
        </p>
 </div>
@@ -1105,7 +1079,7 @@ if( count( $errs ) ) {
                </ul>
        </div>
        <p class="config-desc">
-               Use this to disable all e-mail functions (password reminders, user-to-user e-mail and e-mail notifications)
+               Use this to disable all e-mail functions (password reminders, user-to-user e-mail, and e-mail notifications)
                if sending mail doesn't work on your server.
        </p>
 
@@ -1183,12 +1157,17 @@ if( count( $errs ) ) {
                enter those here. If you have database root access (see below)
                you can specify new accounts/databases to be created. This account 
                will not be created if it pre-exists. If this is the case, ensure that it
-               has SELECT, INSERT, UPDATE and DELETE permissions on the MediaWiki database.
+               has SELECT, INSERT, UPDATE, and DELETE permissions on the MediaWiki database.
        </p>
 
+       <div class="config-input">
+               <label class="column">Superuser account:</label>
+               <input type="checkbox" name="useroot" id="useroot" <?php if( $useRoot ) { ?>checked="checked" <?php } ?>/>
+               &nbsp;<label for="useroot">Use superuser account</label>
+       </div>
        <div class="config-input">
                <?php
-               aField( $conf, "RootUser", "Superuser account:", "superuser" );
+               aField( $conf, "RootUser", "Superuser name:", "superuser" );
                ?>
        </div>
        <div class="config-input">
@@ -1199,8 +1178,8 @@ if( count( $errs ) ) {
        
        <p class="config-desc">
                If the database user specified above does not exist, or does not have access to create
-               the database (if needed) or tables within it, please provide details of a superuser account,
-               such as <strong>root</strong>, which does. Leave the password set to <strong>-</strong> if this is not needed.
+               the database (if needed) or tables within it, please check the box and provide details
+               of a superuser account, such as <strong>root</strong>, which does.
        </p>
 
        <?php database_switcher('mysql'); ?>
@@ -1209,7 +1188,7 @@ if( count( $errs ) ) {
        ?></div>
        <div class="config-desc">
                <p>If you need to share one database between multiple wikis, or
-               MediaWiki and another web application, you may choose to
+               between MediaWiki and another web application, you may choose to
                add a prefix to all the table names to avoid conflicts.</p>
 
                <p>Avoid exotic characters; something like <tt>mw_</tt> is good.</p>
@@ -1242,8 +1221,9 @@ if( count( $errs ) ) {
                aField( $conf, "DBts2schema", "Schema for tsearch2:" );
        ?></div>
        <div class="config-desc">
-               <p>The username specified above will have it's search path set to the above schemas, 
-               so it is recommended that you create a new user.</p>
+               <p>The username specified above (at "DB username") will have its search path set to the above schemas, 
+               so it is recommended that you create a new user. The above schemas are generally correct: 
+        only change them if you are sure you need to.</p>
        </div>
        </div>
 
@@ -1309,8 +1289,6 @@ function writeLocalSettings( $conf ) {
        $zlib = ($conf->zlib ? "" : "# ");
        $magic = ($conf->ImageMagick ? "" : "# ");
        $convert = ($conf->ImageMagick ? $conf->ImageMagick : "/usr/bin/convert" );
-       $pretty = ($conf->prettyURLs ? "" : "# ");
-       $ugly = ($conf->prettyURLs ? "# " : "");
        $rights = ($conf->RightsUrl) ? "" : "# ";
        $hashedUploads = $conf->safeMode ? '' : '# ';
 
@@ -1410,28 +1388,12 @@ if ( \$wgCommandLineMode ) {
 
 \$wgSitename         = \"{$slconf['Sitename']}\";
 
+## The URL base path to the directory containing the wiki;
+## defaults for all runtime URL paths are based off of this.
 \$wgScriptPath       = \"{$slconf['ScriptPath']}\";
-\$wgScript           = \"\$wgScriptPath/index.php\";
-\$wgRedirectScript   = \"\$wgScriptPath/redirect.php\";
 
 ## For more information on customizing the URLs please see:
-## http://meta.wikimedia.org/wiki/Eliminating_index.php_from_the_url
-
-## 'Pretty' URLs using PATH_INFO work on most configurations with
-## PHP configured as an Apache module.
-{$pretty}\$wgArticlePath      = \"\$wgScript/\$1\";
-
-## If using PHP as a CGI module, the ?title= style might have to be used
-## depending on the configuration. If it fails, try enabling the option
-## cgi.fix_pathinfo in php.ini, then switch to pretty URLs.
-{$ugly}\$wgArticlePath      = \"\$wgScript?title=\$1\";
-
-\$wgStylePath        = \"\$wgScriptPath/skins\";
-\$wgStyleDirectory   = \"\$IP/skins\";
-\$wgLogo             = \"\$wgStylePath/common/images/wiki.png\";
-
-\$wgUploadPath       = \"\$wgScriptPath/images\";
-\$wgUploadDirectory  = \"\$IP/images\";
+## http://www.mediawiki.org/wiki/Manual:Short_URL
 
 \$wgEnableEmail      = $enableemail;
 \$wgEnableUserEmail  = $enableuseremail;
@@ -1483,9 +1445,6 @@ if ( \$wgCommandLineMode ) {
 ## If you have the appropriate support software installed
 ## you can enable inline LaTeX equations:
 \$wgUseTeX           = false;
-\$wgMathPath         = \"{\$wgUploadPath}/math\";
-\$wgMathDirectory    = \"{\$wgUploadDirectory}/math\";
-\$wgTmpDirectory     = \"{\$wgUploadDirectory}/tmp\";
 
 \$wgLocalInterwiki   = \$wgSitename;
 
@@ -1540,6 +1499,10 @@ function importPost( $name, $default = "" ) {
        return importVar( $_POST, $name, $default );
 }
 
+function importCheck( $name ) {
+       return isset( $_POST[$name] );
+}
+
 function importRequest( $name, $default = "" ) {
        return importVar( $_REQUEST, $name, $default );
 }
@@ -1752,7 +1715,7 @@ function printListItem( $item ) {
                        <li><a href="http://meta.wikipedia.org/wiki/MediaWiki_User's_Guide">User's Guide</a></li>
                        <li><a href="http://meta.wikimedia.org/wiki/MediaWiki_FAQ">FAQ</a></li>
                </ul>
-               <p style="font-size:90%;margin-top:1em">MediaWiki is Copyright &copy; 2001-2006 by Magnus Manske, Brion Vibber, Lee Daniel Crocker, Tim Starling, Erik M&ouml;ller, Gabriel Wicke and others.</p>
+               <p style="font-size:90%;margin-top:1em">MediaWiki is Copyright &copy; 2001-2007 by Magnus Manske, Brion Vibber, Lee Daniel Crocker, Tim Starling, Erik M&ouml;ller, Gabriel Wicke and others.</p>
        </div></div>
 </div>