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 );
32 $sep = PATH_SEPARATOR
;
33 if( !ini_set( "include_path", ".$sep$IP$sep$IP/includes$sep$IP/languages" ) ) {
34 set_include_path( ".$sep$IP$sep$IP/includes$sep$IP/languages" );
37 # Define an entry point and include some files
38 define( "MEDIAWIKI", true );
39 define( "MEDIAWIKI_INSTALL", true );
41 // Run version checks before including other files
42 // so people don't see a scary parse error.
43 require_once( "install-utils.inc" );
44 install_version_checks();
46 require_once( "includes/Defines.php" );
47 require_once( "includes/DefaultSettings.php" );
48 require_once( "includes/MagicWord.php" );
49 require_once( "includes/Namespace.php" );
50 require_once( "includes/ProfilerStub.php" );
52 ## Databases we support:
55 $ourdb['mysql']['fullname'] = 'MySQL';
56 $ourdb['mysql']['havedriver'] = 0;
57 $ourdb['mysql']['compile'] = 'mysql';
58 $ourdb['mysql']['bgcolor'] = '#ffe5a7';
59 $ourdb['mysql']['rootuser'] = 'root';
61 $ourdb['postgres']['fullname'] = 'PostgreSQL';
62 $ourdb['postgres']['havedriver'] = 0;
63 $ourdb['postgres']['compile'] = 'pgsql';
64 $ourdb['postgres']['bgcolor'] = '#aaccff';
65 $ourdb['postgres']['rootuser'] = 'postgres';
68 <!DOCTYPE HTML
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
71 <meta http
-equiv
="Content-type" content
="text/html; charset=utf-8">
72 <title
>MediaWiki
<?php
echo( $wgVersion ); ?
> Installation
</title
>
73 <style type
="text/css">
75 @import
"../skins/monobook/main.css";
79 margin
: 1em
0 1em
2.5em
;
86 .config
-section label
.column
{
98 zoom
: 100%
; /* IE hack */
101 .config
-section
.config
-desc
{
103 margin
: 0 0 2em
18em
;
108 .iput
-text
, .iput
-password
{
115 background
-color
: #fff;
123 background
-color
: #FFF0F0;
124 border
: 2px solid red
;
132 list-style
-type
: none
;
133 list-style
-image
: none
;
151 <script type
="text/javascript">
154 <?php
foreach (array_keys($ourdb) as $db) {
155 echo "\n document.getElementById('$db').style.display='none';";
160 function toggleDBarea(id
,defaultroot
) {
162 var dbarea
= document
.getElementById(id
).style
;
163 dbarea
.display
= (dbarea
.display
== 'none') ?
'block' : 'none';
164 var db
= document
.getElementById('RootUser');
166 <?php
foreach (array_keys($ourdb) as $db) {
167 echo " if (id == '$db') { db.value = '".$ourdb[$db]['rootuser']."';}\n";
176 <div id
="globalWrapper">
177 <div id
="column-content">
179 <div id
="bodyContent">
181 <h1
>MediaWiki
<?php
print $wgVersion ?
> Installation
</h1
>
185 /* Check for existing configurations and bug out! */
187 if( file_exists( "../LocalSettings.php" ) ) {
188 dieout( "<p><strong>Setup has completed, <a href='../index.php'>your wiki</a> is configured.</strong></p>
190 <p>Please delete the /config directory for extra security.</p></div></div></div></div>" );
193 if( file_exists( "./LocalSettings.php" ) ) {
194 writeSuccessMessage();
199 if( !is_writable( "." ) ) {
200 dieout( "<h2>Can't write config file, aborting</h2>
202 <p>In order to configure the wiki you have to make the <tt>config</tt> subdirectory
203 writable by the web server. Once configuration is done you'll move the created
204 <tt>LocalSettings.php</tt> to the parent directory, and for added safety you can
205 then remove the <tt>config</tt> subdirectory entirely.</p>
207 <p>To make the directory writable on a Unix/Linux system:</p>
210 cd <i>/path/to/wiki</i>
214 <p>Afterwards retry to start the <a href=\"\">setup</a>.</p>" );
218 require_once( "install-utils.inc" );
219 require_once( "maintenance/updaters.inc" );
222 function getEncoded( $data ) {
223 # removing latin1 support, no need...
226 function getSitename() { return $this->getEncoded( $this->Sitename
); }
227 function getSysopName() { return $this->getEncoded( $this->SysopName
); }
228 function getSysopPass() { return $this->getEncoded( $this->SysopPass
); }
235 <b
>Don
't forget security updates!</b> Keep an eye on the
236 <a href="http://mail.wikimedia.org/mailman/listinfo/mediawiki-announce">low-traffic
237 release announcements mailing list</a>.
242 <h2>Checking environment...</h2>
243 <p><em>Please include all of the lines below when reporting installation problems.</em></p>
244 <ul class="env-check">
248 $wgNoOutputBuffer = true;
249 $conf = new ConfigData;
251 install_version_checks();
253 print "<li>PHP " . phpversion() . " installed</li>\n";
255 ## Temporarily turn off all errors as we try to discover installed databases
256 $olderrnum = error_reporting(0);
258 $phpdatabases = array();
259 foreach (array_keys($ourdb) as $db) {
260 $compname = $ourdb[$db]['compile
'];
261 if (extension_loaded($compname) or dl($compname . '.' . PHP_SHLIB_SUFFIX)) {
262 array_push($phpdatabases, $db);
263 $ourdb[$db]['havedriver
'] = 1;
267 error_reporting($olderrornum);
269 if (!$phpdatabases) {
270 print "Could not find a suitable database driver!<ul>";
271 foreach (array_keys($ourdb) AS $db) {
272 $comp = $ourdb[$db]['compile
'];
273 $full = $ourdb[$db]['fullname
'];
274 print "<li>For <b>$full</b>, compile PHP using <b>--with-$comp</b>, "
275 ."or install the $comp.so module</li>\n";
277 dieout( "</ul></ul>" );
280 print "<li>Found database drivers for:";
281 foreach (array_keys($ourdb) AS $db) {
282 if ($ourdb[$db]['havedriver
']) {
283 $DefaultDBtype = $db;
284 print " ".$ourdb[$db]['fullname
'];
288 if (count($phpdatabases) != 1)
291 if( ini_get( "register_globals" ) ) {
294 <div style="font-size:110%">
295 <strong class="error">Warning:</strong>
296 <strong>PHP's
<tt
><a href
="http://php.net/register_globals">register_globals
</a
></tt
> option is enabled
. Disable it
if you can
.</strong
>
298 MediaWiki will work
, but your server is more exposed to PHP
-based security vulnerabilities
.
305 if( ini_get( "magic_quotes_runtime" ) ) {
307 ?
><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
>
308 This option corrupts data input unpredictably
; you cannot install
or use
309 MediaWiki unless this option is disabled
.
313 if( ini_get( "magic_quotes_sybase" ) ) {
315 ?
><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
>
316 This option corrupts data input unpredictably
; you cannot install
or use
317 MediaWiki unless this option is disabled
.
321 if( ini_get( "mbstring.func_overload" ) ) {
323 ?
><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
>
324 This option causes errors
and may corrupt data unpredictably
;
325 you cannot install
or use MediaWiki unless this option is disabled
.
330 dieout( "</ul><p>Cannot install MediaWiki.</p>" );
333 if( ini_get( "safe_mode" ) ) {
334 $conf->safeMode
= true;
336 <li
><b
class='error'>Warning
:</b
> <strong
>PHP
's
337 <a href='http
://www.php.net/features.safe-mode'>safe mode</a> is active.</strong>
338 You may have problems caused by this
, particularly
if using image uploads
.
342 $conf->safeMode
= false;
345 $sapi = php_sapi_name();
346 $conf->prettyURLs
= true;
347 print "<li>PHP server API is $sapi; ";
350 case "apache2handler":
351 print "ok, using pretty URLs (<tt>index.php/Page_Title</tt>)";
355 // For some reason cgi.fix_pathinfo isn't retrievable via ini_get()
356 if( isset( $_SERVER['ORIG_PATH_INFO'] ) ) {
357 echo "cgi.fix_pathinfo is set, good; ";
359 echo "cgi.fix_pathinfo is not set, assuming PATH_INFO broken; ";
360 $conf->prettyURLs
= false;
363 case "apache2filter":
365 // Pretty sure these two break from past tests
366 $conf->prettyURLs
= false;
369 print "unknown, assuming PATH_INFO broken for safety; ";
370 $conf->prettyURLs
= false;
372 if( $conf->prettyURLs
) {
373 print "ok, using pretty URLs (<tt>index.php/Page_Title</tt>)";
375 print "using ugly URLs (<tt>index.php?title=Page_Title</tt>)";
379 $conf->xml
= function_exists( "utf8_encode" );
381 print "<li>Have XML / Latin1-UTF-8 conversion support.</li>\n";
383 dieout( "PHP's XML module is missing; the wiki requires functions in
384 this module and won't work in this configuration.
385 If you're running Mandrake, install the php-xml package." );
388 # Crude check for session support
389 if( !function_exists( 'session_name' ) )
390 dieout( "PHP's session module is missing. MediaWiki requires session support in order to function." );
393 if( !function_exists( 'preg_match' ) )
394 dieout( "The PCRE regular expression functions are missing. MediaWiki requires these in order to function." );
396 $memlimit = ini_get( "memory_limit" );
397 $conf->raiseMemory
= false;
398 if( empty( $memlimit ) ||
$memlimit == -1 ) {
399 print "<li>PHP is configured with no <tt>memory_limit</tt>.</li>\n";
401 print "<li>PHP's <tt>memory_limit</tt> is " . htmlspecialchars( $memlimit ) . ". <strong>If this is too low, installation may fail!</strong> ";
402 $n = intval( $memlimit );
403 if( preg_match( '/^([0-9]+)[Mm]$/', trim( $memlimit ), $m ) ) {
404 $n = intval( $m[1] * (1024*1024) );
406 if( $n < 20*1024*1024 ) {
407 print "Attempting to raise limit to 20M... ";
408 if( false === ini_set( "memory_limit", "20M" ) ) {
411 $conf->raiseMemory
= true;
418 $conf->zlib
= function_exists( "gzencode" );
420 print "<li>Have zlib support; enabling output compression.</li>\n";
422 print "<li>No zlib support.</li>\n";
425 $conf->turck
= function_exists( 'mmcache_get' );
426 if ( $conf->turck
) {
427 print "<li><a href=\"http://turck-mmcache.sourceforge.net/\">Turck MMCache</a> installed</li>\n";
430 $conf->apc
= function_exists('apc_fetch');
432 print "<li><a href=\"http://www.php.net/apc\">APC</a> installed</li>";
435 $conf->eaccel
= function_exists( 'eaccelerator_get' );
436 if ( $conf->eaccel
) {
437 $conf->turck
= 'eaccelerator';
438 print "<li><a href=\"http://eaccelerator.sourceforge.net/\">eAccelerator</a> installed</li>\n";
441 if( !$conf->turck
&& !$conf->eaccel
&& !$conf->apc
) {
442 echo( '<li>Couldn\'t find <a href="http://turck-mmcache.sourceforge.net">Turck MMCache</a>,
443 <a href="http://eaccelerator.sourceforge.net">eAccelerator</a> or
444 <a href="http://www.php.net/apc">APC</a>. Object caching functions cannot be used.</li>' );
447 $conf->diff3
= false;
448 $diff3locations = array_merge(
455 explode( $sep, getenv( "PATH" ) ) );
456 $diff3names = array( "gdiff3", "diff3", "diff3.exe" );
458 $diff3versioninfo = array( '$1 --version 2>&1', 'diff3 (GNU diffutils)' );
459 foreach ($diff3locations as $loc) {
460 $exe = locate_executable($loc, $diff3names, $diff3versioninfo);
461 if ($exe !== false) {
468 print "<li>Found GNU diff3: <tt>$conf->diff3</tt>.</li>";
470 print "<li>GNU diff3 not found.</li>";
472 $conf->ImageMagick
= false;
473 $imcheck = array( "/usr/bin", "/opt/csw/bin", "/usr/local/bin", "/sw/bin", "/opt/local/bin" );
474 foreach( $imcheck as $dir ) {
475 $im = "$dir/convert";
476 if( file_exists( $im ) ) {
477 print "<li>Found ImageMagick: <tt>$im</tt>; image thumbnailing will be enabled if you enable uploads.</li>\n";
478 $conf->ImageMagick
= $im;
483 $conf->HaveGD
= function_exists( "imagejpeg" );
484 if( $conf->HaveGD
) {
485 print "<li>Found GD graphics library built-in";
486 if( !$conf->ImageMagick
) {
487 print ", image thumbnailing will be enabled if you enable uploads";
491 if( !$conf->ImageMagick
) {
492 print "<li>Couldn't find GD library or ImageMagick; image thumbnailing disabled.</li>\n";
496 $conf->UseImageResize
= $conf->HaveGD ||
$conf->ImageMagick
;
498 $conf->IP
= dirname( dirname( __FILE__
) );
499 print "<li>Installation directory: <tt>" . htmlspecialchars( $conf->IP
) . "</tt></li>\n";
502 // PHP_SELF isn't available sometimes, such as when PHP is CGI but
503 // cgi.fix_pathinfo is disabled. In that case, fall back to SCRIPT_NAME
504 // to get the path to the current script... hopefully it's reliable. SIGH
505 $path = ($_SERVER["PHP_SELF"] === '')
506 ?
$_SERVER["SCRIPT_NAME"]
507 : $_SERVER["PHP_SELF"];
508 $conf->ScriptPath
= preg_replace( '{^(.*)/config.*$}', '$1', $path );
509 print "<li>Script URI path: <tt>" . htmlspecialchars( $conf->ScriptPath
) . "</tt></li>\n";
511 print "<li style='font-weight:bold;color:green;font-size:110%'>Environment checked. You can install MediaWiki.</li>\n";
512 $conf->posted
= ($_SERVER["REQUEST_METHOD"] == "POST");
514 $conf->Sitename
= ucfirst( importPost( "Sitename", "" ) );
515 $defaultEmail = empty( $_SERVER["SERVER_ADMIN"] )
517 : $_SERVER["SERVER_ADMIN"];
518 $conf->EmergencyContact
= importPost( "EmergencyContact", $defaultEmail );
519 $conf->DBtype
= importPost( "DBtype", $DefaultDBtype );
523 $conf->DBserver
= importPost( "DBserver", "localhost" );
524 $conf->DBname
= importPost( "DBname", "wikidb" );
525 $conf->DBuser
= importPost( "DBuser", "wikiuser" );
526 $conf->DBpassword
= importPost( "DBpassword" );
527 $conf->DBpassword2
= importPost( "DBpassword2" );
528 $conf->SysopName
= importPost( "SysopName", "WikiSysop" );
529 $conf->SysopPass
= importPost( "SysopPass" );
530 $conf->SysopPass2
= importPost( "SysopPass2" );
531 $conf->RootUser
= importPost( "RootUser", "root" );
532 $conf->RootPW
= importPost( "RootPW", "-" );
535 $conf->DBprefix
= importPost( "DBprefix" );
536 $conf->DBmysql5
= (importPost( "DBmysql5" ) == "true") ?
"true" : "false";
537 $conf->LanguageCode
= importPost( "LanguageCode", "en" );
539 ## Postgres specific:
540 $conf->DBport
= importPost( "DBport", "5432" );
541 $conf->DBmwschema
= importPost( "DBmwschema", "mediawiki" );
542 $conf->DBts2schema
= importPost( "DBts2schema", "public" );
544 /* Check for validity */
547 if( $conf->Sitename
== "" ||
$conf->Sitename
== "MediaWiki" ||
$conf->Sitename
== "Mediawiki" ) {
548 $errs["Sitename"] = "Must not be blank or \"MediaWiki\"";
550 if( $conf->DBuser
== "" ) {
551 $errs["DBuser"] = "Must not be blank";
553 if( $conf->DBpassword
== "" ) {
554 $errs["DBpassword"] = "Must not be blank";
556 if( $conf->DBpassword
!= $conf->DBpassword2
) {
557 $errs["DBpassword2"] = "Passwords don't match!";
559 if( !preg_match( '/^[A-Za-z_0-9]*$/', $conf->DBprefix
) ) {
560 $errs["DBprefix"] = "Invalid table prefix";
563 if( $conf->SysopPass
== "" ) {
564 $errs["SysopPass"] = "Must not be blank";
566 if( $conf->SysopPass
!= $conf->SysopPass2
) {
567 $errs["SysopPass2"] = "Passwords don't match!";
570 $conf->License
= importRequest( "License", "none" );
571 if( $conf->License
== "gfdl" ) {
572 $conf->RightsUrl
= "http://www.gnu.org/copyleft/fdl.html";
573 $conf->RightsText
= "GNU Free Documentation License 1.2";
574 $conf->RightsCode
= "gfdl";
575 $conf->RightsIcon
= '${wgStylePath}/common/images/gnu-fdl.png';
576 } elseif( $conf->License
== "none" ) {
577 $conf->RightsUrl
= $conf->RightsText
= $conf->RightsCode
= $conf->RightsIcon
= "";
579 $conf->RightsUrl
= importRequest( "RightsUrl", "" );
580 $conf->RightsText
= importRequest( "RightsText", "" );
581 $conf->RightsCode
= importRequest( "RightsCode", "" );
582 $conf->RightsIcon
= importRequest( "RightsIcon", "" );
585 $conf->Shm
= importRequest( "Shm", "none" );
586 $conf->MCServers
= importRequest( "MCServers" );
588 /* Test memcached servers */
590 if ( $conf->Shm
== 'memcached' && $conf->MCServers
) {
591 $conf->MCServerArray
= array_map( 'trim', explode( ',', $conf->MCServers
) );
592 foreach ( $conf->MCServerArray
as $server ) {
593 $error = testMemcachedServer( $server );
595 $errs["MCServers"] = $error;
599 } else if ( $conf->Shm
== 'memcached' ) {
600 $errs["MCServers"] = "Please specify at least one server if you wish to use memcached";
603 /* default values for installation */
604 $conf->Email
= importRequest("Email", "email_enabled");
605 $conf->Emailuser
= importRequest("Emailuser", "emailuser_enabled");
606 $conf->Enotif
= importRequest("Enotif", "enotif_allpages");
607 $conf->Eauthent
= importRequest("Eauthent", "eauthent_enabled");
609 if( $conf->posted
&& ( 0 == count( $errs ) ) ) {
610 do { /* So we can 'continue' to end prematurely */
611 $conf->Root
= ($conf->RootPW
!= "");
613 /* Load up the settings and get installin' */
614 $local = writeLocalSettings( $conf );
615 echo "<li style=\"list-style: none\">\n";
616 echo "<p><b>Generating configuration file...</b></p>\n";
617 // for debugging: // echo "<pre>" . htmlspecialchars( $local ) . "</pre>\n";
620 $wgCommandLineMode = false;
623 $conf->DBtypename
= '';
624 foreach (array_keys($ourdb) as $db) {
625 if ($conf->DBtype
=== $db)
626 $conf->DBtypename
= $ourdb[$db]['fullname'];
628 if ( ! strlen($conf->DBtype
)) {
629 $errs["DBpicktype"] = "Please choose a database type";
633 if (! $conf->DBtypename
) {
634 $errs["DBtype"] = "Unknown database type '$conf->DBtype'";
637 print "<li>Database type: {$conf->DBtypename}</li>\n";
638 $dbclass = 'Database'.ucfirst($conf->DBtype
);
639 $wgDBtype = $conf->DBtype
;
640 $wgDBadminuser = "root";
641 $wgDBadminpassword = $conf->RootPW
;
644 $wgDBprefix = $conf->DBprefix
;
646 ## Postgres specific:
647 $wgDBport = $conf->DBport
;
648 $wgDBmwschema = $conf->DBmwschema
;
649 $wgDBts2schema = $conf->DBts2schema
;
651 $wgCommandLineMode = true;
652 $wgUseDatabaseMessages = false; /* FIXME: For database failure */
653 require_once( "includes/Setup.php" );
656 require_once( "maintenance/InitialiseMessages.inc" );
658 $wgTitle = Title
::newFromText( "Installation script" );
659 error_reporting( E_ALL
);
660 print "<li>Loading class: $dbclass";
663 if( $conf->DBtype
== 'mysql' ) {
664 $mysqlOldClient = version_compare( mysql_get_client_info(), "4.1.0", "lt" );
665 if( $mysqlOldClient ) {
666 print "<li><b>PHP is linked with old MySQL client libraries. If you are
667 using a MySQL 4.1 server and have problems connecting to the database,
668 see <a href='http://dev.mysql.com/doc/mysql/en/old-client.html'
669 >http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b></li>\n";
671 $ok = true; # Let's be optimistic
673 # Decide if we're going to use the superuser or the regular database user
674 if( $conf->RootPW
== '-' ) {
677 $db_user = $wgDBuser;
678 $db_pass = $wgDBpassword;
682 $db_user = $conf->RootUser
;
683 $db_pass = $conf->RootPW
;
687 echo( "<li>Attempting to connect to database server as $db_user..." );
688 $wgDatabase = Database
::newFromParams( $wgDBserver, $db_user, $db_pass, '', 1 );
690 # Check the connection and respond to errors
691 if( $wgDatabase->isOpen() ) {
694 $wgDBadminuser = $db_user;
695 $wgDBadminpassword = $db_pass;
696 echo( "success.</li>\n" );
697 $wgDatabase->ignoreErrors( true );
698 $myver = $wgDatabase->getServerVersion();
700 # There were errors, report them and back out
702 $errno = mysql_errno();
703 $errtx = htmlspecialchars( mysql_error() );
707 echo( "failed due to authentication errors. Check passwords.</li>" );
709 # The superuser details are wrong
710 $errs["RootUser"] = "Check username";
711 $errs["RootPW"] = "and password";
713 # The regular user details are wrong
714 $errs["DBuser"] = "Check username";
715 $errs["DBpassword"] = "and password";
721 # General connection problem
722 echo( "failed with error [$errno] $errtx.</li>\n" );
723 $errs["DBserver"] = "Connection failed";
728 if( !$ok ) { continue; }
730 } else /* not mysql */ {
731 error_reporting( E_ALL
);
733 ## Possible connect as a superuser
734 if( $conf->RootPW
!= '-' and strlen($conf->RootPW
)) {
735 $wgDBsuperuser = $conf->RootUser
;
736 echo( "<li>Attempting to connect to database \"postgres\" as superuser \"$wgDBsuperuser\"..." );
737 $wgDatabase = $dbc->newFromParams($wgDBserver, $wgDBsuperuser, $conf->RootPW
, "postgres", 1);
738 if (!$wgDatabase->isOpen()) {
739 print " error: " . $wgDatabase->lastError() . "</li>\n";
740 $errs["DBserver"] = "Could not connect to database as superuser";
741 $errs["RootUser"] = "Check username";
742 $errs["RootPW"] = "and password";
746 echo( "<li>Attempting to connect to database \"$wgDBname\" as \"$wgDBuser\"..." );
747 $wgDatabase = $dbc->newFromParams($wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1);
748 if (!$wgDatabase->isOpen()) {
749 print " error: " . $wgDatabase->lastError() . "</li>\n";
751 $myver = $wgDatabase->getServerVersion();
755 if ( !$wgDatabase->isOpen() ) {
756 $errs["DBserver"] = "Couldn't connect to database";
760 print "<li>Connected to $myver";
761 if ($conf->DBtype
== 'mysql') {
762 if( version_compare( $myver, "4.0.14" ) < 0 ) {
763 dieout( " -- mysql 4.0.14 or later required. Aborting." );
765 $mysqlNewAuth = version_compare( $myver, "4.1.0", "ge" );
766 if( $mysqlNewAuth && $mysqlOldClient ) {
767 print "; <b class='error'>You are using MySQL 4.1 server, but PHP is linked
768 to old client libraries; if you have trouble with authentication, see
769 <a href='http://dev.mysql.com/doc/mysql/en/old-client.html'
770 >http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b>";
773 if( $mysqlNewAuth ) {
774 print "; enabling MySQL 4.1/5.0 charset mode";
776 print "; <b class='error'>MySQL 4.1/5.0 charset mode enabled,
777 but older version detected; will likely fail.</b>";
782 @$sel = $wgDatabase->selectDB( $wgDBname );
784 print "<li>Database <tt>" . htmlspecialchars( $wgDBname ) . "</tt> exists</li>\n";
786 $err = mysql_errno();
787 if ( $err != 1049 ) {
788 print "<ul><li>Error selecting database $wgDBname: $err " .
789 htmlspecialchars( mysql_error() ) . "</li></ul>";
792 $res = $wgDatabase->query( "CREATE DATABASE `$wgDBname`" );
794 print "<li>Couldn't create database <tt>" .
795 htmlspecialchars( $wgDBname ) .
796 "</tt>; try with root access or check your username/pass.</li>\n";
797 $errs["RootPW"] = "<- Enter";
800 print "<li>Created database <tt>" . htmlspecialchars( $wgDBname ) . "</tt></li>\n";
802 $wgDatabase->selectDB( $wgDBname );
804 else if ($conf->DBtype
== 'postgres') {
805 if( version_compare( $myver, "PostgreSQL 8.0" ) < 0 ) {
806 dieout( " <b>Postgres 8.0 or later is required</b>. Aborting.</li></ul>" );
810 if( $wgDatabase->tableExists( "cur" ) ||
$wgDatabase->tableExists( "revision" ) ) {
811 print "<li>There are already MediaWiki tables in this database. Checking if updates are needed...</li>\n";
813 # Create user if required (todo: other databases)
814 if ( $conf->Root
&& $conf->DBtype
== 'mysql') {
815 $conn = $dbc->newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1 );
816 if ( $conn->isOpen() ) {
817 print "<li>DB user account ok</li>\n";
820 print "<li>Granting user permissions...";
821 if( $mysqlOldClient && $mysqlNewAuth ) {
822 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>";
825 dbsource( "../maintenance/users.sql", $wgDatabase );
834 print "<li>Finished update checks.</li>\n";
836 # FIXME: Check for errors
837 print "<li>Creating tables...";
838 if ($conf->DBtype
== 'mysql') {
840 print " using MySQL 5 table defs...";
841 dbsource( "../maintenance/mysql5/tables.sql", $wgDatabase );
843 print " using MySQL 4 table defs...";
844 dbsource( "../maintenance/tables.sql", $wgDatabase );
846 dbsource( "../maintenance/interwiki.sql", $wgDatabase );
847 } else if ($conf->DBtype
== 'postgres') {
848 $wgDatabase->setup_database();
851 $errs["DBtype"] = "Do not know how to handle database type '$conf->DBtype'";
855 print " done.</li>\n";
857 print "<li>Initializing data...</li>\n";
858 $wgDatabase->insert( 'site_stats',
859 array ( 'ss_row_id' => 1,
860 'ss_total_views' => 0,
861 'ss_total_edits' => 0,
862 'ss_good_articles' => 0 ) );
864 # Set up the "regular user" account *if we can, and if we need to*
865 if( $conf->Root
and $conf->DBtype
== 'mysql') {
867 $wgDatabase2 = $dbc->newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1 );
868 if( $wgDatabase2->isOpen() ) {
869 # Nope, just close the test connection and continue
870 $wgDatabase2->close();
871 echo( "<li>User $wgDBuser exists. Skipping grants.</li>\n" );
873 # Yes, so run the grants
874 echo( "<li>Granting user permissions to $wgDBuser on $wgDBname..." );
875 dbsource( "../maintenance/users.sql", $wgDatabase );
876 echo( "success.</li>\n" );
880 if( $conf->SysopName
) {
881 $u = User
::newFromName( $conf->getSysopName() );
883 print "<li><strong class=\"error\">Warning:</strong> Skipped sysop account creation - invalid username!</li>\n";
885 else if ( 0 == $u->idForName() ) {
887 $u->setPassword( $conf->getSysopPass() );
890 $u->addGroup( "sysop" );
891 $u->addGroup( "bureaucrat" );
893 print "<li>Created sysop account <tt>" .
894 htmlspecialchars( $conf->SysopName
) . "</tt>.</li>\n";
896 print "<li>Could not create user - already exists!</li>\n";
899 print "<li>Skipped sysop account creation, no name given.</li>\n";
902 $titleobj = Title
::newFromText( wfMsgNoDB( "mainpage" ) );
903 $article = new Article( $titleobj );
904 $newid = $article->insertOn( $wgDatabase );
905 $revision = new Revision( array(
907 'text' => wfMsg( 'mainpagetext' ) . "\n\n" . wfMsg( 'mainpagedocfooter' ),
910 'user_text' => 'MediaWiki default',
912 $revid = $revision->insertOn( $wgDatabase );
913 $article->updateRevisionOn( $wgDatabase, $revision );
915 initialiseMessages( false, false, 'printListItem' );
918 /* Write out the config file now that all is well */
919 print "<li style=\"list-style: none\">\n";
920 print "<p>Creating LocalSettings.php...</p>\n\n";
921 $localSettings = "<" . "?php$endl$local$endl?" . ">\r\n";
922 // Fix up a common line-ending problem (due to CVS on Windows)
923 $localSettings = str_replace( "\r\n", "\n", $localSettings );
924 $f = fopen( "LocalSettings.php", 'xt' );
927 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" .
928 "<p>Here's the file that would have been written, try to paste it into place manually:</p>\n" .
929 "<pre>\n" . htmlspecialchars( $localSettings ) . "</pre>\n" );
931 if(fwrite( $f, $localSettings ) ) {
933 writeSuccessMessage();
936 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");
949 if( count( $errs ) ) {
950 /* Display options form */
952 if( $conf->posted
) {
953 echo "<p class='error-top'>Something's not quite right yet; make sure everything below is filled out correctly.</p>\n";
957 <form action
="index.php" name
="config" method
="post">
962 <div
class="config-section">
963 <div
class="config-input">
965 aField( $conf, "Sitename", "Wiki name:" );
968 <p
class="config-desc">
969 Preferably a short word without punctuation
, i
.e
. "Wikipedia".<br
/>
970 Will appear
as the
namespace name
for "meta" pages
, and throughout the
interface.
973 <div
class="config-input">
975 aField( $conf, "EmergencyContact", "Contact e-mail:" );
978 <p
class="config-desc">
979 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
.
982 <div
class="config-input">
983 <label
class='column' for="LanguageCode">Language
:</label
>
984 <select id
="LanguageCode" name
="LanguageCode">
987 $list = getLanguageList();
988 foreach( $list as $code => $name ) {
989 $sel = ($code == $conf->LanguageCode
) ?
'selected="selected"' : '';
990 echo "\t\t<option value=\"$code\" $sel>$name</option>\n";
995 <p
class="config-desc">
996 Select the language
for your wiki
's interface. Some localizations aren't fully complete
. Unicode (UTF
-8) used
for all localizations
.
999 <div
class="config-input">
1000 <label
class='column'>Copyright
/license
:</label
>
1003 <li
><?php
aField( $conf, "License", "No license metadata", "radio", "none" ); ?
></li
>
1004 <li
><?php
aField( $conf, "License", "GNU Free Documentation License 1.2 (Wikipedia-compatible)", "radio", "gfdl" ); ?
></li
>
1006 aField( $conf, "License", "A Creative Commons license - ", "radio", "cc" );
1007 $partner = "MediaWiki";
1008 $exit = urlencode( "$wgServer{$conf->ScriptPath}/config/index.php?License=cc&RightsUrl=[license_url]&RightsText=[license_name]&RightsCode=[license_code]&RightsIcon=[license_button]" );
1009 $icon = urlencode( "$wgServer$wgUploadPath/wiki.png" );
1010 $ccApp = htmlspecialchars( "http://creativecommons.org/license/?partner=$partner&exit_url=$exit&partner_icon_url=$icon" );
1011 print "<a href=\"$ccApp\" target='_blank'>choose</a>";
1013 <?php
if( $conf->License
== "cc" ) { ?
>
1015 <li
><?php
aField( $conf, "RightsIcon", "<img src=\"" . htmlspecialchars( $conf->RightsIcon
) . "\" alt='icon' />", "hidden" ); ?
></li
>
1016 <li
><?php
aField( $conf, "RightsText", htmlspecialchars( $conf->RightsText
), "hidden" ); ?
></li
>
1017 <li
><?php
aField( $conf, "RightsCode", "code: " . htmlspecialchars( $conf->RightsCode
), "hidden" ); ?
></li
>
1018 <li
><?php
aField( $conf, "RightsUrl", "<a href=\"" . htmlspecialchars( $conf->RightsUrl
) . "\">" . htmlspecialchars( $conf->RightsUrl
) . "</a>", "hidden" ); ?
></li
>
1024 <p
class="config-desc">
1025 A notice
, icon
, and machine
-readable copyright metadata will be displayed
for the license you pick
.
1029 <div
class="config-input">
1030 <?php
aField( $conf, "SysopName", "Admin username:" ) ?
>
1032 <div
class="config-input">
1033 <?php
aField( $conf, "SysopPass", "Password:", "password" ) ?
>
1035 <div
class="config-input">
1036 <?php
aField( $conf, "SysopPass2", "Password confirm:", "password" ) ?
>
1038 <p
class="config-desc">
1039 An admin can lock
/delete pages
, block users from editing
, and do other maintenance tasks
.<br
/>
1040 A
new account will be added only when creating a
new wiki database
.
1043 <div
class="config-input">
1044 <label
class='column'>Shared memory caching
:</label
>
1047 <li
><?php
aField( $conf, "Shm", "No caching", "radio", "none" ); ?
></li
>
1049 if ( $conf->turck
) {
1051 aField( $conf, "Shm", "Turck MMCache", "radio", "turck" );
1056 aField( $conf, "Shm", "APC", "radio", "apc" );
1059 if ( $conf->eaccel
) {
1061 aField( $conf, "Shm", "eAccelerator", "radio", "eaccel" );
1065 <li
><?php
aField( $conf, "Shm", "Memcached", "radio", "memcached" ); ?
></li
>
1067 <div style
="clear:left"><?php
aField( $conf, "MCServers", "Memcached servers:", "text" ) ?
></div
>
1069 <p
class="config-desc">
1070 Using a shared memory system such
as Turck MMCache
, APC
, eAccelerator
, or Memcached
1071 will speed up MediaWiki significantly
. Memcached is the best solution but needs to be
1072 installed
. Specify the server addresses
and ports in a comma
-separted
list. Only
1073 use Turck shared memory
if the wiki will be running on a single Apache server
.
1077 <h2
>E
-mail
, e
-mail notification
and authentication setup
</h2
>
1079 <div
class="config-section">
1080 <div
class="config-input">
1081 <label
class='column'>E
-mail
features (global):</label
>
1083 <li
><?php
aField( $conf, "Email", "Enabled", "radio", "email_enabled" ); ?
></li
>
1084 <li
><?php
aField( $conf, "Email", "Disabled", "radio", "email_disabled" ); ?
></li
>
1087 <p
class="config-desc">
1088 Use this to disable all e
-mail
functions (password reminders
, user
-to
-user e
-mail
and e
-mail notifications
)
1089 if sending mail doesn
't work on your server.
1092 <div class="config-input">
1093 <label class='column
'>User-to-user e-mail:</label>
1095 <li><?php aField( $conf, "Emailuser", "Enabled", "radio", "emailuser_enabled" ); ?></li>
1096 <li><?php aField( $conf, "Emailuser", "Disabled", "radio", "emailuser_disabled" ); ?></li>
1099 <p class="config-desc">
1100 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.
1102 <div class="config-input">
1103 <label class='column
'>E-mail notification about changes:</label>
1105 <li><?php aField( $conf, "Enotif", "Disabled", "radio", "enotif_disabled" ); ?></li>
1106 <li><?php aField( $conf, "Enotif", "Enabled for changes to user discussion pages only", "radio", "enotif_usertalk" ); ?></li>
1107 <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>
1110 <div class="config-desc">
1112 For this feature to work, an e-mail address must be present for the user account, and the notification
1113 options in the user's preferences must be enabled
. Also note the
1114 authentication option below
. When testing the feature
, keep in mind that your own changes will never trigger notifications to be sent to yourself
.</p
>
1116 <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
>
1119 <div
class="config-input">
1120 <label
class='column'>E
-mail address authentication
:</label
>
1122 <li
><?php
aField( $conf, "Eauthent", "Disabled", "radio", "eauthent_disabled" ); ?
></li
>
1123 <li
><?php
aField( $conf, "Eauthent", "Enabled", "radio", "eauthent_enabled" ); ?
></li
>
1126 <div
class="config-desc">
1127 <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
1128 change notification mails
. Setting this option is
<B
>recommended
</B
> for public wikis because of potential abuse of the e
-mail features above
.</p
>
1133 <h2
>Database config
</h2
>
1135 <div
class="config-section">
1136 <div
class="config-input">
1137 <label
class='column'>Database type
:</label
>
1138 <?php
if (isset($errs['DBpicktype'])) print "<span class='error'>$errs[DBpicktype]</span>\n"; ?
>
1139 <ul
class='plain'><?php
database_picker($conf) ?
></ul
>
1142 <div
class="config-input" style
="clear:left"><?php
1143 aField( $conf, "DBserver", "Database host:" );
1145 <p
class="config-desc">
1146 If your database server isn
't on your web server, enter the name or IP address here.
1149 <div class="config-input"><?php
1150 aField( $conf, "DBname", "Database name:" );
1152 <div class="config-input"><?php
1153 aField( $conf, "DBuser", "DB username:" );
1155 <div class="config-input"><?php
1156 aField( $conf, "DBpassword", "DB password:", "password" );
1158 <div class="config-input"><?php
1159 aField( $conf, "DBpassword2", "DB password confirm:", "password" );
1161 <p class="config-desc">
1162 If you only have a single user account and database available,
1163 enter those here. If you have database root access (see below)
1164 you can specify new accounts/databases to be created. This account
1165 will not be created if it pre-exists. If this is the case, ensure that it
1166 has SELECT, INSERT, UPDATE and DELETE permissions on the MediaWiki database.
1169 <div class="config-input">
1171 aField( $conf, "RootUser", "Superuser account:", "superuser" );
1174 <div class="config-input">
1176 aField( $conf, "RootPW", "Superuser password:", "password" );
1180 <p class="config-desc">
1181 If the database user specified above does not exist, or does not have access to create
1182 the database (if needed) or tables within it, please provide details of a superuser account,
1183 such as <strong>root</strong>, which does. Leave the password set to <strong>-</strong> if this is not needed.
1186 <?php database_switcher('mysql
'); ?>
1187 <div class="config-input"><?php
1188 aField( $conf, "DBprefix", "Database table prefix:" );
1190 <div class="config-desc">
1191 <p>If you need to share one database between multiple wikis, or
1192 MediaWiki and another web application, you may choose to
1193 add a prefix to all the table names to avoid conflicts.</p>
1195 <p>Avoid exotic characters; something like <tt>mw_</tt> is good.</p>
1198 <div class="config-input"><label class="column">Database charset</label>
1199 <div>Select one:</div>
1201 <li><?php aField( $conf, "DBmysql5", "Backwards-compatible UTF-8", "radio", "false" ); ?></li>
1202 <li><?php aField( $conf, "DBmysql5", "Experimental MySQL 4.1/5.0 UTF-8", "radio", "true" ); ?></li>
1205 <p class="config-desc">
1206 <b>EXPERIMENTAL:</b> You can enable explicit Unicode charset support
1207 for MySQL 4.1 and 5.0 servers. This is not well tested and may
1208 cause things to break. <b>If upgrading an older installation, leave
1209 in backwards-compatible mode.</b>
1213 <?php database_switcher('postgres
'); ?>
1214 <div class="config-input"><?php
1215 aField( $conf, "DBport", "Database port:" );
1217 <div class="config-input"><?php
1218 aField( $conf, "DBmwschema", "Schema for mediawiki:" );
1220 <div class="config-input"><?php
1221 aField( $conf, "DBts2schema", "Schema for tsearch2:" );
1223 <div class="config-desc">
1224 <p>The username specified above will have it's search path set to the above schemas
,
1225 so it is recommended that you create a
new user
.</p
>
1229 <div
class="config-input" style
="padding:2em 0 3em">
1230 <label
class='column'> 
;</label
>
1231 <input type
="submit" value
="Install MediaWiki!" class="btn-install" />
1236 <script type
="text/javascript">
1237 window
.onload
= toggleDBarea('<?php echo $conf->DBtype; ?>',
1239 ## If they passed in a root user name, don't populate it on page load
1240 echo strlen(importPost('RootUser', '')) ?
0 : 1;
1249 /* -------------------------------------------------------------------------------------- */
1250 function writeSuccessMessage() {
1251 if ( ini_get( 'safe_mode' ) && !ini_get( 'open_basedir' ) ) {
1253 <p>Installation successful!</p>
1254 <p>To complete the installation, please do the following:
1256 <li>Download config/LocalSettings.php with your FTP client or file manager</li>
1257 <li>Upload it to the parent directory</li>
1258 <li>Delete config/LocalSettings.php</li>
1259 <li>Start using <a href='../index.php'>your wiki</a>!
1261 <p>If you are in a shared hosting environment, do <strong>not</strong> just move LocalSettings.php
1262 remotely. LocalSettings.php is currently owned by the user your webserver is running under,
1263 which means that anyone on the same server can read your database password! Downloading
1264 it and uploading it again will hopefully change the ownership to a user ID specific to you.</p>
1267 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
1268 <strong><a href='../index.php'>this link</a></strong> to your wiki.</p>\n";
1273 function escapePhpString( $string ) {
1274 return strtr( $string,
1285 function writeLocalSettings( $conf ) {
1286 $conf->UseImageResize
= $conf->UseImageResize ?
'true' : 'false';
1287 $conf->PasswordSender
= $conf->EmergencyContact
;
1288 $zlib = ($conf->zlib ?
"" : "# ");
1289 $magic = ($conf->ImageMagick ?
"" : "# ");
1290 $convert = ($conf->ImageMagick ?
$conf->ImageMagick
: "/usr/bin/convert" );
1291 $pretty = ($conf->prettyURLs ?
"" : "# ");
1292 $ugly = ($conf->prettyURLs ?
"# " : "");
1293 $rights = ($conf->RightsUrl
) ?
"" : "# ";
1294 $hashedUploads = $conf->safeMode ?
'' : '# ';
1296 switch ( $conf->Shm
) {
1298 $cacheType = 'CACHE_MEMCACHED';
1299 $mcservers = var_export( $conf->MCServerArray
, true );
1304 $cacheType = 'CACHE_ACCEL';
1305 $mcservers = 'array()';
1308 $cacheType = 'CACHE_NONE';
1309 $mcservers = 'array()';
1312 if ( $conf->Email
== 'email_enabled' ) {
1313 $enableemail = 'true';
1314 $enableuseremail = ( $conf->Emailuser
== 'emailuser_enabled' ) ?
'true' : 'false' ;
1315 $eauthent = ( $conf->Eauthent
== 'eauthent_enabled' ) ?
'true' : 'false' ;
1316 switch ( $conf->Enotif
) {
1317 case 'enotif_usertalk':
1318 $enotifusertalk = 'true';
1319 $enotifwatchlist = 'false';
1321 case 'enotif_allpages':
1322 $enotifusertalk = 'true';
1323 $enotifwatchlist = 'true';
1326 $enotifusertalk = 'false';
1327 $enotifwatchlist = 'false';
1330 $enableuseremail = 'false';
1331 $enableemail = 'false';
1332 $eauthent = 'false';
1333 $enotifusertalk = 'false';
1334 $enotifwatchlist = 'false';
1337 $file = @fopen
( "/dev/urandom", "r" );
1339 $secretKey = bin2hex( fread( $file, 32 ) );
1343 for ( $i=0; $i<8; $i++
) {
1344 $secretKey .= dechex(mt_rand(0, 0x7fffffff));
1346 print "<li>Warning: \$wgSecretKey key is insecure, generated with mt_rand(). Consider changing it manually.</li>\n";
1349 # Add slashes to strings for double quoting
1350 $slconf = array_map( "escapePhpString", get_object_vars( $conf ) );
1351 if( $conf->License
== 'gfdl' ) {
1352 # Needs literal string interpolation for the current style path
1353 $slconf['RightsIcon'] = $conf->RightsIcon
;
1357 # This file was automatically generated by the MediaWiki installer.
1358 # If you make manual changes, please keep track in case you need to
1359 # recreate them later.
1361 # See includes/DefaultSettings.php for all configurable settings
1362 # and their default values, but don't forget to make changes in _this_
1365 # If you customize your file layout, set \$IP to the directory that contains
1366 # the other MediaWiki files. It will be used as a base to locate files.
1367 if( defined( 'MW_INSTALL_PATH' ) ) {
1368 \$IP = MW_INSTALL_PATH;
1370 \$IP = dirname( __FILE__ );
1373 \$path = array( \$IP, \"\$IP/includes\", \"\$IP/languages\" );
1374 set_include_path( implode( PATH_SEPARATOR, \$path ) . PATH_SEPARATOR . get_include_path() );
1376 require_once( \"includes/DefaultSettings.php\" );
1378 # If PHP's memory limit is very low, some operations may fail.
1379 " . ($conf->raiseMemory ?
'' : '# ' ) . "ini_set( 'memory_limit', '20M' );" . "
1381 if ( \$wgCommandLineMode ) {
1382 if ( isset( \$_SERVER ) && array_key_exists( 'REQUEST_METHOD', \$_SERVER ) ) {
1383 die( \"This script must be run from the command line\\n\" );
1385 } elseif ( empty( \$wgNoOutputBuffer ) ) {
1386 ## Compress output if the browser supports it
1387 {$zlib}if( !ini_get( 'zlib.output_compression' ) ) @ob_start( 'ob_gzhandler' );
1390 \$wgSitename = \"{$slconf['Sitename']}\";
1392 \$wgScriptPath = \"{$slconf['ScriptPath']}\";
1393 \$wgScript = \"\$wgScriptPath/index.php\";
1394 \$wgRedirectScript = \"\$wgScriptPath/redirect.php\";
1396 ## For more information on customizing the URLs please see:
1397 ## http://meta.wikimedia.org/wiki/Eliminating_index.php_from_the_url
1399 ## 'Pretty' URLs using PATH_INFO work on most configurations with
1400 ## PHP configured as an Apache module.
1401 {$pretty}\$wgArticlePath = \"\$wgScript/\$1\";
1403 ## If using PHP as a CGI module, the ?title= style might have to be used
1404 ## depending on the configuration. If it fails, try enabling the option
1405 ## cgi.fix_pathinfo in php.ini, then switch to pretty URLs.
1406 {$ugly}\$wgArticlePath = \"\$wgScript?title=\$1\";
1408 \$wgStylePath = \"\$wgScriptPath/skins\";
1409 \$wgStyleDirectory = \"\$IP/skins\";
1410 \$wgLogo = \"\$wgStylePath/common/images/wiki.png\";
1412 \$wgUploadPath = \"\$wgScriptPath/images\";
1413 \$wgUploadDirectory = \"\$IP/images\";
1415 \$wgEnableEmail = $enableemail;
1416 \$wgEnableUserEmail = $enableuseremail;
1418 \$wgEmergencyContact = \"{$slconf['EmergencyContact']}\";
1419 \$wgPasswordSender = \"{$slconf['PasswordSender']}\";
1421 ## For a detailed description of the following switches see
1422 ## http://meta.wikimedia.org/Enotif and http://meta.wikimedia.org/Eauthent
1423 ## There are many more options for fine tuning available see
1424 ## /includes/DefaultSettings.php
1425 ## UPO means: this is also a user preference option
1426 \$wgEnotifUserTalk = $enotifusertalk; # UPO
1427 \$wgEnotifWatchlist = $enotifwatchlist; # UPO
1428 \$wgEmailAuthentication = $eauthent;
1430 \$wgDBtype = \"{$slconf['DBtype']}\";
1431 \$wgDBserver = \"{$slconf['DBserver']}\";
1432 \$wgDBname = \"{$slconf['DBname']}\";
1433 \$wgDBuser = \"{$slconf['DBuser']}\";
1434 \$wgDBpassword = \"{$slconf['DBpassword']}\";
1435 \$wgDBport = \"{$slconf['DBport']}\";
1436 \$wgDBprefix = \"{$slconf['DBprefix']}\";
1438 # Schemas for Postgres
1439 \$wgDBmwschema = \"{$slconf['DBmwschema']}\";
1440 \$wgDBts2schema = \"{$slconf['DBts2schema']}\";
1442 # Experimental charset support for MySQL 4.1/5.0.
1443 \$wgDBmysql5 = {$conf->DBmysql5};
1445 ## Shared memory settings
1446 \$wgMainCacheType = $cacheType;
1447 \$wgMemCachedServers = $mcservers;
1449 ## To enable image uploads, make sure the 'images' directory
1450 ## is writable, then set this to true:
1451 \$wgEnableUploads = false;
1452 \$wgUseImageResize = {$conf->UseImageResize};
1453 {$magic}\$wgUseImageMagick = true;
1454 {$magic}\$wgImageMagickConvertCommand = \"{$convert}\";
1456 ## If you want to use image uploads under safe mode,
1457 ## create the directories images/archive, images/thumb and
1458 ## images/temp, and make them all writable. Then uncomment
1459 ## this, if it's not already uncommented:
1460 {$hashedUploads}\$wgHashedUploadDirectory = false;
1462 ## If you have the appropriate support software installed
1463 ## you can enable inline LaTeX equations:
1465 \$wgMathPath = \"{\$wgUploadPath}/math\";
1466 \$wgMathDirectory = \"{\$wgUploadDirectory}/math\";
1467 \$wgTmpDirectory = \"{\$wgUploadDirectory}/tmp\";
1469 \$wgLocalInterwiki = \$wgSitename;
1471 \$wgLanguageCode = \"{$slconf['LanguageCode']}\";
1473 \$wgProxyKey = \"$secretKey\";
1475 ## Default skin: you can change the default skin. Use the internal symbolic
1476 ## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook':
1477 \$wgDefaultSkin = 'monobook';
1479 ## For attaching licensing metadata to pages, and displaying an
1480 ## appropriate copyright notice / icon. GNU Free Documentation
1481 ## License and Creative Commons licenses are supported so far.
1482 {$rights}\$wgEnableCreativeCommonsRdf = true;
1483 \$wgRightsPage = \"\"; # Set to the title of a wiki page that describes your license/copyright
1484 \$wgRightsUrl = \"{$slconf['RightsUrl']}\";
1485 \$wgRightsText = \"{$slconf['RightsText']}\";
1486 \$wgRightsIcon = \"{$slconf['RightsIcon']}\";
1487 # \$wgRightsCode = \"{$slconf['RightsCode']}\"; # Not yet used
1489 \$wgDiff3 = \"{$slconf['diff3']}\";
1491 # When you make changes to this configuration file, this will make
1492 # sure that cached pages are cleared.
1493 \$configdate = gmdate( 'YmdHis', @filemtime( __FILE__ ) );
1494 \$wgCacheEpoch = max( \$wgCacheEpoch, \$configdate );
1495 "; ## End of setting the $localsettings string
1497 // Keep things in Unix line endings internally;
1498 // the system will write out as local text type.
1499 return str_replace( "\r\n", "\n", $localsettings );
1502 function dieout( $text ) {
1503 die( $text . "\n\n</body>\n</html>" );
1506 function importVar( &$var, $name, $default = "" ) {
1507 if( isset( $var[$name] ) ) {
1508 $retval = $var[$name];
1509 if ( get_magic_quotes_gpc() ) {
1510 $retval = stripslashes( $retval );
1518 function importPost( $name, $default = "" ) {
1519 return importVar( $_POST, $name, $default );
1522 function importRequest( $name, $default = "" ) {
1523 return importVar( $_REQUEST, $name, $default );
1528 function aField( &$conf, $field, $text, $type = "text", $value = "", $onclick = '' ) {
1531 $xtype = "type=\"$type\"";
1537 $nolabel = ($type == "radio") ||
($type == "hidden");
1539 if ($type == 'radio')
1540 $id .= $radioCount++
;
1545 echo "\t\t<label class='column' for=\"$id\">$text</label>\n";
1548 if( $type == "radio" && $value == $conf->$field ) {
1549 $checked = "checked='checked'";
1553 echo "\t\t<input $xtype name=\"$field\" id=\"$id\" class=\"iput-$type\" $checked ";
1555 echo " onclick='toggleDBarea(\"$value\",1)' " ;
1558 if( $type == "radio" ) {
1559 echo htmlspecialchars( $value );
1561 echo htmlspecialchars( $conf->$field );
1567 echo " $text</label>\n";
1571 if(isset($errs[$field])) echo "<span class='error'>" . $errs[$field] . "</span>\n";
1574 function getLanguageList() {
1575 global $wgLanguageNames;
1576 if( !isset( $wgLanguageNames ) ) {
1577 require_once( "languages/Names.php" );
1582 $d = opendir( "../languages/messages" );
1583 /* In case we are called from the root directory */
1585 $d = opendir( "languages/messages");
1586 while( false !== ($f = readdir( $d ) ) ) {
1588 if( preg_match( '/Messages([A-Z][a-z_]+)\.php$/', $f, $m ) ) {
1589 $code = str_replace( '_', '-', strtolower( $m[1] ) );
1590 if( isset( $wgLanguageNames[$code] ) ) {
1591 $name = $code . ' - ' . $wgLanguageNames[$code];
1595 $codes[$code] = $name;
1603 #Check for location of an executable
1604 # @param string $loc single location to check
1605 # @param array $names filenames to check for.
1606 # @param mixed $versioninfo array of details to use when checking version, use false for no version checking
1607 function locate_executable($loc, $names, $versioninfo = false) {
1608 if (!is_array($names))
1609 $names = array($names);
1611 foreach ($names as $name) {
1612 $command = "$loc".DIRECTORY_SEPARATOR
."$name";
1613 if (file_exists($command)) {
1617 $file = str_replace('$1', $command, $versioninfo[0]);
1618 if (strstr(`
$file`
, $versioninfo[1]) !== false)
1625 # Test a memcached server
1626 function testMemcachedServer( $server ) {
1627 $hostport = explode(":", $server);
1630 if ( !function_exists( 'fsockopen' ) ) {
1631 $errstr = "Can't connect to memcached, fsockopen() not present";
1633 if ( !$errstr && count( $hostport ) != 2 ) {
1634 $errstr = 'Please specify host and port';
1635 var_dump( $hostport );
1638 list( $host, $port ) = $hostport;
1642 $fp = @fsockopen
( $host, $port, $errno, $fsockerr, 1.0 );
1643 if ( $fp === false ) {
1644 $errstr = "Cannot connect to memcached on $host:$port : $fsockerr";
1648 $command = "version\r\n";
1649 $bytes = fwrite( $fp, $command );
1650 if ( $bytes != strlen( $command ) ) {
1651 $errstr = "Cannot write to memcached socket on $host:$port";
1655 $expected = "VERSION ";
1656 $response = fread( $fp, strlen( $expected ) );
1657 if ( $response != $expected ) {
1658 $errstr = "Didn't get correct memcached response from $host:$port";
1665 echo "<li>Connected to memcached on $host:$port successfully";
1670 function database_picker($conf) {
1673 foreach(array_keys($ourdb) as $db) {
1674 if ($ourdb[$db]['havedriver']) {
1676 aField( $conf, "DBtype", $ourdb[$db]['fullname'], 'radio', $db, 'onclick');
1683 function database_switcher($db) {
1685 $color = $ourdb[$db]['bgcolor'];
1686 $full = $ourdb[$db]['fullname'];
1687 print "<div id='$db' style='display:none; background: $color'>\n";
1688 print "<h3>$full specific options:</h3>\n";
1691 function printListItem( $item ) {
1692 print "<li>$item</li>";
1697 <div
class="license">
1699 <p
>This program is free software
; you can redistribute it
and/or modify
1700 it under the terms of the GNU General
Public License
as published by
1701 the Free Software Foundation
; either version
2 of the License
, or
1702 (at your option
) any later version
.</p
>
1704 <p
>This program is distributed in the hope that it will be useful
,
1705 but WITHOUT ANY WARRANTY
; without even the implied warranty of
1706 MERCHANTABILITY
or FITNESS
FOR A PARTICULAR PURPOSE
. See the
1707 GNU General
Public License
for more details
.</p
>
1709 <p
>You should have received
<a href
="../COPYING">a copy of the GNU General
Public License
</a
>
1710 along with this program
; if not
, write to the Free Software
1711 Foundation
, Inc
., 51 Franklin Street
, Fifth Floor
, Boston
, MA
02110-1301, USA
.
1712 or <a href
="http://www.gnu.org/copyleft/gpl.html">read it online
</a
></p
>
1718 <div id
="column-one">
1719 <div
class="portlet" id
="p-logo">
1720 <a style
="background-image: url(../skins/common/images/mediawiki.png);"
1721 href
="http://www.mediawiki.org/"
1722 title
="Main Page"></a
>
1724 <script type
="text/javascript"> if (window
.isMSIE55
) fixalpha(); </script
>
1725 <div
class='portlet'><div
class='pBody'>
1727 <li
><strong
><a href
="http://www.mediawiki.org/">MediaWiki home
</a
></strong
></li
>
1728 <li
><a href
="../README">Readme
</a
></li
>
1729 <li
><a href
="../RELEASE-NOTES">Release notes
</a
></li
>
1730 <li
><a href
="../docs/">Documentation
</a
></li
>
1731 <li
><a href
="http://meta.wikipedia.org/wiki/MediaWiki_User's_Guide">User
's Guide</a></li>
1732 <li><a href="http://meta.wikimedia.org/wiki/MediaWiki_FAQ">FAQ</a></li>
1734 <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>