# Define an entry point and include some files
define( "MEDIAWIKI", true );
define( "MEDIAWIKI_INSTALL", true );
+
+// Run version checks before including other files
+// so people don't see a scary parse error.
+require_once( "install-utils.inc" );
+install_version_checks();
+
require_once( "includes/Defines.php" );
require_once( "includes/DefaultSettings.php" );
require_once( "includes/MagicWord.php" );
<pre>
cd <i>/path/to/wiki</i>
chmod a+w config
- </pre>" );
+ </pre>
+
+ <p>Afterwards retry to start the <a href=\"\">setup</a>.</p>" );
}
}
$sapi = php_sapi_name();
-$conf->prettyURLs = true;
print "<li>PHP server API is $sapi; ";
-switch( $sapi ) {
-case "apache":
-case "apache2handler":
+if( $wgUsePathInfo ) {
print "ok, using pretty URLs (<tt>index.php/Page_Title</tt>)";
- break;
-default:
- print "unknown; ";
-case "cgi":
-case "cgi-fcgi":
-case "apache2filter":
-case "isapi":
+} else {
print "using ugly URLs (<tt>index.php?title=Page_Title</tt>)";
- $conf->prettyURLs = false;
- break;
}
print "</li>\n";
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>' );
}
$conf->diff3 = false;
-$diff3locations = array( "/usr/bin", "/usr/local/bin", "/opt/csw/bin", "/usr/gnu/bin", "/usr/sfw/bin" ) + explode( $sep, getenv( "PATH" ) );
+$diff3locations = array_merge(
+ array(
+ "/usr/bin",
+ "/usr/local/bin",
+ "/opt/csw/bin",
+ "/usr/gnu/bin",
+ "/usr/sfw/bin" ),
+ explode( $sep, getenv( "PATH" ) ) );
$diff3names = array( "gdiff3", "diff3", "diff3.exe" );
$diff3versioninfo = array( '$1 --version 2>&1', 'diff3 (GNU diffutils)' );
$conf->IP = dirname( dirname( __FILE__ ) );
print "<li>Installation directory: <tt>" . htmlspecialchars( $conf->IP ) . "</tt></li>\n";
-$conf->ScriptPath = preg_replace( '{^(.*)/config.*$}', '$1', $_SERVER["PHP_SELF"] ); # was SCRIPT_NAME
+
+// PHP_SELF isn't available sometimes, such as when PHP is CGI but
+// cgi.fix_pathinfo is disabled. In that case, fall back to SCRIPT_NAME
+// to get the path to the current script... hopefully it's reliable. SIGH
+$path = ($_SERVER["PHP_SELF"] === '')
+ ? $_SERVER["SCRIPT_NAME"]
+ : $_SERVER["PHP_SELF"];
+$conf->ScriptPath = preg_replace( '{^(.*)/config.*$}', '$1', $path );
print "<li>Script URI path: <tt>" . htmlspecialchars( $conf->ScriptPath ) . "</tt></li>\n";
print "<li style='font-weight:bold;color:green;font-size:110%'>Environment checked. You can install MediaWiki.</li>\n";
$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" );
- $conf->DBmysql5 = (importPost( "DBmysql5" ) == "true") ? "true" : "false";
- $conf->LanguageCode = importPost( "LanguageCode", "en" );
+ $conf->DBprefix = importPost( "DBprefix" );
+ $conf->DBschema = importPost( "DBschema", "mysql4" );
+ $conf->DBmysql5 = ($conf->DBschema == "mysql5" ||
+ $conf->DBschema == "mysql5-binary")
+ ? "true" : "false";
+ $conf->LanguageCode = importPost( "LanguageCode", "en" );
## Postgres specific:
$conf->DBport = importPost( "DBport", "5432" );
/* Load up the settings and get installin' */
$local = writeLocalSettings( $conf );
+ echo "<li style=\"list-style: none\">\n";
echo "<p><b>Generating configuration file...</b></p>\n";
- // for debugging: // echo "<pre>" . htmlspecialchars( $local ) . "</pre>\n";
-
+ echo "</li>\n";
+
$wgCommandLineMode = false;
chdir( ".." );
- eval($local);
+ $ok = eval( $local );
+ if( $ok === false ) {
+ dieout( "Errors in generated configuration; " .
+ "most likely due to a bug in the installer... " .
+ "Config file was: " .
+ "<pre>" .
+ htmlspecialchars( $local ) .
+ "</pre>" .
+ "</ul>" );
+ }
$conf->DBtypename = '';
foreach (array_keys($ourdb) as $db) {
if ($conf->DBtype === $db)
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";
$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
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);
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>" .
dbsource( "../maintenance/users.sql", $wgDatabase );
}
}
- if ( $conf->DBtype == 'mysql') {
- print "<pre>\n";
- chdir( ".." );
- flush();
- do_all_updates();
- chdir( "config" );
- print "</pre>\n";
- }
+ print "<pre>\n";
+ chdir( ".." );
+ flush();
+ do_all_updates();
+ chdir( "config" );
+ print "</pre>\n";
print "<li>Finished update checks.</li>\n";
} else {
# FIXME: Check for errors
print "<li>Creating tables...";
if ($conf->DBtype == 'mysql') {
- if( $wgDBmysql5 ) {
- print " using MySQL 5 table defs...";
- dbsource( "../maintenance/mysql5/tables.sql", $wgDatabase );
- } else {
+ switch( $conf->DBschema ) {
+ case "mysql4":
print " using MySQL 4 table defs...";
dbsource( "../maintenance/tables.sql", $wgDatabase );
+ break;
+ case "mysql5":
+ print " using MySQL 5 UTF-8 table defs...";
+ dbsource( "../maintenance/mysql5/tables.sql", $wgDatabase );
+ break;
+ case "mysql5-binary":
+ print " using MySQL 5 binary table defs...";
+ dbsource( "../maintenance/mysql5/tables-binary.sql", $wgDatabase );
+ break;
+ default:
+ dieout( " <b>invalid schema selection!</b></li>" );
}
dbsource( "../maintenance/interwiki.sql", $wgDatabase );
} else if ($conf->DBtype == 'postgres') {
print " done.</li>\n";
- print "<li>Initializing data...";
+ print "<li>Initializing data...</li>\n";
$wgDatabase->insert( 'site_stats',
array ( 'ss_row_id' => 1,
'ss_total_views' => 0,
if( $wgDatabase2->isOpen() ) {
# Nope, just close the test connection and continue
$wgDatabase2->close();
- echo( "<li>User $wgDBuser exists. Skipping grants.</li>" );
+ echo( "<li>User $wgDBuser exists. Skipping grants.</li>\n" );
} else {
# Yes, so run the grants
echo( "<li>Granting user permissions to $wgDBuser on $wgDBname..." );
dbsource( "../maintenance/users.sql", $wgDatabase );
- echo( "success.</li>" );
+ echo( "success.</li>\n" );
}
}
if( $conf->SysopName ) {
$u = User::newFromName( $conf->getSysopName() );
- if ( 0 == $u->idForName() ) {
+ if ( !$u ) {
+ print "<li><strong class=\"error\">Warning:</strong> Skipped sysop account creation - invalid username!</li>\n";
+ }
+ else if ( 0 == $u->idForName() ) {
$u->addToDatabase();
$u->setPassword( $conf->getSysopPass() );
$u->saveSettings();
) );
$revid = $revision->insertOn( $wgDatabase );
$article->updateRevisionOn( $wgDatabase, $revision );
-
- initialiseMessages( false, false, 'printListItem' );
}
/* Write out the config file now that all is well */
+ print "<li style=\"list-style: none\">\n";
print "<p>Creating LocalSettings.php...</p>\n\n";
$localSettings = "<" . "?php$endl$local$endl?" . ">\r\n";
// Fix up a common line-ending problem (due to CVS on Windows)
die("<p class='error'>An error occured while writing the config/LocalSettings.php file. Check user rights and disk space then try again.</p>\n");
}
+ print "</li>\n";
} while( false );
}
</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">
?>
<?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>
<?php aField( $conf, "SysopPass2", "Password confirm:", "password" ) ?>
</div>
<p class="config-desc">
- An admin can lock/delete pages, block users from editing, and other maintenance tasks.<br />
+ An admin can lock/delete pages, block users from editing, and do other maintenance tasks.<br />
A new account will be added only when creating a new wiki database.
</p>
<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>
</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>
<p class="config-desc">
If you only have a single user account and database available,
enter those here. If you have database root access (see below)
- you can specify new accounts/databases to be created.
+ 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.
</p>
- <p>
- 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.
+
+ <div class="config-input">
+ <label class="column">Superuser account:</label>
+ <input type="checkbox" name="useroot" id="useroot" <?php if( $useRoot ) { ?>checked="checked" <?php } ?>/>
+ <label for="useroot">Use superuser account</label>
+ </div>
+ <div class="config-input">
+ <?php
+ aField( $conf, "RootUser", "Superuser name:", "superuser" );
+ ?>
+ </div>
+ <div class="config-input">
+ <?php
+ aField( $conf, "RootPW", "Superuser password:", "password" );
+ ?>
+ </div>
+
+ <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 check the box and provide details
+ of a superuser account, such as <strong>root</strong>, which does.
</p>
<?php database_switcher('mysql'); ?>
?></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>
<div class="config-input"><label class="column">Database charset</label>
<div>Select one:</div>
<ul class="plain">
- <li><?php aField( $conf, "DBmysql5", "Backwards-compatible UTF-8", "radio", "false" ); ?></li>
- <li><?php aField( $conf, "DBmysql5", "Experimental MySQL 4.1/5.0 UTF-8", "radio", "true" ); ?></li>
+ <li><?php aField( $conf, "DBschema", "Backwards-compatible UTF-8", "radio", "mysql4" ); ?></li>
+ <li><?php aField( $conf, "DBschema", "Experimental MySQL 4.1/5.0 UTF-8", "radio", "mysql5" ); ?></li>
+ <li><?php aField( $conf, "DBschema", "Experimental MySQL 4.1/5.0 binary", "radio", "mysql5-binary" ); ?></li>
</ul>
</div>
<p class="config-desc">
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>
- <div class="config-input">
- <?php
- aField( $conf, "RootUser", "Superuser account:", "superuser" );
- ?>
- </div>
- <div class="config-input">
- <?php
- aField( $conf, "RootPW", "Superuser password:", "password" );
- ?>
- </div>
-
- <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.
- </p>
-
<div class="config-input" style="padding:2em 0 3em">
<label class='column'> </label>
<input type="submit" value="Install MediaWiki!" class="btn-install" />
it and uploading it again will hopefully change the ownership to a user ID specific to you.</p>
EOT;
} else {
- echo "<p>Installation successful! Move the config/LocalSettings.php file into the parent directory, then follow
- <a href='../index.php'>this link</a> to your wiki.</p>\n";
+ echo "<p><span style='font-weight:bold;color:green;font-size:110%'>Installation successful!</span> Move the <tt>config/LocalSettings.php</tt> file into the parent directory, then follow
+ <strong><a href='../index.php'>this link</a></strong> to your wiki.</p>\n";
}
}
$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 ? '' : '# ';
\$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
-## If using PHP as a CGI module, the ?title= style usually must be used.
-{$pretty}\$wgArticlePath = \"\$wgScript/\$1\";
-{$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;
\$wgEnotifWatchlist = $enotifwatchlist; # UPO
\$wgEmailAuthentication = $eauthent;
+\$wgDBtype = \"{$slconf['DBtype']}\";
\$wgDBserver = \"{$slconf['DBserver']}\";
\$wgDBname = \"{$slconf['DBname']}\";
\$wgDBuser = \"{$slconf['DBuser']}\";
\$wgDBpassword = \"{$slconf['DBpassword']}\";
-\$wgDBprefix = \"{$slconf['DBprefix']}\";
-\$wgDBtype = \"{$slconf['DBtype']}\";
\$wgDBport = \"{$slconf['DBport']}\";
+\$wgDBprefix = \"{$slconf['DBprefix']}\";
+
+# Schemas for Postgres
+\$wgDBmwschema = \"{$slconf['DBmwschema']}\";
+\$wgDBts2schema = \"{$slconf['DBts2schema']}\";
# Experimental charset support for MySQL 4.1/5.0.
\$wgDBmysql5 = {$conf->DBmysql5};
## 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;
return importVar( $_POST, $name, $default );
}
+function importCheck( $name ) {
+ return isset( $_POST[$name] );
+}
+
function importRequest( $name, $default = "" ) {
return importVar( $_REQUEST, $name, $default );
}
$codes = array();
- $d = opendir( "../languages" );
+ $d = opendir( "../languages/messages" );
/* In case we are called from the root directory */
if (!$d)
- $d = opendir( "languages");
+ $d = opendir( "languages/messages");
while( false !== ($f = readdir( $d ) ) ) {
$m = array();
if( preg_match( '/Messages([A-Z][a-z_]+)\.php$/', $f, $m ) ) {
<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 © 2001-2006 by Magnus Manske, Brion Vibber, Lee Daniel Crocker, Tim Starling, Erik Möller, Gabriel Wicke and others.</p>
+ <p style="font-size:90%;margin-top:1em">MediaWiki is Copyright © 2001-2007 by Magnus Manske, Brion Vibber, Lee Daniel Crocker, Tim Starling, Erik Möller, Gabriel Wicke and others.</p>
</div></div>
</div>