3 # MediaWiki web-based config/installation
4 # Copyright (C) 2004 Brion Vibber <brion@pobox.com>, 2006 Rob Church <robchur@gmail.com>
5 # http://www.mediawiki.org/
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along
18 # with this program; if not, write to the Free Software Foundation, Inc.,
19 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 # http://www.gnu.org/copyleft/gpl.html
22 error_reporting( E_ALL );
23 header( "Content-type: text/html; charset=utf-8" );
24 @ini_set( "display_errors", true );
26 # In case of errors, let output be clean.
27 $wgRequestTime = microtime( true );
29 # Attempt to set up the include path, to fix problems with relative includes
30 $IP = dirname( dirname( __FILE__ ) );
31 define( 'MW_INSTALL_PATH', $IP );
33 # Define an entry point and include some files
34 define( "MEDIAWIKI", true );
35 define( "MEDIAWIKI_INSTALL", true );
37 // Run version checks before including other files
38 // so people don't see a scary parse error.
39 require_once( "$IP/install-utils.inc" );
40 install_version_checks();
42 require_once( "$IP/includes/Defines.php" );
43 require_once( "$IP/includes/DefaultSettings.php" );
44 require_once( "$IP/includes/AutoLoader.php" );
45 require_once( "$IP/includes/MagicWord.php" );
46 require_once( "$IP/includes/Namespace.php" );
47 require_once( "$IP/includes/ProfilerStub.php" );
48 require_once( "$IP/includes/GlobalFunctions.php" );
49 require_once( "$IP/includes/Hooks.php" );
51 # If we get an exception, the user needs to know
53 $wgShowExceptionDetails = true;
55 ## Databases we support:
58 $ourdb['mysql']['fullname'] = 'MySQL';
59 $ourdb['mysql']['havedriver'] = 0;
60 $ourdb['mysql']['compile'] = 'mysql';
61 $ourdb['mysql']['bgcolor'] = '#ffe5a7';
62 $ourdb['mysql']['rootuser'] = 'root';
64 $ourdb['postgres']['fullname'] = 'PostgreSQL';
65 $ourdb['postgres']['havedriver'] = 0;
66 $ourdb['postgres']['compile'] = 'pgsql';
67 $ourdb['postgres']['bgcolor'] = '#aaccff';
68 $ourdb['postgres']['rootuser'] = 'postgres';
70 /*** SQLITE DISABLED -- USE MEDIAWIKI 1.15 */
71 #$ourdb['sqlite']['fullname'] = 'SQLite';
72 #$ourdb['sqlite']['havedriver'] = 0;
73 #$ourdb['sqlite']['compile'] = 'pdo_sqlite';
74 #$ourdb['sqlite']['bgcolor'] = '#b1ebb1';
75 #$ourdb['sqlite']['rootuser'] = '';
76 /************************************/
78 $ourdb['mssql']['fullname'] = 'MSSQL';
79 $ourdb['mssql']['havedriver'] = 0;
80 $ourdb['mssql']['compile'] = 'mssql not ready'; # Change to 'mssql' after includes/DatabaseMssql.php added;
81 $ourdb['mssql']['bgcolor'] = '#ffc0cb';
82 $ourdb['mssql']['rootuser'] = 'administrator';
85 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
86 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
88 <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
89 <meta name="robots" content="noindex,nofollow"/>
90 <title>MediaWiki <?php echo htmlspecialchars( $wgVersion ); ?> Installation</title>
91 <style type="text/css">
93 @import "../skins/monobook/main.css";
97 margin: 1em 0 1em 2.5em;
104 .config-section label.column {
116 zoom: 100%; /* IE hack */
119 .config-section .config-desc {
121 margin: 0 0 2em 18em;
126 .iput-text, .iput-password {
133 background-color: #fff;
141 background-color: #FFF0F0;
142 border: 2px solid red;
150 list-style-type: none;
151 list-style-image: none;
168 span.success-message {
178 <script type="text/javascript">
181 <?php foreach (array_keys($ourdb) as $db) {
182 echo "\n var i = document.getElementById('$db'); if (i) i.style.display='none';";
187 function toggleDBarea(id,defaultroot) {
189 var dbarea = document.getElementById(id);
190 if (dbarea) dbarea.style.display = (dbarea.style.display == 'none') ? 'block' : 'none';
191 var db = document.getElementById('RootUser');
193 <?php foreach (array_keys($ourdb) as $db) {
194 echo " if (id == '$db') { db.value = '".$ourdb[$db]['rootuser']."';}\n";
203 <div id="globalWrapper">
204 <div id="column-content">
206 <div id="bodyContent">
208 <h1>MediaWiki <?php print htmlspecialchars( $wgVersion ) ?> Installation</h1>
211 $mainListOpened = false; # Is the main list (environement checking) opend ? Used by dieout
213 /* Check for existing configurations and bug out! */
215 if( file_exists( "../LocalSettings.php" ) ) {
216 $script = defined('MW_INSTALL_PHP5_EXT') ? 'index.php5' : 'index.php';
217 dieout( "<p><strong>Setup has completed, <a href='../$script'>your wiki</a> is configured.</strong></p>
218 <p>Please delete the /config directory for extra security.</p>" );
221 if( file_exists( "./LocalSettings.php" ) ) {
222 writeSuccessMessage();
226 if( !is_writable( "." ) ) {
227 dieout( "<h2>Can't write config file, aborting</h2>
229 <p>In order to configure the wiki you have to make the <tt>config</tt> subdirectory
230 writable by the web server. Once configuration is done you'll move the created
231 <tt>LocalSettings.php</tt> to the parent directory, and for added safety you can
232 then remove the <tt>config</tt> subdirectory entirely.</p>
234 <p>To make the directory writable on a Unix/Linux system:</p>
237 cd <i>/path/to/wiki</i>
241 <p>Afterwards retry to start the <a href=\"\">setup</a>.</p>" );
245 require_once( "$IP/install-utils.inc" );
246 require_once( "$IP/maintenance/updaters.inc" );
249 function getEncoded( $data ) {
250 # removing latin1 support, no need...
253 function getSitename() { return $this->getEncoded( $this->Sitename ); }
254 function getSysopName() { return $this->getEncoded( $this->SysopName ); }
255 function getSysopPass() { return $this->getEncoded( $this->SysopPass ); }
257 function setSchema( $schema, $engine ) {
258 $this->DBschema = $schema;
259 if ( !preg_match( '/^\w*$/', $engine ) ){
262 switch ( $this->DBschema ) {
264 $this->DBTableOptions = "ENGINE=$engine, DEFAULT CHARSET=utf8";
265 $this->DBmysql5 = 'true';
267 case 'mysql5-binary':
268 $this->DBTableOptions = "ENGINE=$engine, DEFAULT CHARSET=binary";
269 $this->DBmysql5 = 'true';
272 $this->DBTableOptions = "TYPE=$engine";
273 $this->DBmysql5 = 'false';
275 $this->DBengine = $engine;
277 # Set the global for use during install
278 global $wgDBTableOptions;
279 $wgDBTableOptions = $this->DBTableOptions;
287 <b>Don't forget security updates!</b> Keep an eye on the
288 <a href="http://lists.wikimedia.org/mailman/listinfo/mediawiki-announce">low-traffic
289 release announcements mailing list</a>.
294 <h2>Checking environment...</h2>
295 <p><em>Please include all of the lines below when reporting installation problems.</em></p>
296 <ul class="env-check">
298 $mainListOpened = true;
302 define( 'MW_NO_OUTPUT_BUFFER', 1 );
303 $conf = new ConfigData;
305 install_version_checks();
306 $self = 'Installer'; # Maintenance script name, to please Setup.php
308 print "<li>PHP " . htmlspecialchars( phpversion() ) . " installed</li>\n";
310 error_reporting( 0 );
311 $phpdatabases = array();
312 foreach (array_keys($ourdb) as $db) {
313 $compname = $ourdb[$db]['compile'];
314 if( extension_loaded( $compname ) || ( mw_have_dl() && dl( "{$compname}." . PHP_SHLIB_SUFFIX ) ) ) {
315 array_push($phpdatabases, $db);
316 $ourdb[$db]['havedriver'] = 1;
319 error_reporting( E_ALL );
321 if (!$phpdatabases) {
322 print "Could not find a suitable database driver!<ul>";
323 foreach (array_keys($ourdb) AS $db) {
324 $comp = $ourdb[$db]['compile'];
325 $full = $ourdb[$db]['fullname'];
326 print "<li>For <b>$full</b>, compile PHP using <b>--with-$comp</b>, "
327 ."or install the $comp.so module</li>\n";
333 print "<li>Found database drivers for:";
335 foreach (array_keys($ourdb) AS $db) {
336 if ($ourdb[$db]['havedriver']) {
337 if ( $DefaultDBtype == '' ) {
338 $DefaultDBtype = $db;
340 print " ".$ourdb[$db]['fullname'];
345 if( wfIniGetBool( "register_globals" ) ) {
348 <div style="font-size:110%">
349 <strong class="error">Warning:</strong>
350 <strong>PHP's <tt><a href="http://php.net/register_globals">register_globals</a></tt> option is enabled. Disable it if you can.</strong>
352 MediaWiki will work, but your server is more exposed to PHP-based security vulnerabilities.
359 if( wfIniGetBool( "magic_quotes_runtime" ) ) {
361 ?><li class='error'><strong>Fatal: <a href='http://www.php.net/manual/en/ref.info.php#ini.magic-quotes-runtime'>magic_quotes_runtime</a> is active!</strong>
362 This option corrupts data input unpredictably; you cannot install or use
363 MediaWiki unless this option is disabled.</li>
367 if( wfIniGetBool( "magic_quotes_sybase" ) ) {
369 ?><li class='error'><strong>Fatal: <a href='http://www.php.net/manual/en/ref.sybase.php#ini.magic-quotes-sybase'>magic_quotes_sybase</a> is active!</strong>
370 This option corrupts data input unpredictably; you cannot install or use
371 MediaWiki unless this option is disabled.</li>
375 if( wfIniGetBool( "mbstring.func_overload" ) ) {
377 ?><li class='error'><strong>Fatal: <a href='http://www.php.net/manual/en/ref.mbstring.php#mbstring.overload'>mbstring.func_overload</a> is active!</strong>
378 This option causes errors and may corrupt data unpredictably;
379 you cannot install or use MediaWiki unless this option is disabled.</li>
383 if( wfIniGetBool( "zend.ze1_compatibility_mode" ) ) {
385 ?><li class="error"><strong>Fatal: <a href="http://www.php.net/manual/en/ini.core.php">zend.ze1_compatibility_mode</a> is active!</strong>
386 This option causes horrible bugs with MediaWiki; you cannot install or use
387 MediaWiki unless this option is disabled.</li>
393 dieout( "Cannot install MediaWiki." );
396 if( wfIniGetBool( "safe_mode" ) ) {
397 $conf->safeMode = true;
399 <li><b class='error'>Warning:</b> <strong>PHP's
400 <a href='http://www.php.net/features.safe-mode'>safe mode</a> is active.</strong>
401 You may have problems caused by this, particularly if using image uploads.
405 $conf->safeMode = false;
408 $sapi = htmlspecialchars( php_sapi_name() );
409 print "<li>PHP server API is $sapi; ";
410 $script = defined('MW_INSTALL_PHP5_EXT') ? 'index.php5' : 'index.php';
411 if( $wgUsePathInfo ) {
412 print "ok, using pretty URLs (<tt>$script/Page_Title</tt>)";
414 print "using ugly URLs (<tt>$script?title=Page_Title</tt>)";
418 $conf->xml = function_exists( "utf8_encode" );
420 print "<li>Have XML / Latin1-UTF-8 conversion support.</li>\n";
422 dieout( "PHP's XML module is missing; the wiki requires functions in
423 this module and won't work in this configuration.
424 If you're running Mandrake, install the php-xml package." );
427 # Check for session support
428 if( !function_exists( 'session_name' ) )
429 dieout( "PHP's session module is missing. MediaWiki requires session support in order to function." );
431 # session.save_path doesn't *have* to be set, but if it is, and it's
432 # not valid/writable/etc. then it can cause problems
433 $sessionSavePath = mw_get_session_save_path();
434 $ssp = htmlspecialchars( $sessionSavePath );
435 # Warn the user if it's not set, but let them proceed
436 if( !$sessionSavePath ) {
437 print "<li><strong>Warning:</strong> A value for <tt>session.save_path</tt>
438 has not been set in PHP.ini. If the default value causes problems with
439 saving session data, set it to a valid path which is read/write/execute
440 for the user your web server is running under.</li>";
441 } elseif ( is_dir( $sessionSavePath ) && is_writable( $sessionSavePath ) ) {
442 # All good? Let the user know
443 print "<li>Session save path (<tt>{$ssp}</tt>) appears to be valid.</li>";
445 # Something not right? Warn the user, but let them proceed
446 print "<li><strong>Warning:</strong> Your <tt>session.save_path</tt> value (<tt>{$ssp}</tt>)
447 appears to be invalid or is not writable. PHP needs to be able to save data to
448 this location for correct session operation.</li>";
451 # Check for PCRE support
452 if( !function_exists( 'preg_match' ) )
453 dieout( "The PCRE support module appears to be missing. MediaWiki requires the
454 Perl-compatible regular expression functions." );
456 $memlimit = ini_get( "memory_limit" );
457 $conf->raiseMemory = false;
458 if( empty( $memlimit ) || $memlimit == -1 ) {
459 print "<li>PHP is configured with no <tt>memory_limit</tt>.</li>\n";
461 print "<li>PHP's <tt>memory_limit</tt> is " . htmlspecialchars( $memlimit ) . ". ";
462 $n = intval( $memlimit );
463 if( preg_match( '/^([0-9]+)[Mm]$/', trim( $memlimit ), $m ) ) {
464 $n = intval( $m[1] * (1024*1024) );
466 if( $n < 20*1024*1024 ) {
467 print "Attempting to raise limit to 20M... ";
468 if( false === ini_set( "memory_limit", "20M" ) ) {
469 print "failed.<br /><b>" . htmlspecialchars( $memlimit ) . " seems too low, installation may fail!</b>";
471 $conf->raiseMemory = true;
478 $conf->turck = function_exists( 'mmcache_get' );
479 if ( $conf->turck ) {
480 print "<li><a href=\"http://turck-mmcache.sourceforge.net/\">Turck MMCache</a> installed</li>\n";
483 $conf->xcache = function_exists( 'xcache_get' );
485 print "<li><a href=\"http://trac.lighttpd.net/xcache/\">XCache</a> installed</li>\n";
487 $conf->apc = function_exists('apc_fetch');
489 print "<li><a href=\"http://www.php.net/apc\">APC</a> installed</li>\n";
492 $conf->eaccel = function_exists( 'eaccelerator_get' );
493 if ( $conf->eaccel ) {
494 $conf->turck = 'eaccelerator';
495 print "<li><a href=\"http://eaccelerator.sourceforge.net/\">eAccelerator</a> installed</li>\n";
498 $conf->dba = function_exists( 'dba_open' );
500 if( !( $conf->turck || $conf->eaccel || $conf->apc || $conf->xcache ) ) {
501 echo( '<li>Couldn\'t find <a href="http://turck-mmcache.sourceforge.net">Turck MMCache</a>,
502 <a href="http://eaccelerator.sourceforge.net">eAccelerator</a>,
503 <a href="http://www.php.net/apc">APC</a> or <a href="http://trac.lighttpd.net/xcache/">XCache</a>;
504 cannot use these for object caching.</li>' );
507 $conf->diff3 = false;
508 $diff3locations = array_merge(
515 explode( PATH_SEPARATOR, getenv( "PATH" ) ) );
516 $diff3names = array( "gdiff3", "diff3", "diff3.exe" );
518 $diff3versioninfo = array( '$1 --version 2>&1', 'diff3 (GNU diffutils)' );
519 foreach ($diff3locations as $loc) {
520 $exe = locate_executable($loc, $diff3names, $diff3versioninfo);
521 if ($exe !== false) {
528 print "<li>Found GNU diff3: <tt>$conf->diff3</tt>.</li>";
530 print "<li>GNU diff3 not found.</li>";
532 $conf->ImageMagick = false;
533 $imcheck = array( "/usr/bin", "/opt/csw/bin", "/usr/local/bin", "/sw/bin", "/opt/local/bin" );
534 foreach( $imcheck as $dir ) {
535 $im = "$dir/convert";
536 if( @file_exists( $im ) ) {
537 print "<li>Found ImageMagick: <tt>$im</tt>; image thumbnailing will be enabled if you enable uploads.</li>\n";
538 $conf->ImageMagick = $im;
543 $conf->HaveGD = function_exists( "imagejpeg" );
544 if( $conf->HaveGD ) {
545 print "<li>Found GD graphics library built-in";
546 if( !$conf->ImageMagick ) {
547 print ", image thumbnailing will be enabled if you enable uploads";
551 if( !$conf->ImageMagick ) {
552 print "<li>Couldn't find GD library or ImageMagick; image thumbnailing disabled.</li>\n";
556 $conf->IP = dirname( dirname( __FILE__ ) );
557 print "<li>Installation directory: <tt>" . htmlspecialchars( $conf->IP ) . "</tt></li>\n";
560 // PHP_SELF isn't available sometimes, such as when PHP is CGI but
561 // cgi.fix_pathinfo is disabled. In that case, fall back to SCRIPT_NAME
562 // to get the path to the current script... hopefully it's reliable. SIGH
563 $path = ($_SERVER["PHP_SELF"] === '')
564 ? $_SERVER["SCRIPT_NAME"]
565 : $_SERVER["PHP_SELF"];
567 $conf->ScriptPath = preg_replace( '{^(.*)/config.*$}', '$1', $path );
568 print "<li>Script URI path: <tt>" . htmlspecialchars( $conf->ScriptPath ) . "</tt></li>\n";
572 // We may be installing from *.php5 extension file, if so, print message
573 $conf->ScriptExtension = '.php';
574 if (defined('MW_INSTALL_PHP5_EXT')) {
575 $conf->ScriptExtension = '.php5';
576 print "<li>Installing MediaWiki with <tt>php5</tt> file extensions</li>\n";
578 print "<li>Installing MediaWiki with <tt>php</tt> file extensions</li>\n";
582 print "<li style='font-weight:bold;color:green;font-size:110%'>Environment checked. You can install MediaWiki.</li>\n";
583 $conf->posted = ($_SERVER["REQUEST_METHOD"] == "POST");
585 $conf->Sitename = ucfirst( importPost( "Sitename", "" ) );
586 $defaultEmail = empty( $_SERVER["SERVER_ADMIN"] )
588 : $_SERVER["SERVER_ADMIN"];
589 $conf->EmergencyContact = importPost( "EmergencyContact", $defaultEmail );
590 $conf->DBtype = importPost( "DBtype", $DefaultDBtype );
591 if ( !isset( $ourdb[$conf->DBtype] ) ) {
592 $conf->DBtype = $DefaultDBtype;
595 $conf->DBserver = importPost( "DBserver", "localhost" );
596 $conf->DBname = importPost( "DBname", "wikidb" );
597 $conf->DBuser = importPost( "DBuser", "wikiuser" );
598 $conf->DBpassword = importPost( "DBpassword" );
599 $conf->DBpassword2 = importPost( "DBpassword2" );
600 $conf->SysopName = importPost( "SysopName", "WikiSysop" );
601 $conf->SysopPass = importPost( "SysopPass" );
602 $conf->SysopPass2 = importPost( "SysopPass2" );
603 $conf->RootUser = importPost( "RootUser", "root" );
604 $conf->RootPW = importPost( "RootPW", "" );
605 $useRoot = importCheck( 'useroot', false );
606 $conf->LanguageCode = importPost( "LanguageCode", "en" );
608 $conf->DBprefix = importPost( "DBprefix" );
610 importPost( "DBschema", "mysql5-binary" ),
611 importPost( "DBengine", "InnoDB" ) );
613 ## Postgres specific:
614 $conf->DBport = importPost( "DBport", "5432" );
615 $conf->DBmwschema = importPost( "DBmwschema", "mediawiki" );
616 $conf->DBts2schema = importPost( "DBts2schema", "public" );
619 $conf->SQLiteDataDir = importPost( "SQLiteDataDir", "" );
622 // We need a second field so it doesn't overwrite the MySQL one
623 $conf->DBprefix2 = importPost( "DBprefix2" );
625 $conf->ShellLocale = getShellLocale( $conf->LanguageCode );
627 /* Check for validity */
630 if( preg_match( '/^$|^mediawiki$|#/i', $conf->Sitename ) ) {
631 $errs["Sitename"] = "Must not be blank or \"MediaWiki\" and may not contain \"#\"";
633 if( $conf->DBuser == "" ) {
634 $errs["DBuser"] = "Must not be blank";
636 if( ($conf->DBtype == 'mysql') && (strlen($conf->DBuser) > 16) ) {
637 $errs["DBuser"] = "Username too long";
639 if( $conf->DBpassword == "" && $conf->DBtype != "postgres" ) {
640 $errs["DBpassword"] = "Must not be blank";
642 if( $conf->DBpassword != $conf->DBpassword2 ) {
643 $errs["DBpassword2"] = "Passwords don't match!";
645 if( !preg_match( '/^[A-Za-z_0-9]*$/', $conf->DBprefix ) ) {
646 $errs["DBprefix"] = "Invalid table prefix";
649 error_reporting( E_ALL );
652 * Initialise $wgLang and $wgContLang to something so we can
653 * call case-folding methods. Per Brion, this is English for
654 * now, although we could be clever and initialise to the
655 * user-selected language.
657 $wgContLang = Language::factory( 'en' );
658 $wgLang = $wgContLang;
661 * We're messing about with users, so we need a stub
662 * authentication plugin...
664 $wgAuth = new AuthPlugin();
667 * Validate the initial administrator account; username,
668 * password checks, etc.
670 if( $conf->SysopName ) {
671 # Check that the user can be created
672 $u = User::newFromName( $conf->SysopName );
673 if( is_a($u, 'User') ) { // please do not use instanceof, it breaks PHP4
674 # Various password checks
675 if( $conf->SysopPass != '' ) {
676 if( $conf->SysopPass == $conf->SysopPass2 ) {
677 if( !$u->isValidPassword( $conf->SysopPass ) ) {
678 $errs['SysopPass'] = "Bad password";
681 $errs['SysopPass2'] = "Passwords don't match";
684 $errs['SysopPass'] = "Cannot be blank";
688 $errs['SysopName'] = "Bad username";
692 $conf->License = importRequest( "License", "none" );
693 if( $conf->License == "gfdl1_2" ) {
694 $conf->RightsUrl = "http://www.gnu.org/licenses/old-licenses/fdl-1.2.txt";
695 $conf->RightsText = "GNU Free Documentation License 1.2";
696 $conf->RightsCode = "gfdl1_2";
697 $conf->RightsIcon = '${wgScriptPath}/skins/common/images/gnu-fdl.png';
698 } elseif( $conf->License == "gfdl1_3" ) {
699 $conf->RightsUrl = "http://www.gnu.org/copyleft/fdl.html";
700 $conf->RightsText = "GNU Free Documentation License 1.3";
701 $conf->RightsCode = "gfdl1_3";
702 $conf->RightsIcon = '${wgScriptPath}/skins/common/images/gnu-fdl.png';
703 } elseif( $conf->License == "none" ) {
704 $conf->RightsUrl = $conf->RightsText = $conf->RightsCode = $conf->RightsIcon = "";
705 } elseif( $conf->License == "pd" ) {
706 $conf->RightsUrl = "http://creativecommons.org/licenses/publicdomain/";
707 $conf->RightsText = "Public Domain";
708 $conf->RightsCode = "pd";
709 $conf->RightsIcon = '${wgScriptPath}/skins/common/images/public-domain.png';
711 $conf->RightsUrl = importRequest( "RightsUrl", "" );
712 $conf->RightsText = importRequest( "RightsText", "" );
713 $conf->RightsCode = importRequest( "RightsCode", "" );
714 $conf->RightsIcon = importRequest( "RightsIcon", "" );
717 $conf->Shm = importRequest( "Shm", "none" );
718 $conf->MCServers = importRequest( "MCServers" );
720 /* Test memcached servers */
722 if ( $conf->Shm == 'memcached' && $conf->MCServers ) {
723 $conf->MCServerArray = array_map( 'trim', explode( ',', $conf->MCServers ) );
724 foreach ( $conf->MCServerArray as $server ) {
725 $error = testMemcachedServer( $server );
727 $errs["MCServers"] = $error;
731 } else if ( $conf->Shm == 'memcached' ) {
732 $errs["MCServers"] = "Please specify at least one server if you wish to use memcached";
735 /* default values for installation */
736 $conf->Email = importRequest("Email", "email_enabled");
737 $conf->Emailuser = importRequest("Emailuser", "emailuser_enabled");
738 $conf->Enotif = importRequest("Enotif", "enotif_allpages");
739 $conf->Eauthent = importRequest("Eauthent", "eauthent_enabled");
741 if( $conf->posted && ( 0 == count( $errs ) ) ) {
742 do { /* So we can 'continue' to end prematurely */
743 $conf->Root = ($conf->RootPW != "");
745 /* Load up the settings and get installin' */
746 $local = writeLocalSettings( $conf );
747 echo "<li style=\"list-style: none\">\n";
748 echo "<p><b>Generating configuration file...</b></p>\n";
751 $wgCommandLineMode = false;
753 $ok = eval( $local );
754 if( $ok === false ) {
755 dieout( "<p>Errors in generated configuration; " .
756 "most likely due to a bug in the installer... " .
757 "Config file was: </p>" .
759 htmlspecialchars( $local ) .
762 $conf->DBtypename = '';
763 foreach (array_keys($ourdb) as $db) {
764 if ($conf->DBtype === $db)
765 $conf->DBtypename = $ourdb[$db]['fullname'];
767 if ( ! strlen($conf->DBtype)) {
768 $errs["DBpicktype"] = "Please choose a database type";
772 if (! $conf->DBtypename) {
773 $errs["DBtype"] = "Unknown database type '$conf->DBtype'";
776 print "<li>Database type: " . htmlspecialchars( $conf->DBtypename ) . "</li>\n";
777 $dbclass = 'Database'.ucfirst($conf->DBtype);
778 $wgDBtype = $conf->DBtype;
779 $wgDBadminuser = "root";
780 $wgDBadminpassword = $conf->RootPW;
783 $wgDBprefix = $conf->DBprefix;
785 ## Postgres specific:
786 $wgDBport = $conf->DBport;
787 $wgDBmwschema = $conf->DBmwschema;
788 $wgDBts2schema = $conf->DBts2schema;
790 if( $conf->DBprefix2 != '' ) {
792 $wgDBprefix = $conf->DBprefix2;
795 $wgCommandLineMode = true;
796 if (! defined ( 'STDERR' ) )
797 define( 'STDERR', fopen("php://stderr", "wb"));
798 $wgUseDatabaseMessages = false; /* FIXME: For database failure */
799 require_once( "$IP/includes/Setup.php" );
802 $wgTitle = Title::newFromText( "Installation script" );
803 error_reporting( E_ALL );
804 print "<li>Loading class: " . htmlspecialchars( $dbclass ) . "</li>\n";
807 if( $conf->DBtype == 'mysql' ) {
808 $mysqlOldClient = version_compare( mysql_get_client_info(), "4.1.0", "lt" );
809 if( $mysqlOldClient ) {
810 print "<li><b>PHP is linked with old MySQL client libraries. If you are
811 using a MySQL 4.1 server and have problems connecting to the database,
812 see <a href='http://dev.mysql.com/doc/mysql/en/old-client.html'
813 >http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b></li>\n";
815 $ok = true; # Let's be optimistic
817 # Decide if we're going to use the superuser or the regular database user
818 $conf->Root = $useRoot;
820 $db_user = $conf->RootUser;
821 $db_pass = $conf->RootPW;
823 $db_user = $wgDBuser;
824 $db_pass = $wgDBpassword;
828 echo( "<li>Attempting to connect to database server as " . htmlspecialchars( $db_user ) . "..." );
829 $wgDatabase = Database::newFromParams( $wgDBserver, $db_user, $db_pass, '', 1 );
831 # Check the connection and respond to errors
832 if( $wgDatabase->isOpen() ) {
835 $wgDBadminuser = $db_user;
836 $wgDBadminpassword = $db_pass;
837 echo( "success.</li>\n" );
838 $wgDatabase->ignoreErrors( true );
839 $myver = $wgDatabase->getServerVersion();
841 # There were errors, report them and back out
843 $errno = mysql_errno();
844 $errtx = htmlspecialchars( mysql_error() );
848 echo( "failed due to authentication errors. Check passwords.</li>" );
850 # The superuser details are wrong
851 $errs["RootUser"] = "Check username";
852 $errs["RootPW"] = "and password";
854 # The regular user details are wrong
855 $errs["DBuser"] = "Check username";
856 $errs["DBpassword"] = "and password";
862 # General connection problem
863 echo( htmlspecialchars( "failed with error [$errno] $errtx." ) . "</li>\n" );
864 $errs["DBserver"] = "Connection failed";
869 if( !$ok ) { continue; }
872 error_reporting( E_ALL );
874 ## Possible connect as a superuser
875 if( $useRoot && $conf->DBtype != 'sqlite' ) {
876 $wgDBsuperuser = $conf->RootUser;
877 echo( "<li>Attempting to connect to database \"postgres\" as superuser \"" .
878 htmlspecialchars( $wgDBsuperuser ) . "\"..." );
879 $wgDatabase = $dbc->newFromParams($wgDBserver, $wgDBsuperuser, $conf->RootPW, "postgres", 1);
880 if (!$wgDatabase->isOpen()) {
881 print " error: " . htmlspecialchars( $wgDatabase->lastError() ) . "</li>\n";
882 $errs["DBserver"] = "Could not connect to database as superuser";
883 $errs["RootUser"] = "Check username";
884 $errs["RootPW"] = "and password";
887 $wgDatabase->initial_setup($conf->RootPW, 'postgres');
889 echo( "<li>Attempting to connect to database \"" . htmlspecialchars( $wgDBname ) .
890 "\" as \"" . htmlspecialchars( $wgDBuser ) . "\"..." );
891 $wgDatabase = $dbc->newFromParams($wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1);
892 if (!$wgDatabase->isOpen()) {
893 print " error: " . htmlspecialchars( $wgDatabase->lastError() ) . "</li>\n";
895 $myver = $wgDatabase->getServerVersion();
897 if (is_callable(array($wgDatabase, 'initial_setup'))) $wgDatabase->initial_setup('', $wgDBname);
900 if ( !$wgDatabase->isOpen() ) {
901 $errs["DBserver"] = "Couldn't connect to database";
905 print "<li>Connected to " . htmlspecialchars( "{$conf->DBtype} $myver" );
906 if ($conf->DBtype == 'mysql') {
907 if( version_compare( $myver, "4.0.14" ) < 0 ) {
909 dieout( "-- mysql 4.0.14 or later required. Aborting." );
911 $mysqlNewAuth = version_compare( $myver, "4.1.0", "ge" );
912 if( $mysqlNewAuth && $mysqlOldClient ) {
913 print "; <b class='error'>You are using MySQL 4.1 server, but PHP is linked
914 to old client libraries; if you have trouble with authentication, see
915 <a href='http://dev.mysql.com/doc/mysql/en/old-client.html'
916 >http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b>";
919 if( $mysqlNewAuth ) {
920 print "; enabling MySQL 4.1/5.0 charset mode";
922 print "; <b class='error'>MySQL 4.1/5.0 charset mode enabled,
923 but older version detected; will likely fail.</b>";
928 @$sel = $wgDatabase->selectDB( $wgDBname );
930 print "<li>Database <tt>" . htmlspecialchars( $wgDBname ) . "</tt> exists</li>\n";
932 $err = mysql_errno();
933 $databaseSafe = htmlspecialchars( $wgDBname );
934 if( $err == 1102 /* Invalid database name */ ) {
935 print "<ul><li><strong>{$databaseSafe}</strong> is not a valid database name.</li></ul>";
937 } elseif( $err != 1049 /* Database doesn't exist */ ) {
938 print "<ul><li>Error selecting database <strong>{$databaseSafe}</strong>: {$err} ";
939 print htmlspecialchars( mysql_error() ) . "</li></ul>";
942 print "<li>Attempting to create database...</li>";
943 $res = $wgDatabase->query( "CREATE DATABASE `$wgDBname`" );
945 print "<li>Couldn't create database <tt>" .
946 htmlspecialchars( $wgDBname ) .
947 "</tt>; try with root access or check your username/pass.</li>\n";
948 $errs["RootPW"] = "<- Enter";
951 print "<li>Created database <tt>" . htmlspecialchars( $wgDBname ) . "</tt></li>\n";
953 $wgDatabase->selectDB( $wgDBname );
955 else if ($conf->DBtype == 'postgres') {
956 if( version_compare( $myver, "8.0" ) < 0 ) {
957 dieout( "<b>Postgres 8.0 or later is required</b>. Aborting." );
961 if( $wgDatabase->tableExists( "cur" ) || $wgDatabase->tableExists( "revision" ) ) {
962 print "<li>There are already MediaWiki tables in this database. Checking if updates are needed...</li>\n";
964 if ( $conf->DBtype == 'mysql') {
965 # Determine existing default character set
966 if ( $wgDatabase->tableExists( "revision" ) ) {
967 $revision = $wgDatabase->escapeLike( $conf->DBprefix . 'revision' );
968 $res = $wgDatabase->query( "SHOW TABLE STATUS LIKE '$revision'" );
969 $row = $wgDatabase->fetchObject( $res );
971 echo "<li>SHOW TABLE STATUS query failed!</li>\n";
972 $existingSchema = false;
973 $existingEngine = false;
975 if ( preg_match( '/^latin1/', $row->Collation ) ) {
976 $existingSchema = 'mysql4';
977 } elseif ( preg_match( '/^utf8/', $row->Collation ) ) {
978 $existingSchema = 'mysql5';
979 } elseif ( preg_match( '/^binary/', $row->Collation ) ) {
980 $existingSchema = 'mysql5-binary';
982 $existingSchema = false;
983 echo "<li><strong>Warning:</strong> Unrecognised existing collation</li>\n";
985 if ( isset( $row->Engine ) ) {
986 $existingEngine = $row->Engine;
988 $existingEngine = $row->Type;
991 if ( $existingSchema && $existingSchema != $conf->DBschema ) {
992 $encExisting = htmlspecialchars( $existingSchema );
993 $encRequested = htmlspecialchars( $conf->DBschema );
994 print "<li><strong>Warning:</strong> you requested the $encRequested schema, " .
995 "but the existing database has the $encExisting schema. This upgrade script ".
996 "can't convert it, so it will remain $encExisting.</li>\n";
997 $conf->setSchema( $existingSchema, $conf->DBengine );
999 if ( $existingEngine && $existingEngine != $conf->DBengine ) {
1000 $encExisting = htmlspecialchars( $existingEngine );
1001 $encRequested = htmlspecialchars( $conf->DBengine );
1002 print "<li><strong>Warning:</strong> you requested the $encRequested storage " .
1003 "engine, but the existing database uses the $encExisting engine. This upgrade " .
1004 "script can't convert it, so it will remain $encExisting.</li>\n";
1005 $conf->setSchema( $conf->DBschema, $existingEngine );
1009 # Create user if required
1010 if ( $conf->Root ) {
1011 $conn = $dbc->newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1 );
1012 if ( $conn->isOpen() ) {
1013 print "<li>DB user account ok</li>\n";
1016 print "<li>Granting user permissions...";
1017 if( $mysqlOldClient && $mysqlNewAuth ) {
1018 print " <b class='error'>If the next step fails, see <a href='http://dev.mysql.com/doc/mysql/en/old-client.html'>http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b>";
1021 dbsource( "../maintenance/users.sql", $wgDatabase );
1025 print "</ul><pre>\n";
1031 print "<ul><li>Finished update checks.</li>\n";
1033 # Determine available storage engines if possible
1034 if ( $conf->DBtype == 'mysql' && version_compare( $myver, "4.1.2", "ge" ) ) {
1035 $res = $wgDatabase->query( 'SHOW ENGINES' );
1037 while ( $row = $wgDatabase->fetchObject( $res ) ) {
1038 if ( $row->Engine == $conf->DBengine ) {
1043 $wgDatabase->freeResult( $res );
1044 if ( !$found && $conf->DBengine != 'MyISAM' ) {
1045 echo "<li><strong>Warning:</strong> " . htmlspecialchars( $conf->DBengine ) .
1046 " storage engine not available, " .
1047 "using MyISAM instead</li>\n";
1048 $conf->setSchema( $conf->DBschema, 'MyISAM' );
1052 # FIXME: Check for errors
1053 print "<li>Creating tables...";
1054 if ($conf->DBtype == 'mysql') {
1055 dbsource( "../maintenance/tables.sql", $wgDatabase );
1056 dbsource( "../maintenance/interwiki.sql", $wgDatabase );
1057 } elseif (is_callable(array($wgDatabase, 'setup_database'))) {
1058 $wgDatabase->setup_database();
1061 $errs["DBtype"] = "Do not know how to handle database type '$conf->DBtype'";
1065 print " done.</li>\n";
1067 print "<li>Initializing statistics...</li>\n";
1068 $wgDatabase->insert( 'site_stats',
1069 array ( 'ss_row_id' => 1,
1070 'ss_total_views' => 0,
1071 'ss_total_edits' => 1, # Main page first edit
1072 'ss_good_articles' => 0, # Main page is not a good article - no internal link
1073 'ss_total_pages' => 1, # Main page
1074 'ss_users' => $conf->SysopName ? 1 : 0, # Sysop account, if created
1075 'ss_admins' => $conf->SysopName ? 1 : 0, # Sysop account, if created
1076 'ss_images' => 0 ) );
1078 # Set up the "regular user" account *if we can, and if we need to*
1079 if( $conf->Root and $conf->DBtype == 'mysql') {
1081 $wgDatabase2 = $dbc->newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1 );
1082 if( $wgDatabase2->isOpen() ) {
1083 # Nope, just close the test connection and continue
1084 $wgDatabase2->close();
1085 echo( "<li>User " . htmlspecialchars( $wgDBuser ) . " exists. Skipping grants.</li>\n" );
1087 # Yes, so run the grants
1088 echo( "<li>" . htmlspecialchars( "Granting user permissions to $wgDBuser on $wgDBname..." ) );
1089 dbsource( "../maintenance/users.sql", $wgDatabase );
1090 echo( "success.</li>\n" );
1094 if( $conf->SysopName ) {
1095 $u = User::newFromName( $conf->getSysopName() );
1097 print "<li><strong class=\"error\">Warning:</strong> Skipped sysop account creation - invalid username!</li>\n";
1099 else if ( 0 == $u->idForName() ) {
1100 $u->addToDatabase();
1101 $u->setPassword( $conf->getSysopPass() );
1104 $u->addGroup( "sysop" );
1105 $u->addGroup( "bureaucrat" );
1107 print "<li>Created sysop account <tt>" .
1108 htmlspecialchars( $conf->SysopName ) . "</tt>.</li>\n";
1110 print "<li>Could not create user - already exists!</li>\n";
1113 print "<li>Skipped sysop account creation, no name given.</li>\n";
1116 $titleobj = Title::newFromText( wfMsgNoDB( "mainpage" ) );
1117 $article = new Article( $titleobj );
1118 $newid = $article->insertOn( $wgDatabase );
1119 $revision = new Revision( array(
1121 'text' => wfMsg( 'mainpagetext' ) . "\n\n" . wfMsgNoTrans( 'mainpagedocfooter' ),
1124 'user_text' => 'MediaWiki default',
1126 $revid = $revision->insertOn( $wgDatabase );
1127 $article->updateRevisionOn( $wgDatabase, $revision );
1130 /* Write out the config file now that all is well */
1131 print "<li style=\"list-style: none\">\n";
1132 print "<p>Creating LocalSettings.php...</p>\n\n";
1133 $localSettings = "<" . "?php$endl$local";
1134 // Fix up a common line-ending problem (due to CVS on Windows)
1135 $localSettings = str_replace( "\r\n", "\n", $localSettings );
1136 $f = fopen( "LocalSettings.php", 'xt' );
1140 dieout( "<p>Couldn't write out LocalSettings.php. Check that the directory permissions are correct and that there isn't already a file of that name here...</p>\n" .
1141 "<p>Here's the file that would have been written, try to paste it into place manually:</p>\n" .
1142 "<pre>\n" . htmlspecialchars( $localSettings ) . "</pre>\n" );
1144 if(fwrite( $f, $localSettings ) ) {
1147 writeSuccessMessage();
1151 dieout( "<p class='error'>An error occured while writing the config/LocalSettings.php file. Check user rights and disk space then try again.</p></li>\n" );
1158 $mainListOpened = false;
1160 if( count( $errs ) ) {
1161 /* Display options form */
1163 if( $conf->posted ) {
1164 echo "<p class='error-top'>Something's not quite right yet; make sure everything below is filled out correctly.</p>\n";
1168 <form action="<?php echo defined('MW_INSTALL_PHP5_EXT') ? 'index.php5' : 'index.php'; ?>" name="config" method="post">
1170 <h2>Site config</h2>
1172 <div class="config-section">
1173 <div class="config-input">
1174 <?php aField( $conf, "Sitename", "Wiki name:" ); ?>
1176 <p class="config-desc">
1177 Preferably a short word without punctuation, i.e. "Wikipedia".<br />
1178 Will appear as the namespace name for "meta" pages, and throughout the interface.
1180 <div class="config-input"><?php aField( $conf, "EmergencyContact", "Contact e-mail:" ); ?></div>
1181 <p class="config-desc">
1182 Displayed to users in some error messages, used as the return address for password reminders, and used as the default sender address of e-mail notifications.
1185 <div class="config-input">
1186 <label class='column' for="LanguageCode">Language:</label>
1187 <select id="LanguageCode" name="LanguageCode"><?php
1188 $list = getLanguageList();
1189 foreach( $list as $code => $name ) {
1190 $sel = ($code == $conf->LanguageCode) ? 'selected="selected"' : '';
1191 $encCode = htmlspecialchars( $code );
1192 $encName = htmlspecialchars( $name );
1193 echo "\n\t\t<option value=\"$encCode\" $sel>$encName</option>";
1199 <p class="config-desc">
1200 Select the language for your wiki's interface. Some localizations aren't fully complete. Unicode (UTF-8) is used for all localizations.
1203 <div class="config-input">
1204 <label class='column'>Copyright/license:</label>
1207 <li><?php aField( $conf, "License", "No license metadata", "radio", "none" ); ?></li>
1208 <li><?php aField( $conf, "License", "Public Domain", "radio", "pd" ); ?></li>
1209 <li><?php aField( $conf, "License", "GNU Free Documentation License 1.2 (Wikipedia-compatible)", "radio", "gfdl1_2" ); ?></li>
1210 <li><?php aField( $conf, "License", "GNU Free Documentation License 1.3", "radio", "gfdl1_3" ); ?></li>
1212 aField( $conf, "License", "A Creative Commons license - ", "radio", "cc" );
1213 $partner = "MediaWiki";
1214 $script = defined('MW_INSTALL_PHP5_EXT') ? 'index.php5' : 'index.php';
1215 $exit = urlencode( "$wgServer{$conf->ScriptPath}/config/$script?License=cc&RightsUrl=[license_url]&RightsText=[license_name]&RightsCode=[license_code]&RightsIcon=[license_button]" );
1216 $icon = urlencode( "$wgServer$wgUploadPath/wiki.png" );
1217 $ccApp = htmlspecialchars( "http://creativecommons.org/license/?partner=$partner&exit_url=$exit&partner_icon_url=$icon" );
1218 print "<a href=\"$ccApp\" target='_blank'>choose</a>";
1219 if( $conf->License == "cc" ) { ?>
1221 <li><?php aField( $conf, "RightsIcon", "<img src=\"" . htmlspecialchars( $conf->RightsIcon ) . "\" alt='(Creative Commons icon)' />", "hidden" ); ?></li>
1222 <li><?php aField( $conf, "RightsText", htmlspecialchars( $conf->RightsText ), "hidden" ); ?></li>
1223 <li><?php aField( $conf, "RightsCode", "code: " . htmlspecialchars( $conf->RightsCode ), "hidden" ); ?></li>
1224 <li><?php aField( $conf, "RightsUrl", "<a href=\"" . htmlspecialchars( $conf->RightsUrl ) . "\">" . htmlspecialchars( $conf->RightsUrl ) . "</a>", "hidden" ); ?></li>
1230 <p class="config-desc">
1231 A notice, icon, and machine-readable copyright metadata will be displayed for the license you pick.
1235 <div class="config-input">
1236 <?php aField( $conf, "SysopName", "Admin username:" ) ?>
1238 <div class="config-input">
1239 <?php aField( $conf, "SysopPass", "Password:", "password" ) ?>
1241 <div class="config-input">
1242 <?php aField( $conf, "SysopPass2", "Password confirm:", "password" ) ?>
1244 <p class="config-desc">
1245 An admin can lock/delete pages, block users from editing, and do other maintenance tasks.<br />
1246 A new account will be added only when creating a new wiki database.
1248 The password cannot be the same as the username.
1251 <div class="config-input">
1252 <label class='column'>Object caching:</label>
1255 <li><?php aField( $conf, "Shm", "No caching", "radio", "none" ); ?></li>
1257 if ( $conf->turck ) {
1259 aField( $conf, "Shm", "Turck MMCache", "radio", "turck" );
1262 if( $conf->xcache ) {
1264 aField( $conf, 'Shm', 'XCache', 'radio', 'xcache' );
1269 aField( $conf, "Shm", "APC", "radio", "apc" );
1272 if ( $conf->eaccel ) {
1274 aField( $conf, "Shm", "eAccelerator", "radio", "eaccel" );
1279 aField( $conf, "Shm", "DBA (not recommended)", "radio", "dba" );
1283 <li><?php aField( $conf, "Shm", "Memcached", "radio", "memcached" ); ?></li>
1285 <div style="clear:left"><?php aField( $conf, "MCServers", "Memcached servers:", "text" ) ?></div>
1287 <p class="config-desc">
1288 An object caching system such as memcached will provide a significant performance boost,
1289 but needs to be installed. Provide the server addresses and ports in a comma-separated list.
1291 MediaWiki can also detect and support eAccelerator, Turck MMCache, APC, and XCache, but
1292 these should not be used if the wiki will be running on multiple application servers.
1294 DBA (Berkeley-style DB) is generally slower than using no cache at all, and is only
1295 recommended for testing.
1299 <h2>E-mail, e-mail notification and authentication setup</h2>
1301 <div class="config-section">
1302 <div class="config-input">
1303 <label class='column'>E-mail features (global):</label>
1305 <li><?php aField( $conf, "Email", "Enabled", "radio", "email_enabled" ); ?></li>
1306 <li><?php aField( $conf, "Email", "Disabled", "radio", "email_disabled" ); ?></li>
1309 <p class="config-desc">
1310 Use this to disable all e-mail functions (password reminders, user-to-user e-mail, and e-mail notifications)
1311 if sending mail doesn't work on your server.
1314 <div class="config-input">
1315 <label class='column'>User-to-user e-mail:</label>
1317 <li><?php aField( $conf, "Emailuser", "Enabled", "radio", "emailuser_enabled" ); ?></li>
1318 <li><?php aField( $conf, "Emailuser", "Disabled", "radio", "emailuser_disabled" ); ?></li>
1321 <p class="config-desc">
1322 The user-to-user e-mail feature (Special:Emailuser) lets the wiki act as a relay to allow users to exchange e-mail without publicly advertising their e-mail address.
1324 <div class="config-input">
1325 <label class='column'>E-mail notification about changes:</label>
1327 <li><?php aField( $conf, "Enotif", "Disabled", "radio", "enotif_disabled" ); ?></li>
1328 <li><?php aField( $conf, "Enotif", "Enabled for changes to user discussion pages only", "radio", "enotif_usertalk" ); ?></li>
1329 <li><?php aField( $conf, "Enotif", "Enabled for changes to user discussion pages, and to pages on watchlists (not recommended for large wikis)", "radio", "enotif_allpages" ); ?></li>
1332 <div class="config-desc">
1334 For this feature to work, an e-mail address must be present for the user account, and the notification
1335 options in the user's preferences must be enabled. Also note the
1336 authentication option below. When testing the feature, keep in mind that your own changes will never trigger notifications to be sent to yourself.</p>
1338 <p>There are additional options for fine tuning in /includes/DefaultSettings.php; copy these to your LocalSettings.php and edit them there to change them.</p>
1341 <div class="config-input">
1342 <label class='column'>E-mail address authentication:</label>
1344 <li><?php aField( $conf, "Eauthent", "Disabled", "radio", "eauthent_disabled" ); ?></li>
1345 <li><?php aField( $conf, "Eauthent", "Enabled", "radio", "eauthent_enabled" ); ?></li>
1348 <div class="config-desc">
1349 <p>If this option is enabled, users have to confirm their e-mail address using a magic link sent to them whenever they set or change it, and only authenticated e-mail addresses can receive mails from other users and/or
1350 change notification mails. Setting this option is <b>recommended</b> for public wikis because of potential abuse of the e-mail features above.</p>
1355 <h2>Database config</h2>
1357 <div class="config-section">
1358 <div class="config-input">
1359 <label class='column'>Database type:</label>
1361 if (isset($errs['DBpicktype'])) {
1362 print "\t<span class='error'>" . htmlspecialchars( $errs['DBpicktype'] ) . "</span>\n";
1365 <ul class='plain'><?php
1366 database_picker($conf);
1370 <div class="config-input" style="clear:left">
1371 <?php aField( $conf, "DBserver", "Database host:" ); ?>
1373 <p class="config-desc">
1374 If your database server isn't on your web server, enter the name or IP address here.
1377 <div class="config-input"><?php aField( $conf, "DBname", "Database name:" ); ?></div>
1378 <div class="config-input"><?php aField( $conf, "DBuser", "DB username:" ); ?></div>
1379 <div class="config-input"><?php aField( $conf, "DBpassword", "DB password:", "password" ); ?></div>
1380 <div class="config-input"><?php aField( $conf, "DBpassword2", "DB password confirm:", "password" ); ?></div>
1381 <p class="config-desc">
1382 If you only have a single user account and database available,
1383 enter those here. If you have database root access (see below)
1384 you can specify new accounts/databases to be created. This account
1385 will not be created if it pre-exists. If this is the case, ensure that it
1386 has SELECT, INSERT, UPDATE, and DELETE permissions on the MediaWiki database.
1389 <div class="config-input">
1390 <label class="column">Superuser account:</label>
1391 <input type="checkbox" name="useroot" id="useroot" <?php if( $useRoot ) { ?>checked="checked" <?php } ?> />
1392 <label for="useroot">Use superuser account</label>
1394 <div class="config-input"><?php aField( $conf, "RootUser", "Superuser name:", "text" ); ?></div>
1395 <div class="config-input"><?php aField( $conf, "RootPW", "Superuser password:", "password" ); ?></div>
1397 <p class="config-desc">
1398 If the database user specified above does not exist, or does not have access to create
1399 the database (if needed) or tables within it, please check the box and provide details
1400 of a superuser account, such as <strong>root</strong>, which does.
1403 <?php database_switcher('mysql'); ?>
1404 <div class="config-input"><?php aField( $conf, "DBprefix", "Database table prefix:" ); ?></div>
1405 <div class="config-desc">
1406 <p>If you need to share one database between multiple wikis, or
1407 between MediaWiki and another web application, you may choose to
1408 add a prefix to all the table names to avoid conflicts.</p>
1410 <p>Avoid exotic characters; something like <tt>mw_</tt> is good.</p>
1413 <div class="config-input"><label class="column">Storage Engine</label>
1414 <div>Select one:</div>
1416 <li><?php aField( $conf, "DBengine", "InnoDB", "radio", "InnoDB" ); ?></li>
1417 <li><?php aField( $conf, "DBengine", "MyISAM", "radio", "MyISAM" ); ?></li>
1420 <p class="config-desc">
1421 InnoDB is best for public web installations, since it has good concurrency
1422 support. MyISAM may be faster in single-user installations. MyISAM databases
1423 tend to get corrupted more often than InnoDB databases.
1425 <div class="config-input"><label class="column">Database character set</label>
1426 <div>Select one:</div>
1428 <li><?php aField( $conf, "DBschema", "MySQL 4.1/5.0 binary", "radio", "mysql5-binary" ); ?></li>
1429 <li><?php aField( $conf, "DBschema", "MySQL 4.1/5.0 UTF-8", "radio", "mysql5" ); ?></li>
1430 <li><?php aField( $conf, "DBschema", "MySQL 4.0 backwards-compatible UTF-8", "radio", "mysql4" ); ?></li>
1433 <p class="config-desc">
1434 This option is ignored on upgrade, the same character set will be kept.
1436 <b>WARNING:</b> If you use <b>backwards-compatible UTF-8</b> on MySQL 4.1+, and subsequently back up the database with <tt>mysqldump</tt>, it may destroy all non-ASCII characters, irreversibly corrupting your backups!.
1438 In <b>binary mode</b>, MediaWiki stores UTF-8 text to the database in binary fields. This is more efficient than MySQL's UTF-8 mode, and allows you to use the full range of Unicode characters. In <b>UTF-8 mode</b>, MySQL will know what character set your data is in, and can present and convert it appropriately, but it won't let you store characters above the <a target="_blank" href="http://en.wikipedia.org/wiki/Mapping_of_Unicode_character_planes">Basic Multilingual Plane</a>.
1442 <?php database_switcher('postgres'); ?>
1443 <div class="config-input"><?php aField( $conf, "DBport", "Database port:" ); ?></div>
1444 <div class="config-input"><?php aField( $conf, "DBmwschema", "Schema for mediawiki:" ); ?></div>
1445 <div class="config-input"><?php aField( $conf, "DBts2schema", "Schema for tsearch2:" ); ?></div>
1446 <div class="config-desc">
1447 <p>The username specified above (at "DB username") will have its search path set to the above schemas,
1448 so it is recommended that you create a new user. The above schemas are generally correct:
1449 only change them if you are sure you need to.</p>
1454 # SQLITE DISABLED -- USE MEDIAWIKI 1.15
1457 <?php database_switcher('sqlite'); ?>
1458 <div class="config-desc">
1459 <b>NOTE:</b> SQLite only uses the <i>Database name</i> setting above, the user, password and root settings are ignored.
1461 <div class="config-input"><?php
1462 aField( $conf, "SQLiteDataDir", "SQLite data directory:" );
1464 <div class="config-desc">
1465 <p>SQLite stores table data into files in the filesystem.
1466 If you do not provide an explicit path, a "data" directory in
1467 the parent of your document root will be used.</p>
1469 <p>This directory must exist and be writable by the web server.</p>
1474 # SQLITE DISABLED -- USE MEDIAWIKI 1.15
1478 <?php database_switcher('mssql'); ?>
1479 <div class="config-input"><?php
1480 aField( $conf, "DBprefix2", "Database table prefix:" );
1482 <div class="config-desc">
1483 <p>If you need to share one database between multiple wikis, or
1484 between MediaWiki and another web application, you may choose to
1485 add a prefix to all the table names to avoid conflicts.</p>
1487 <p>Avoid exotic characters; something like <tt>mw_</tt> is good.</p>
1491 <div class="config-input" style="padding:2em 0 3em">
1492 <label class='column'> </label>
1493 <input type="submit" value="Install MediaWiki!" class="btn-install" />
1497 <script type="text/javascript">
1498 window.onload = toggleDBarea(<?php echo Xml::encodeJsVar( $conf->DBtype ); ?>,
1500 ## If they passed in a root user name, don't populate it on page load
1501 echo strlen(importPost('RootUser', '')) ? 0 : 1;
1507 /* -------------------------------------------------------------------------------------- */
1508 function writeSuccessMessage() {
1509 $script = defined('MW_INSTALL_PHP5_EXT') ? 'index.php5' : 'index.php';
1510 if ( wfIniGetBool( 'safe_mode' ) && !ini_get( 'open_basedir' ) ) {
1512 <div class="success-box">
1513 <p>Installation successful!</p>
1514 <p>To complete the installation, please do the following:
1516 <li>Download config/LocalSettings.php with your FTP client or file manager</li>
1517 <li>Upload it to the parent directory</li>
1518 <li>Delete config/LocalSettings.php</li>
1519 <li>Start using <a href='../$script'>your wiki</a>!
1521 <p>If you are in a shared hosting environment, do <strong>not</strong> just move LocalSettings.php
1522 remotely. LocalSettings.php is currently owned by the user your webserver is running under,
1523 which means that anyone on the same server can read your database password! Downloading
1524 it and uploading it again will hopefully change the ownership to a user ID specific to you.</p>
1529 <div class="success-box">
1531 <span class="success-message">Installation successful!</span>
1532 Move the <tt>config/LocalSettings.php</tt> file to the parent directory, then follow
1533 <a href="../$script"> this link</a> to your wiki.</p>
1534 <p>You should change file permissions for <tt>LocalSettings.php</tt> as required to
1535 prevent other users on the server reading passwords and altering configuration data.</p>
1542 function escapePhpString( $string ) {
1543 if ( is_array( $string ) || is_object( $string ) ) {
1546 return strtr( $string,
1557 function writeLocalSettings( $conf ) {
1558 $conf->PasswordSender = $conf->EmergencyContact;
1559 $magic = ($conf->ImageMagick ? "" : "# ");
1560 $convert = ($conf->ImageMagick ? $conf->ImageMagick : "/usr/bin/convert" );
1561 $rights = ($conf->RightsUrl) ? "" : "# ";
1562 $hashedUploads = $conf->safeMode ? '' : '# ';
1564 if ( $conf->ShellLocale ) {
1568 $conf->ShellLocale = 'en_US.UTF-8';
1571 switch ( $conf->Shm ) {
1573 $cacheType = 'CACHE_MEMCACHED';
1574 $mcservers = var_export( $conf->MCServerArray, true );
1580 $cacheType = 'CACHE_ACCEL';
1581 $mcservers = 'array()';
1584 $cacheType = 'CACHE_DBA';
1585 $mcservers = 'array()';
1588 $cacheType = 'CACHE_NONE';
1589 $mcservers = 'array()';
1592 if ( $conf->Email == 'email_enabled' ) {
1593 $enableemail = 'true';
1594 $enableuseremail = ( $conf->Emailuser == 'emailuser_enabled' ) ? 'true' : 'false' ;
1595 $eauthent = ( $conf->Eauthent == 'eauthent_enabled' ) ? 'true' : 'false' ;
1596 switch ( $conf->Enotif ) {
1597 case 'enotif_usertalk':
1598 $enotifusertalk = 'true';
1599 $enotifwatchlist = 'false';
1601 case 'enotif_allpages':
1602 $enotifusertalk = 'true';
1603 $enotifwatchlist = 'true';
1606 $enotifusertalk = 'false';
1607 $enotifwatchlist = 'false';
1610 $enableuseremail = 'false';
1611 $enableemail = 'false';
1612 $eauthent = 'false';
1613 $enotifusertalk = 'false';
1614 $enotifwatchlist = 'false';
1617 $file = @fopen( "/dev/urandom", "r" );
1619 $secretKey = bin2hex( fread( $file, 32 ) );
1623 for ( $i=0; $i<8; $i++ ) {
1624 $secretKey .= dechex(mt_rand(0, 0x7fffffff));
1626 print "<li>Warning: \$wgSecretKey key is insecure, generated with mt_rand(). Consider changing it manually.</li>\n";
1629 # Add slashes to strings for double quoting
1630 $slconf = array_map( "escapePhpString", get_object_vars( $conf ) );
1631 if( $conf->License == 'gfdl1_2' || $conf->License == 'pd' || $conf->License == 'gfdl1_3' ) {
1632 # Needs literal string interpolation for the current style path
1633 $slconf['RightsIcon'] = $conf->RightsIcon;
1636 if( $conf->DBtype == 'mysql' ) {
1638 "# MySQL specific settings
1639 \$wgDBprefix = \"{$slconf['DBprefix']}\";
1641 # MySQL table options to use during installation or update
1642 \$wgDBTableOptions = \"{$slconf['DBTableOptions']}\";
1644 # Experimental charset support for MySQL 4.1/5.0.
1645 \$wgDBmysql5 = {$conf->DBmysql5};";
1646 } elseif( $conf->DBtype == 'postgres' ) {
1648 "# Postgres specific settings
1649 \$wgDBport = \"{$slconf['DBport']}\";
1650 \$wgDBmwschema = \"{$slconf['DBmwschema']}\";
1651 \$wgDBts2schema = \"{$slconf['DBts2schema']}\";";
1652 } elseif( $conf->DBtype == 'sqlite' ) {
1654 "# SQLite-specific settings
1655 \$wgSQLiteDataDir = \"{$slconf['SQLiteDataDir']}\";";
1656 } elseif( $conf->DBtype == 'mssql' ) {
1658 "# MSSQL specific settings
1659 \$wgDBprefix = \"{$slconf['DBprefix2']}\";";
1667 # This file was automatically generated by the MediaWiki installer.
1668 # If you make manual changes, please keep track in case you need to
1669 # recreate them later.
1671 # See includes/DefaultSettings.php for all configurable settings
1672 # and their default values, but don't forget to make changes in _this_
1675 # Further documentation for configuration settings may be found at:
1676 # http://www.mediawiki.org/wiki/Manual:Configuration_settings
1678 # If you customize your file layout, set \$IP to the directory that contains
1679 # the other MediaWiki files. It will be used as a base to locate files.
1680 if( defined( 'MW_INSTALL_PATH' ) ) {
1681 \$IP = MW_INSTALL_PATH;
1683 \$IP = dirname( __FILE__ );
1686 \$path = array( \$IP, \"\$IP/includes\", \"\$IP/languages\" );
1687 set_include_path( implode( PATH_SEPARATOR, \$path ) . PATH_SEPARATOR . get_include_path() );
1689 require_once( \"\$IP/includes/DefaultSettings.php\" );
1691 # If PHP's memory limit is very low, some operations may fail.
1692 " . ($conf->raiseMemory ? '' : '# ' ) . "ini_set( 'memory_limit', '20M' );" . "
1694 if ( \$wgCommandLineMode ) {
1695 if ( isset( \$_SERVER ) && array_key_exists( 'REQUEST_METHOD', \$_SERVER ) ) {
1696 die( \"This script must be run from the command line\\n\" );
1699 ## Uncomment this to disable output compression
1700 # \$wgDisableOutputCompression = true;
1702 \$wgSitename = \"{$slconf['Sitename']}\";
1704 ## The URL base path to the directory containing the wiki;
1705 ## defaults for all runtime URL paths are based off of this.
1706 ## For more information on customizing the URLs please see:
1707 ## http://www.mediawiki.org/wiki/Manual:Short_URL
1708 \$wgScriptPath = \"{$slconf['ScriptPath']}\";
1709 \$wgScriptExtension = \"{$slconf['ScriptExtension']}\";
1711 ## UPO means: this is also a user preference option
1713 \$wgEnableEmail = $enableemail;
1714 \$wgEnableUserEmail = $enableuseremail; # UPO
1716 \$wgEmergencyContact = \"{$slconf['EmergencyContact']}\";
1717 \$wgPasswordSender = \"{$slconf['PasswordSender']}\";
1719 \$wgEnotifUserTalk = $enotifusertalk; # UPO
1720 \$wgEnotifWatchlist = $enotifwatchlist; # UPO
1721 \$wgEmailAuthentication = $eauthent;
1723 ## Database settings
1724 \$wgDBtype = \"{$slconf['DBtype']}\";
1725 \$wgDBserver = \"{$slconf['DBserver']}\";
1726 \$wgDBname = \"{$slconf['DBname']}\";
1727 \$wgDBuser = \"{$slconf['DBuser']}\";
1728 \$wgDBpassword = \"{$slconf['DBpassword']}\";
1732 ## Shared memory settings
1733 \$wgMainCacheType = $cacheType;
1734 \$wgMemCachedServers = $mcservers;
1736 ## To enable image uploads, make sure the 'images' directory
1737 ## is writable, then set this to true:
1738 \$wgEnableUploads = false;
1739 {$magic}\$wgUseImageMagick = true;
1740 {$magic}\$wgImageMagickConvertCommand = \"{$convert}\";
1742 ## If you use ImageMagick (or any other shell command) on a
1743 ## Linux server, this will need to be set to the name of an
1744 ## available UTF-8 locale
1745 {$locale}\$wgShellLocale = \"{$slconf['ShellLocale']}\";
1747 ## If you want to use image uploads under safe mode,
1748 ## create the directories images/archive, images/thumb and
1749 ## images/temp, and make them all writable. Then uncomment
1750 ## this, if it's not already uncommented:
1751 {$hashedUploads}\$wgHashedUploadDirectory = false;
1753 ## If you have the appropriate support software installed
1754 ## you can enable inline LaTeX equations:
1757 \$wgLocalInterwiki = strtolower( \$wgSitename );
1759 \$wgLanguageCode = \"{$slconf['LanguageCode']}\";
1761 \$wgSecretKey = \"$secretKey\";
1763 ## Default skin: you can change the default skin. Use the internal symbolic
1764 ## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook':
1765 \$wgDefaultSkin = 'monobook';
1767 ## For attaching licensing metadata to pages, and displaying an
1768 ## appropriate copyright notice / icon. GNU Free Documentation
1769 ## License and Creative Commons licenses are supported so far.
1770 {$rights}\$wgEnableCreativeCommonsRdf = true;
1771 \$wgRightsPage = \"\"; # Set to the title of a wiki page that describes your license/copyright
1772 \$wgRightsUrl = \"{$slconf['RightsUrl']}\";
1773 \$wgRightsText = \"{$slconf['RightsText']}\";
1774 \$wgRightsIcon = \"{$slconf['RightsIcon']}\";
1775 # \$wgRightsCode = \"{$slconf['RightsCode']}\"; # Not yet used
1777 \$wgDiff3 = \"{$slconf['diff3']}\";
1779 # When you make changes to this configuration file, this will make
1780 # sure that cached pages are cleared.
1781 \$wgCacheEpoch = max( \$wgCacheEpoch, gmdate( 'YmdHis', @filemtime( __FILE__ ) ) );
1782 "; ## End of setting the $localsettings string
1784 // Keep things in Unix line endings internally;
1785 // the system will write out as local text type.
1786 return str_replace( "\r\n", "\n", $localsettings );
1789 function dieout( $text ) {
1790 global $mainListOpened;
1791 if( $mainListOpened ) echo( "</ul>" );
1792 if( $text != '' && substr( $text, 0, 2 ) != '<p' && substr( $text, 0, 2 ) != '<h' ){
1793 echo "<p>$text</p>\n";
1797 die( "\n\n</div>\n</div>\n</div>\n</div>\n</body>\n</html>" );
1800 function importVar( &$var, $name, $default = "" ) {
1801 if( isset( $var[$name] ) ) {
1802 $retval = $var[$name];
1803 if ( get_magic_quotes_gpc() ) {
1804 $retval = stripslashes( $retval );
1812 function importPost( $name, $default = "" ) {
1813 return importVar( $_POST, $name, $default );
1816 function importCheck( $name ) {
1817 return isset( $_POST[$name] );
1820 function importRequest( $name, $default = "" ) {
1821 return importVar( $_REQUEST, $name, $default );
1824 function aField( &$conf, $field, $text, $type = "text", $value = "", $onclick = '' ) {
1825 static $radioCount = 0;
1827 $xtype = "type=\"$type\"";
1833 $nolabel = ($type == "radio") || ($type == "hidden");
1835 if ($type == 'radio')
1836 $id .= $radioCount++;
1839 echo "<label class='column' for=\"$id\">$text</label>";
1842 if( $type == "radio" && $value == $conf->$field ) {
1843 $checked = "checked='checked'";
1847 echo "<input $xtype name=\"$field\" id=\"$id\" class=\"iput-$type\" $checked ";
1849 echo " onclick='toggleDBarea(\"$value\",1)' " ;
1852 if( $type == "radio" ) {
1853 echo htmlspecialchars( $value );
1855 echo htmlspecialchars( $conf->$field );
1861 echo "<label for=\"$id\">$text</label>";
1865 if(isset($errs[$field])) {
1866 echo "<span class='error'>" . htmlspecialchars( $errs[$field] ) . "</span>\n";
1870 function getLanguageList() {
1871 global $wgLanguageNames, $IP;
1872 if( !isset( $wgLanguageNames ) ) {
1873 require_once( "$IP/languages/Names.php" );
1878 $d = opendir( "../languages/messages" );
1879 /* In case we are called from the root directory */
1881 $d = opendir( "languages/messages");
1882 while( false !== ($f = readdir( $d ) ) ) {
1884 if( preg_match( '/Messages([A-Z][a-z_]+)\.php$/', $f, $m ) ) {
1885 $code = str_replace( '_', '-', strtolower( $m[1] ) );
1886 if( isset( $wgLanguageNames[$code] ) ) {
1887 $name = $code . ' - ' . $wgLanguageNames[$code];
1891 $codes[$code] = $name;
1899 #Check for location of an executable
1900 # @param string $loc single location to check
1901 # @param array $names filenames to check for.
1902 # @param mixed $versioninfo array of details to use when checking version, use false for no version checking
1903 function locate_executable($loc, $names, $versioninfo = false) {
1904 if (!is_array($names))
1905 $names = array($names);
1907 foreach ($names as $name) {
1908 $command = "$loc".DIRECTORY_SEPARATOR."$name";
1909 if (@file_exists($command)) {
1913 $file = str_replace('$1', $command, $versioninfo[0]);
1914 if (strstr(`$file`, $versioninfo[1]) !== false)
1921 # Test a memcached server
1922 function testMemcachedServer( $server ) {
1923 $hostport = explode(":", $server);
1926 if ( !function_exists( 'fsockopen' ) ) {
1927 $errstr = "Can't connect to memcached, fsockopen() not present";
1929 if ( !$errstr && count( $hostport ) != 2 ) {
1930 $errstr = 'Please specify host and port';
1933 list( $host, $port ) = $hostport;
1937 $fp = @fsockopen( $host, $port, $errno, $fsockerr, 1.0 );
1938 if ( $fp === false ) {
1939 $errstr = "Cannot connect to memcached on $host:$port : $fsockerr";
1943 $command = "version\r\n";
1944 $bytes = fwrite( $fp, $command );
1945 if ( $bytes != strlen( $command ) ) {
1946 $errstr = "Cannot write to memcached socket on $host:$port";
1950 $expected = "VERSION ";
1951 $response = fread( $fp, strlen( $expected ) );
1952 if ( $response != $expected ) {
1953 $errstr = "Didn't get correct memcached response from $host:$port";
1960 echo "<li>Connected to memcached on " . htmlspecialchars( "$host:$port" ) ." successfully</li>";
1965 function database_picker($conf) {
1968 foreach(array_keys($ourdb) as $db) {
1969 if ($ourdb[$db]['havedriver']) {
1971 aField( $conf, "DBtype", $ourdb[$db]['fullname'], 'radio', $db, 'onclick');
1978 function database_switcher($db) {
1980 $color = $ourdb[$db]['bgcolor'];
1981 $full = $ourdb[$db]['fullname'];
1982 print "<fieldset id='$db'><legend>$full specific options</legend>\n";
1985 function printListItem( $item ) {
1986 print "<li>$item</li>";
1989 # Determine a suitable value for $wgShellLocale
1990 function getShellLocale( $wikiLang ) {
1991 # Give up now if we're in safe mode or open_basedir
1992 # It's theoretically possible but tricky to work with
1993 if ( wfIniGetBool( "safe_mode" ) || ini_get( 'open_basedir' ) ) {
1997 $os = php_uname( 's' );
1998 $supported = array( 'Linux', 'SunOS', 'HP-UX' ); # Tested these
1999 if ( !in_array( $os, $supported ) ) {
2003 # Get a list of available locales
2004 $lines = $ret = false;
2005 exec( '/usr/bin/locale -a', $lines, $ret );
2010 $lines = array_map( 'trim', $lines );
2011 $candidatesByLocale = array();
2012 $candidatesByLang = array();
2013 foreach ( $lines as $line ) {
2014 if ( $line === '' ) {
2017 if ( !preg_match( '/^([a-zA-Z]+)(_[a-zA-Z]+|)\.(utf8|UTF-8)(@[a-zA-Z_]*|)$/i', $line, $m ) ) {
2020 list( $all, $lang, $territory, $charset, $modifier ) = $m;
2021 $candidatesByLocale[$m[0]] = $m;
2022 $candidatesByLang[$lang][] = $m;
2025 # Try the current value of LANG
2026 if ( isset( $candidatesByLocale[ getenv( 'LANG' ) ] ) ) {
2027 return getenv( 'LANG' );
2030 # Try the most common ones
2031 $commonLocales = array( 'en_US.UTF-8', 'en_US.utf8', 'de_DE.UTF-8', 'de_DE.utf8' );
2032 foreach ( $commonLocales as $commonLocale ) {
2033 if ( isset( $candidatesByLocale[$commonLocale] ) ) {
2034 return $commonLocale;
2038 # Is there an available locale in the Wiki's language?
2039 if ( isset( $candidatesByLang[$wikiLang] ) ) {
2040 $m = reset( $candidatesByLang[$wikiLang] );
2044 # Are there any at all?
2045 if ( count( $candidatesByLocale ) ) {
2046 $m = reset( $candidatesByLocale );
2056 <div class="license">
2058 <p>This program is free software; you can redistribute it and/or modify
2059 it under the terms of the GNU General Public License as published by
2060 the Free Software Foundation; either version 2 of the License, or
2061 (at your option) any later version.</p>
2063 <p>This program is distributed in the hope that it will be useful,
2064 but WITHOUT ANY WARRANTY; without even the implied warranty of
2065 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2066 GNU General Public License for more details.</p>
2068 <p>You should have received <a href="../COPYING">a copy of the GNU General Public License</a>
2069 along with this program; if not, write to the Free Software
2070 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2071 or <a href="http://www.gnu.org/copyleft/gpl.html">read it online</a></p>
2077 <div id="column-one">
2078 <div class="portlet" id="p-logo">
2079 <a style="background-image: url(../skins/common/images/mediawiki.png);"
2080 href="http://www.mediawiki.org/"
2081 title="Main Page"></a>
2083 <script type="text/javascript"> if (window.isMSIE55) fixalpha(); </script>
2084 <div class='portlet'><div class='pBody'>
2086 <li><strong><a href="http://www.mediawiki.org/">MediaWiki home</a></strong></li>
2087 <li><a href="../README">Readme</a></li>
2088 <li><a href="../RELEASE-NOTES">Release notes</a></li>
2089 <li><a href="../docs/">Documentation</a></li>
2090 <li><a href="http://www.mediawiki.org/wiki/Help:Contents">User's Guide</a></li>
2091 <li><a href="http://www.mediawiki.org/wiki/Manual:Contents">Administrator's Guide</a></li>
2092 <li><a href="http://www.mediawiki.org/wiki/Manual:FAQ">FAQ</a></li>
2094 <p style="font-size:90%;margin-top:1em">MediaWiki is Copyright © 2001-2008 by Magnus Manske, Brion Vibber,
2095 Lee Daniel Crocker, Tim Starling, Erik Möller, Gabriel Wicke, Ævar Arnfjörð Bjarmason, Niklas Laxström,
2096 Domas Mituzas, Rob Church, Yuri Astrakhan, Aryeh Gregor, Aaron Schulz and others.</p>