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 define( 'MW_NO_OUTPUT_BUFFER
', 1 );
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 print "<li>PHP server API is $sapi; ";
347 if( $wgUsePathInfo ) {
348 print "ok, using pretty URLs (<tt>index.php/Page_Title</tt>)";
350 print "using ugly URLs (<tt>index.php?title=Page_Title</tt>)";
354 $conf->xml
= function_exists( "utf8_encode" );
356 print "<li>Have XML / Latin1-UTF-8 conversion support.</li>\n";
358 dieout( "PHP's XML module is missing; the wiki requires functions in
359 this module and won't work in this configuration.
360 If you're running Mandrake, install the php-xml package." );
363 # Crude check for session support
364 if( !function_exists( 'session_name' ) )
365 dieout( "PHP's session module is missing. MediaWiki requires session support in order to function." );
368 if( !function_exists( 'preg_match' ) )
369 dieout( "The PCRE regular expression functions are missing. MediaWiki requires these in order to function." );
371 $memlimit = ini_get( "memory_limit" );
372 $conf->raiseMemory
= false;
373 if( empty( $memlimit ) ||
$memlimit == -1 ) {
374 print "<li>PHP is configured with no <tt>memory_limit</tt>.</li>\n";
376 print "<li>PHP's <tt>memory_limit</tt> is " . htmlspecialchars( $memlimit ) . ". ";
377 $n = intval( $memlimit );
378 if( preg_match( '/^([0-9]+)[Mm]$/', trim( $memlimit ), $m ) ) {
379 $n = intval( $m[1] * (1024*1024) );
381 if( $n < 20*1024*1024 ) {
382 print "Attempting to raise limit to 20M... ";
383 if( false === ini_set( "memory_limit", "20M" ) ) {
384 print "failed.<br /><b>" . htmlspecialchars( $memlimit ) . " seems too low, installation may fail!</b>";
386 $conf->raiseMemory
= true;
393 $conf->turck
= function_exists( 'mmcache_get' );
394 if ( $conf->turck
) {
395 print "<li><a href=\"http://turck-mmcache.sourceforge.net/\">Turck MMCache</a> installed</li>\n";
398 $conf->apc
= function_exists('apc_fetch');
400 print "<li><a href=\"http://www.php.net/apc\">APC</a> installed</li>";
403 $conf->eaccel
= function_exists( 'eaccelerator_get' );
404 if ( $conf->eaccel
) {
405 $conf->turck
= 'eaccelerator';
406 print "<li><a href=\"http://eaccelerator.sourceforge.net/\">eAccelerator</a> installed</li>\n";
409 if( !$conf->turck
&& !$conf->eaccel
&& !$conf->apc
) {
410 echo( '<li>Couldn\'t find <a href="http://turck-mmcache.sourceforge.net">Turck MMCache</a>,
411 <a href="http://eaccelerator.sourceforge.net">eAccelerator</a>, or
412 <a href="http://www.php.net/apc">APC</a>. Object caching functions cannot be used.</li>' );
415 $conf->diff3
= false;
416 $diff3locations = array_merge(
423 explode( $sep, getenv( "PATH" ) ) );
424 $diff3names = array( "gdiff3", "diff3", "diff3.exe" );
426 $diff3versioninfo = array( '$1 --version 2>&1', 'diff3 (GNU diffutils)' );
427 foreach ($diff3locations as $loc) {
428 $exe = locate_executable($loc, $diff3names, $diff3versioninfo);
429 if ($exe !== false) {
436 print "<li>Found GNU diff3: <tt>$conf->diff3</tt>.</li>";
438 print "<li>GNU diff3 not found.</li>";
440 $conf->ImageMagick
= false;
441 $imcheck = array( "/usr/bin", "/opt/csw/bin", "/usr/local/bin", "/sw/bin", "/opt/local/bin" );
442 foreach( $imcheck as $dir ) {
443 $im = "$dir/convert";
444 if( file_exists( $im ) ) {
445 print "<li>Found ImageMagick: <tt>$im</tt>; image thumbnailing will be enabled if you enable uploads.</li>\n";
446 $conf->ImageMagick
= $im;
451 $conf->HaveGD
= function_exists( "imagejpeg" );
452 if( $conf->HaveGD
) {
453 print "<li>Found GD graphics library built-in";
454 if( !$conf->ImageMagick
) {
455 print ", image thumbnailing will be enabled if you enable uploads";
459 if( !$conf->ImageMagick
) {
460 print "<li>Couldn't find GD library or ImageMagick; image thumbnailing disabled.</li>\n";
464 $conf->UseImageResize
= $conf->HaveGD ||
$conf->ImageMagick
;
466 $conf->IP
= dirname( dirname( __FILE__
) );
467 print "<li>Installation directory: <tt>" . htmlspecialchars( $conf->IP
) . "</tt></li>\n";
470 // PHP_SELF isn't available sometimes, such as when PHP is CGI but
471 // cgi.fix_pathinfo is disabled. In that case, fall back to SCRIPT_NAME
472 // to get the path to the current script... hopefully it's reliable. SIGH
473 $path = ($_SERVER["PHP_SELF"] === '')
474 ?
$_SERVER["SCRIPT_NAME"]
475 : $_SERVER["PHP_SELF"];
476 $conf->ScriptPath
= preg_replace( '{^(.*)/config.*$}', '$1', $path );
477 print "<li>Script URI path: <tt>" . htmlspecialchars( $conf->ScriptPath
) . "</tt></li>\n";
479 print "<li style='font-weight:bold;color:green;font-size:110%'>Environment checked. You can install MediaWiki.</li>\n";
480 $conf->posted
= ($_SERVER["REQUEST_METHOD"] == "POST");
482 $conf->Sitename
= ucfirst( importPost( "Sitename", "" ) );
483 $defaultEmail = empty( $_SERVER["SERVER_ADMIN"] )
485 : $_SERVER["SERVER_ADMIN"];
486 $conf->EmergencyContact
= importPost( "EmergencyContact", $defaultEmail );
487 $conf->DBtype
= importPost( "DBtype", $DefaultDBtype );
491 $conf->DBserver
= importPost( "DBserver", "localhost" );
492 $conf->DBname
= importPost( "DBname", "wikidb" );
493 $conf->DBuser
= importPost( "DBuser", "wikiuser" );
494 $conf->DBpassword
= importPost( "DBpassword" );
495 $conf->DBpassword2
= importPost( "DBpassword2" );
496 $conf->SysopName
= importPost( "SysopName", "WikiSysop" );
497 $conf->SysopPass
= importPost( "SysopPass" );
498 $conf->SysopPass2
= importPost( "SysopPass2" );
499 $conf->RootUser
= importPost( "RootUser", "root" );
500 $conf->RootPW
= importPost( "RootPW", "" );
501 $useRoot = importCheck( 'useroot', false );
504 $conf->DBprefix
= importPost( "DBprefix" );
505 $conf->DBschema
= importPost( "DBschema", "mysql4" );
506 $conf->DBmysql5
= ($conf->DBschema
== "mysql5" ||
507 $conf->DBschema
== "mysql5-binary")
509 $conf->LanguageCode
= importPost( "LanguageCode", "en" );
511 ## Postgres specific:
512 $conf->DBport
= importPost( "DBport", "5432" );
513 $conf->DBmwschema
= importPost( "DBmwschema", "mediawiki" );
514 $conf->DBts2schema
= importPost( "DBts2schema", "public" );
516 /* Check for validity */
519 if( $conf->Sitename
== "" ||
$conf->Sitename
== "MediaWiki" ||
$conf->Sitename
== "Mediawiki" ) {
520 $errs["Sitename"] = "Must not be blank or \"MediaWiki\"";
522 if( $conf->DBuser
== "" ) {
523 $errs["DBuser"] = "Must not be blank";
525 if( $conf->DBpassword
== "" && $conf->DBtype
!= "postgres" ) {
526 $errs["DBpassword"] = "Must not be blank";
528 if( $conf->DBpassword
!= $conf->DBpassword2
) {
529 $errs["DBpassword2"] = "Passwords don't match!";
531 if( !preg_match( '/^[A-Za-z_0-9]*$/', $conf->DBprefix
) ) {
532 $errs["DBprefix"] = "Invalid table prefix";
535 if( $conf->SysopPass
== "" ) {
536 $errs["SysopPass"] = "Must not be blank";
538 if( $conf->SysopPass
!= $conf->SysopPass2
) {
539 $errs["SysopPass2"] = "Passwords don't match!";
542 $conf->License
= importRequest( "License", "none" );
543 if( $conf->License
== "gfdl" ) {
544 $conf->RightsUrl
= "http://www.gnu.org/copyleft/fdl.html";
545 $conf->RightsText
= "GNU Free Documentation License 1.2";
546 $conf->RightsCode
= "gfdl";
547 $conf->RightsIcon
= '${wgScriptPath}/skins/common/images/gnu-fdl.png';
548 } elseif( $conf->License
== "none" ) {
549 $conf->RightsUrl
= $conf->RightsText
= $conf->RightsCode
= $conf->RightsIcon
= "";
551 $conf->RightsUrl
= importRequest( "RightsUrl", "" );
552 $conf->RightsText
= importRequest( "RightsText", "" );
553 $conf->RightsCode
= importRequest( "RightsCode", "" );
554 $conf->RightsIcon
= importRequest( "RightsIcon", "" );
557 $conf->Shm
= importRequest( "Shm", "none" );
558 $conf->MCServers
= importRequest( "MCServers" );
560 /* Test memcached servers */
562 if ( $conf->Shm
== 'memcached' && $conf->MCServers
) {
563 $conf->MCServerArray
= array_map( 'trim', explode( ',', $conf->MCServers
) );
564 foreach ( $conf->MCServerArray
as $server ) {
565 $error = testMemcachedServer( $server );
567 $errs["MCServers"] = $error;
571 } else if ( $conf->Shm
== 'memcached' ) {
572 $errs["MCServers"] = "Please specify at least one server if you wish to use memcached";
575 /* default values for installation */
576 $conf->Email
= importRequest("Email", "email_enabled");
577 $conf->Emailuser
= importRequest("Emailuser", "emailuser_enabled");
578 $conf->Enotif
= importRequest("Enotif", "enotif_allpages");
579 $conf->Eauthent
= importRequest("Eauthent", "eauthent_enabled");
581 if( $conf->posted
&& ( 0 == count( $errs ) ) ) {
582 do { /* So we can 'continue' to end prematurely */
583 $conf->Root
= ($conf->RootPW
!= "");
585 /* Load up the settings and get installin' */
586 $local = writeLocalSettings( $conf );
587 echo "<li style=\"list-style: none\">\n";
588 echo "<p><b>Generating configuration file...</b></p>\n";
591 $wgCommandLineMode = false;
593 $ok = eval( $local );
594 if( $ok === false ) {
595 dieout( "Errors in generated configuration; " .
596 "most likely due to a bug in the installer... " .
597 "Config file was: " .
599 htmlspecialchars( $local ) .
603 $conf->DBtypename
= '';
604 foreach (array_keys($ourdb) as $db) {
605 if ($conf->DBtype
=== $db)
606 $conf->DBtypename
= $ourdb[$db]['fullname'];
608 if ( ! strlen($conf->DBtype
)) {
609 $errs["DBpicktype"] = "Please choose a database type";
613 if (! $conf->DBtypename
) {
614 $errs["DBtype"] = "Unknown database type '$conf->DBtype'";
617 print "<li>Database type: {$conf->DBtypename}</li>\n";
618 $dbclass = 'Database'.ucfirst($conf->DBtype
);
619 $wgDBtype = $conf->DBtype
;
620 $wgDBadminuser = "root";
621 $wgDBadminpassword = $conf->RootPW
;
624 $wgDBprefix = $conf->DBprefix
;
626 ## Postgres specific:
627 $wgDBport = $conf->DBport
;
628 $wgDBmwschema = $conf->DBmwschema
;
629 $wgDBts2schema = $conf->DBts2schema
;
631 $wgCommandLineMode = true;
632 $wgUseDatabaseMessages = false; /* FIXME: For database failure */
633 require_once( "includes/Setup.php" );
636 $wgTitle = Title
::newFromText( "Installation script" );
637 error_reporting( E_ALL
);
638 print "<li>Loading class: $dbclass";
641 if( $conf->DBtype
== 'mysql' ) {
642 $mysqlOldClient = version_compare( mysql_get_client_info(), "4.1.0", "lt" );
643 if( $mysqlOldClient ) {
644 print "<li><b>PHP is linked with old MySQL client libraries. If you are
645 using a MySQL 4.1 server and have problems connecting to the database,
646 see <a href='http://dev.mysql.com/doc/mysql/en/old-client.html'
647 >http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b></li>\n";
649 $ok = true; # Let's be optimistic
651 # Decide if we're going to use the superuser or the regular database user
652 $conf->Root
= $useRoot;
654 $db_user = $conf->RootUser
;
655 $db_pass = $conf->RootPW
;
657 $db_user = $wgDBuser;
658 $db_pass = $wgDBpassword;
662 echo( "<li>Attempting to connect to database server as $db_user..." );
663 $wgDatabase = Database
::newFromParams( $wgDBserver, $db_user, $db_pass, '', 1 );
665 # Check the connection and respond to errors
666 if( $wgDatabase->isOpen() ) {
669 $wgDBadminuser = $db_user;
670 $wgDBadminpassword = $db_pass;
671 echo( "success.</li>\n" );
672 $wgDatabase->ignoreErrors( true );
673 $myver = $wgDatabase->getServerVersion();
675 # There were errors, report them and back out
677 $errno = mysql_errno();
678 $errtx = htmlspecialchars( mysql_error() );
682 echo( "failed due to authentication errors. Check passwords.</li>" );
684 # The superuser details are wrong
685 $errs["RootUser"] = "Check username";
686 $errs["RootPW"] = "and password";
688 # The regular user details are wrong
689 $errs["DBuser"] = "Check username";
690 $errs["DBpassword"] = "and password";
696 # General connection problem
697 echo( "failed with error [$errno] $errtx.</li>\n" );
698 $errs["DBserver"] = "Connection failed";
703 if( !$ok ) { continue; }
705 } else /* not mysql */ {
706 error_reporting( E_ALL
);
708 ## Possible connect as a superuser
710 $wgDBsuperuser = $conf->RootUser
;
711 echo( "<li>Attempting to connect to database \"postgres\" as superuser \"$wgDBsuperuser\"..." );
712 $wgDatabase = $dbc->newFromParams($wgDBserver, $wgDBsuperuser, $conf->RootPW
, "postgres", 1);
713 if (!$wgDatabase->isOpen()) {
714 print " error: " . $wgDatabase->lastError() . "</li>\n";
715 $errs["DBserver"] = "Could not connect to database as superuser";
716 $errs["RootUser"] = "Check username";
717 $errs["RootPW"] = "and password";
721 echo( "<li>Attempting to connect to database \"$wgDBname\" as \"$wgDBuser\"..." );
722 $wgDatabase = $dbc->newFromParams($wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1);
723 if (!$wgDatabase->isOpen()) {
724 print " error: " . $wgDatabase->lastError() . "</li>\n";
726 $myver = $wgDatabase->getServerVersion();
730 if ( !$wgDatabase->isOpen() ) {
731 $errs["DBserver"] = "Couldn't connect to database";
735 print "<li>Connected to $myver";
736 if ($conf->DBtype
== 'mysql') {
737 if( version_compare( $myver, "4.0.14" ) < 0 ) {
738 dieout( " -- mysql 4.0.14 or later required. Aborting." );
740 $mysqlNewAuth = version_compare( $myver, "4.1.0", "ge" );
741 if( $mysqlNewAuth && $mysqlOldClient ) {
742 print "; <b class='error'>You are using MySQL 4.1 server, but PHP is linked
743 to old client libraries; if you have trouble with authentication, see
744 <a href='http://dev.mysql.com/doc/mysql/en/old-client.html'
745 >http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b>";
748 if( $mysqlNewAuth ) {
749 print "; enabling MySQL 4.1/5.0 charset mode";
751 print "; <b class='error'>MySQL 4.1/5.0 charset mode enabled,
752 but older version detected; will likely fail.</b>";
757 @$sel = $wgDatabase->selectDB( $wgDBname );
759 print "<li>Database <tt>" . htmlspecialchars( $wgDBname ) . "</tt> exists</li>\n";
761 $err = mysql_errno();
762 $databaseSafe = htmlspecialchars( $wgDBname );
763 if( $err == 1102 /* Invalid database name */ ) {
764 print "<ul><li><strong>{$databaseSafe}</strong> is not a valid database name.</li></ul>";
766 } elseif( $err != 1049 /* Database doesn't exist */ ) {
767 print "<ul><li>Error selecting database <strong>{$databaseSafe}</strong>: {$err} ";
768 print htmlspecialchars( mysql_error() ) . "</li></ul>";
771 print "<li>Attempting to create database...</li>";
772 $res = $wgDatabase->query( "CREATE DATABASE `$wgDBname`" );
774 print "<li>Couldn't create database <tt>" .
775 htmlspecialchars( $wgDBname ) .
776 "</tt>; try with root access or check your username/pass.</li>\n";
777 $errs["RootPW"] = "<- Enter";
780 print "<li>Created database <tt>" . htmlspecialchars( $wgDBname ) . "</tt></li>\n";
782 $wgDatabase->selectDB( $wgDBname );
784 else if ($conf->DBtype
== 'postgres') {
785 if( version_compare( $myver, "PostgreSQL 8.0" ) < 0 ) {
786 dieout( " <b>Postgres 8.0 or later is required</b>. Aborting.</li></ul>" );
790 if( $wgDatabase->tableExists( "cur" ) ||
$wgDatabase->tableExists( "revision" ) ) {
791 print "<li>There are already MediaWiki tables in this database. Checking if updates are needed...</li>\n";
793 # Create user if required (todo: other databases)
794 if ( $conf->Root
&& $conf->DBtype
== 'mysql') {
795 $conn = $dbc->newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1 );
796 if ( $conn->isOpen() ) {
797 print "<li>DB user account ok</li>\n";
800 print "<li>Granting user permissions...";
801 if( $mysqlOldClient && $mysqlNewAuth ) {
802 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>";
805 dbsource( "../maintenance/users.sql", $wgDatabase );
814 print "<li>Finished update checks.</li>\n";
816 # FIXME: Check for errors
817 print "<li>Creating tables...";
818 if ($conf->DBtype
== 'mysql') {
819 switch( $conf->DBschema
) {
821 print " using MySQL 4 table defs...";
822 dbsource( "../maintenance/tables.sql", $wgDatabase );
825 print " using MySQL 5 UTF-8 table defs...";
826 dbsource( "../maintenance/mysql5/tables.sql", $wgDatabase );
828 case "mysql5-binary":
829 print " using MySQL 5 binary table defs...";
830 dbsource( "../maintenance/mysql5/tables-binary.sql", $wgDatabase );
833 dieout( " <b>invalid schema selection!</b></li>" );
835 dbsource( "../maintenance/interwiki.sql", $wgDatabase );
836 } else if ($conf->DBtype
== 'postgres') {
837 $wgDatabase->setup_database();
840 $errs["DBtype"] = "Do not know how to handle database type '$conf->DBtype'";
844 print " done.</li>\n";
846 print "<li>Initializing data...</li>\n";
847 $wgDatabase->insert( 'site_stats',
848 array ( 'ss_row_id' => 1,
849 'ss_total_views' => 0,
850 'ss_total_edits' => 0,
851 'ss_good_articles' => 0 ) );
853 # Set up the "regular user" account *if we can, and if we need to*
854 if( $conf->Root
and $conf->DBtype
== 'mysql') {
856 $wgDatabase2 = $dbc->newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1 );
857 if( $wgDatabase2->isOpen() ) {
858 # Nope, just close the test connection and continue
859 $wgDatabase2->close();
860 echo( "<li>User $wgDBuser exists. Skipping grants.</li>\n" );
862 # Yes, so run the grants
863 echo( "<li>Granting user permissions to $wgDBuser on $wgDBname..." );
864 dbsource( "../maintenance/users.sql", $wgDatabase );
865 echo( "success.</li>\n" );
869 if( $conf->SysopName
) {
870 $u = User
::newFromName( $conf->getSysopName() );
872 print "<li><strong class=\"error\">Warning:</strong> Skipped sysop account creation - invalid username!</li>\n";
874 else if ( 0 == $u->idForName() ) {
876 $u->setPassword( $conf->getSysopPass() );
879 $u->addGroup( "sysop" );
880 $u->addGroup( "bureaucrat" );
882 print "<li>Created sysop account <tt>" .
883 htmlspecialchars( $conf->SysopName
) . "</tt>.</li>\n";
885 print "<li>Could not create user - already exists!</li>\n";
888 print "<li>Skipped sysop account creation, no name given.</li>\n";
891 $titleobj = Title
::newFromText( wfMsgNoDB( "mainpage" ) );
892 $article = new Article( $titleobj );
893 $newid = $article->insertOn( $wgDatabase );
894 $revision = new Revision( array(
896 'text' => wfMsg( 'mainpagetext' ) . "\n\n" . wfMsgNoTrans( 'mainpagedocfooter' ),
899 'user_text' => 'MediaWiki default',
901 $revid = $revision->insertOn( $wgDatabase );
902 $article->updateRevisionOn( $wgDatabase, $revision );
905 /* Write out the config file now that all is well */
906 print "<li style=\"list-style: none\">\n";
907 print "<p>Creating LocalSettings.php...</p>\n\n";
908 $localSettings = "<" . "?php$endl$local$endl\r\n";
909 // Fix up a common line-ending problem (due to CVS on Windows)
910 $localSettings = str_replace( "\r\n", "\n", $localSettings );
911 $f = fopen( "LocalSettings.php", 'xt' );
914 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" .
915 "<p>Here's the file that would have been written, try to paste it into place manually:</p>\n" .
916 "<pre>\n" . htmlspecialchars( $localSettings ) . "</pre>\n" );
918 if(fwrite( $f, $localSettings ) ) {
920 writeSuccessMessage();
923 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");
936 if( count( $errs ) ) {
937 /* Display options form */
939 if( $conf->posted
) {
940 echo "<p class='error-top'>Something's not quite right yet; make sure everything below is filled out correctly.</p>\n";
944 <form action
="index.php" name
="config" method
="post">
949 <div
class="config-section">
950 <div
class="config-input">
952 aField( $conf, "Sitename", "Wiki name:" );
955 <p
class="config-desc">
956 Preferably a short word without punctuation
, i
.e
. "Wikipedia".<br
/>
957 Will appear
as the
namespace name
for "meta" pages
, and throughout the
interface.
960 <div
class="config-input">
962 aField( $conf, "EmergencyContact", "Contact e-mail:" );
965 <p
class="config-desc">
966 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
.
969 <div
class="config-input">
970 <label
class='column' for="LanguageCode">Language
:</label
>
971 <select id
="LanguageCode" name
="LanguageCode">
974 $list = getLanguageList();
975 foreach( $list as $code => $name ) {
976 $sel = ($code == $conf->LanguageCode
) ?
'selected="selected"' : '';
977 echo "\t\t<option value=\"$code\" $sel>$name</option>\n";
982 <p
class="config-desc">
983 Select the language
for your wiki
's interface. Some localizations aren't fully complete
. Unicode (UTF
-8) is used
for all localizations
.
986 <div
class="config-input">
987 <label
class='column'>Copyright
/license
:</label
>
990 <li
><?php
aField( $conf, "License", "No license metadata", "radio", "none" ); ?
></li
>
991 <li
><?php
aField( $conf, "License", "GNU Free Documentation License 1.2 (Wikipedia-compatible)", "radio", "gfdl" ); ?
></li
>
993 aField( $conf, "License", "A Creative Commons license - ", "radio", "cc" );
994 $partner = "MediaWiki";
995 $exit = urlencode( "$wgServer{$conf->ScriptPath}/config/index.php?License=cc&RightsUrl=[license_url]&RightsText=[license_name]&RightsCode=[license_code]&RightsIcon=[license_button]" );
996 $icon = urlencode( "$wgServer$wgUploadPath/wiki.png" );
997 $ccApp = htmlspecialchars( "http://creativecommons.org/license/?partner=$partner&exit_url=$exit&partner_icon_url=$icon" );
998 print "<a href=\"$ccApp\" target='_blank'>choose</a>";
1000 <?php
if( $conf->License
== "cc" ) { ?
>
1002 <li
><?php
aField( $conf, "RightsIcon", "<img src=\"" . htmlspecialchars( $conf->RightsIcon
) . "\" alt='(Creative Commons icon)' />", "hidden" ); ?
></li
>
1003 <li
><?php
aField( $conf, "RightsText", htmlspecialchars( $conf->RightsText
), "hidden" ); ?
></li
>
1004 <li
><?php
aField( $conf, "RightsCode", "code: " . htmlspecialchars( $conf->RightsCode
), "hidden" ); ?
></li
>
1005 <li
><?php
aField( $conf, "RightsUrl", "<a href=\"" . htmlspecialchars( $conf->RightsUrl
) . "\">" . htmlspecialchars( $conf->RightsUrl
) . "</a>", "hidden" ); ?
></li
>
1011 <p
class="config-desc">
1012 A notice
, icon
, and machine
-readable copyright metadata will be displayed
for the license you pick
.
1016 <div
class="config-input">
1017 <?php
aField( $conf, "SysopName", "Admin username:" ) ?
>
1019 <div
class="config-input">
1020 <?php
aField( $conf, "SysopPass", "Password:", "password" ) ?
>
1022 <div
class="config-input">
1023 <?php
aField( $conf, "SysopPass2", "Password confirm:", "password" ) ?
>
1025 <p
class="config-desc">
1026 An admin can lock
/delete pages
, block users from editing
, and do other maintenance tasks
.<br
/>
1027 A
new account will be added only when creating a
new wiki database
.
1030 <div
class="config-input">
1031 <label
class='column'>Shared memory caching
:</label
>
1034 <li
><?php
aField( $conf, "Shm", "No caching", "radio", "none" ); ?
></li
>
1036 if ( $conf->turck
) {
1038 aField( $conf, "Shm", "Turck MMCache", "radio", "turck" );
1043 aField( $conf, "Shm", "APC", "radio", "apc" );
1046 if ( $conf->eaccel
) {
1048 aField( $conf, "Shm", "eAccelerator", "radio", "eaccel" );
1052 <li
><?php
aField( $conf, "Shm", "Memcached", "radio", "memcached" ); ?
></li
>
1054 <div style
="clear:left"><?php
aField( $conf, "MCServers", "Memcached servers:", "text" ) ?
></div
>
1056 <p
class="config-desc">
1057 Using a shared memory system such
as Turck MMCache
, APC
, eAccelerator
, or Memcached
1058 will speed up MediaWiki significantly
. Memcached is the best solution but needs to be
1059 installed
. Specify the server addresses
and ports in a comma
-separated
list. Only
1060 use Turck shared memory
if the wiki will be running on a single Apache server
.
1064 <h2
>E
-mail
, e
-mail notification
and authentication setup
</h2
>
1066 <div
class="config-section">
1067 <div
class="config-input">
1068 <label
class='column'>E
-mail
features (global):</label
>
1070 <li
><?php
aField( $conf, "Email", "Enabled", "radio", "email_enabled" ); ?
></li
>
1071 <li
><?php
aField( $conf, "Email", "Disabled", "radio", "email_disabled" ); ?
></li
>
1074 <p
class="config-desc">
1075 Use this to disable all e
-mail
functions (password reminders
, user
-to
-user e
-mail
, and e
-mail notifications
)
1076 if sending mail doesn
't work on your server.
1079 <div class="config-input">
1080 <label class='column
'>User-to-user e-mail:</label>
1082 <li><?php aField( $conf, "Emailuser", "Enabled", "radio", "emailuser_enabled" ); ?></li>
1083 <li><?php aField( $conf, "Emailuser", "Disabled", "radio", "emailuser_disabled" ); ?></li>
1086 <p class="config-desc">
1087 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.
1089 <div class="config-input">
1090 <label class='column
'>E-mail notification about changes:</label>
1092 <li><?php aField( $conf, "Enotif", "Disabled", "radio", "enotif_disabled" ); ?></li>
1093 <li><?php aField( $conf, "Enotif", "Enabled for changes to user discussion pages only", "radio", "enotif_usertalk" ); ?></li>
1094 <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>
1097 <div class="config-desc">
1099 For this feature to work, an e-mail address must be present for the user account, and the notification
1100 options in the user's preferences must be enabled
. Also note the
1101 authentication option below
. When testing the feature
, keep in mind that your own changes will never trigger notifications to be sent to yourself
.</p
>
1103 <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
>
1106 <div
class="config-input">
1107 <label
class='column'>E
-mail address authentication
:</label
>
1109 <li
><?php
aField( $conf, "Eauthent", "Disabled", "radio", "eauthent_disabled" ); ?
></li
>
1110 <li
><?php
aField( $conf, "Eauthent", "Enabled", "radio", "eauthent_enabled" ); ?
></li
>
1113 <div
class="config-desc">
1114 <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
1115 change notification mails
. Setting this option is
<B
>recommended
</B
> for public wikis because of potential abuse of the e
-mail features above
.</p
>
1120 <h2
>Database config
</h2
>
1122 <div
class="config-section">
1123 <div
class="config-input">
1124 <label
class='column'>Database type
:</label
>
1125 <?php
if (isset($errs['DBpicktype'])) print "<span class='error'>$errs[DBpicktype]</span>\n"; ?
>
1126 <ul
class='plain'><?php
database_picker($conf) ?
></ul
>
1129 <div
class="config-input" style
="clear:left"><?php
1130 aField( $conf, "DBserver", "Database host:" );
1132 <p
class="config-desc">
1133 If your database server isn
't on your web server, enter the name or IP address here.
1136 <div class="config-input"><?php
1137 aField( $conf, "DBname", "Database name:" );
1139 <div class="config-input"><?php
1140 aField( $conf, "DBuser", "DB username:" );
1142 <div class="config-input"><?php
1143 aField( $conf, "DBpassword", "DB password:", "password" );
1145 <div class="config-input"><?php
1146 aField( $conf, "DBpassword2", "DB password confirm:", "password" );
1148 <p class="config-desc">
1149 If you only have a single user account and database available,
1150 enter those here. If you have database root access (see below)
1151 you can specify new accounts/databases to be created. This account
1152 will not be created if it pre-exists. If this is the case, ensure that it
1153 has SELECT, INSERT, UPDATE, and DELETE permissions on the MediaWiki database.
1156 <div class="config-input">
1157 <label class="column">Superuser account:</label>
1158 <input type="checkbox" name="useroot" id="useroot" <?php if( $useRoot ) { ?>checked="checked" <?php } ?>/>
1159 <label for="useroot">Use superuser account</label>
1161 <div class="config-input">
1163 aField( $conf, "RootUser", "Superuser name:", "superuser" );
1166 <div class="config-input">
1168 aField( $conf, "RootPW", "Superuser password:", "password" );
1172 <p class="config-desc">
1173 If the database user specified above does not exist, or does not have access to create
1174 the database (if needed) or tables within it, please check the box and provide details
1175 of a superuser account, such as <strong>root</strong>, which does.
1178 <?php database_switcher('mysql
'); ?>
1179 <div class="config-input"><?php
1180 aField( $conf, "DBprefix", "Database table prefix:" );
1182 <div class="config-desc">
1183 <p>If you need to share one database between multiple wikis, or
1184 between MediaWiki and another web application, you may choose to
1185 add a prefix to all the table names to avoid conflicts.</p>
1187 <p>Avoid exotic characters; something like <tt>mw_</tt> is good.</p>
1190 <div class="config-input"><label class="column">Database charset</label>
1191 <div>Select one:</div>
1193 <li><?php aField( $conf, "DBschema", "Backwards-compatible UTF-8", "radio", "mysql4" ); ?></li>
1194 <li><?php aField( $conf, "DBschema", "Experimental MySQL 4.1/5.0 UTF-8", "radio", "mysql5" ); ?></li>
1195 <li><?php aField( $conf, "DBschema", "Experimental MySQL 4.1/5.0 binary", "radio", "mysql5-binary" ); ?></li>
1198 <p class="config-desc">
1199 <b>EXPERIMENTAL:</b> You can enable explicit Unicode charset support
1200 for MySQL 4.1 and 5.0 servers. This is not well tested and may
1201 cause things to break. <b>If upgrading an older installation, leave
1202 in backwards-compatible mode.</b>
1206 <?php database_switcher('postgres
'); ?>
1207 <div class="config-input"><?php
1208 aField( $conf, "DBport", "Database port:" );
1210 <div class="config-input"><?php
1211 aField( $conf, "DBmwschema", "Schema for mediawiki:" );
1213 <div class="config-input"><?php
1214 aField( $conf, "DBts2schema", "Schema for tsearch2:" );
1216 <div class="config-desc">
1217 <p>The username specified above (at "DB username") will have its search path set to the above schemas,
1218 so it is recommended that you create a new user. The above schemas are generally correct:
1219 only change them if you are sure you need to.</p>
1223 <div class="config-input" style="padding:2em 0 3em">
1224 <label class='column
'> </label>
1225 <input type="submit" value="Install MediaWiki!" class="btn-install" />
1230 <script type="text/javascript">
1231 window.onload = toggleDBarea('<?php
echo $conf->DBtype
; ?
>',
1233 ## If they passed in a root user name, don't populate it on page load
1234 echo strlen(importPost('RootUser', '')) ?
0 : 1;
1243 /* -------------------------------------------------------------------------------------- */
1244 function writeSuccessMessage() {
1245 if ( ini_get( 'safe_mode' ) && !ini_get( 'open_basedir' ) ) {
1247 <p>Installation successful!</p>
1248 <p>To complete the installation, please do the following:
1250 <li>Download config/LocalSettings.php with your FTP client or file manager</li>
1251 <li>Upload it to the parent directory</li>
1252 <li>Delete config/LocalSettings.php</li>
1253 <li>Start using <a href='../index.php'>your wiki</a>!
1255 <p>If you are in a shared hosting environment, do <strong>not</strong> just move LocalSettings.php
1256 remotely. LocalSettings.php is currently owned by the user your webserver is running under,
1257 which means that anyone on the same server can read your database password! Downloading
1258 it and uploading it again will hopefully change the ownership to a user ID specific to you.</p>
1261 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
1262 <strong><a href='../index.php'>this link</a></strong> to your wiki.</p>\n";
1267 function escapePhpString( $string ) {
1268 return strtr( $string,
1279 function writeLocalSettings( $conf ) {
1280 $conf->UseImageResize
= $conf->UseImageResize ?
'true' : 'false';
1281 $conf->PasswordSender
= $conf->EmergencyContact
;
1282 $magic = ($conf->ImageMagick ?
"" : "# ");
1283 $convert = ($conf->ImageMagick ?
$conf->ImageMagick
: "/usr/bin/convert" );
1284 $rights = ($conf->RightsUrl
) ?
"" : "# ";
1285 $hashedUploads = $conf->safeMode ?
'' : '# ';
1287 switch ( $conf->Shm
) {
1289 $cacheType = 'CACHE_MEMCACHED';
1290 $mcservers = var_export( $conf->MCServerArray
, true );
1295 $cacheType = 'CACHE_ACCEL';
1296 $mcservers = 'array()';
1299 $cacheType = 'CACHE_NONE';
1300 $mcservers = 'array()';
1303 if ( $conf->Email
== 'email_enabled' ) {
1304 $enableemail = 'true';
1305 $enableuseremail = ( $conf->Emailuser
== 'emailuser_enabled' ) ?
'true' : 'false' ;
1306 $eauthent = ( $conf->Eauthent
== 'eauthent_enabled' ) ?
'true' : 'false' ;
1307 switch ( $conf->Enotif
) {
1308 case 'enotif_usertalk':
1309 $enotifusertalk = 'true';
1310 $enotifwatchlist = 'false';
1312 case 'enotif_allpages':
1313 $enotifusertalk = 'true';
1314 $enotifwatchlist = 'true';
1317 $enotifusertalk = 'false';
1318 $enotifwatchlist = 'false';
1321 $enableuseremail = 'false';
1322 $enableemail = 'false';
1323 $eauthent = 'false';
1324 $enotifusertalk = 'false';
1325 $enotifwatchlist = 'false';
1328 $file = @fopen
( "/dev/urandom", "r" );
1330 $secretKey = bin2hex( fread( $file, 32 ) );
1334 for ( $i=0; $i<8; $i++
) {
1335 $secretKey .= dechex(mt_rand(0, 0x7fffffff));
1337 print "<li>Warning: \$wgSecretKey key is insecure, generated with mt_rand(). Consider changing it manually.</li>\n";
1340 # Add slashes to strings for double quoting
1341 $slconf = array_map( "escapePhpString", get_object_vars( $conf ) );
1342 if( $conf->License
== 'gfdl' ) {
1343 # Needs literal string interpolation for the current style path
1344 $slconf['RightsIcon'] = $conf->RightsIcon
;
1348 # This file was automatically generated by the MediaWiki installer.
1349 # If you make manual changes, please keep track in case you need to
1350 # recreate them later.
1352 # See includes/DefaultSettings.php for all configurable settings
1353 # and their default values, but don't forget to make changes in _this_
1356 # If you customize your file layout, set \$IP to the directory that contains
1357 # the other MediaWiki files. It will be used as a base to locate files.
1358 if( defined( 'MW_INSTALL_PATH' ) ) {
1359 \$IP = MW_INSTALL_PATH;
1361 \$IP = dirname( __FILE__ );
1364 \$path = array( \$IP, \"\$IP/includes\", \"\$IP/languages\" );
1365 set_include_path( implode( PATH_SEPARATOR, \$path ) . PATH_SEPARATOR . get_include_path() );
1367 require_once( \"includes/DefaultSettings.php\" );
1369 # If PHP's memory limit is very low, some operations may fail.
1370 " . ($conf->raiseMemory ?
'' : '# ' ) . "ini_set( 'memory_limit', '20M' );" . "
1372 if ( \$wgCommandLineMode ) {
1373 if ( isset( \$_SERVER ) && array_key_exists( 'REQUEST_METHOD', \$_SERVER ) ) {
1374 die( \"This script must be run from the command line\\n\" );
1377 ## Uncomment this to disable output compression
1378 # \$wgDisableOutputCompression = true;
1380 \$wgSitename = \"{$slconf['Sitename']}\";
1382 ## The URL base path to the directory containing the wiki;
1383 ## defaults for all runtime URL paths are based off of this.
1384 \$wgScriptPath = \"{$slconf['ScriptPath']}\";
1386 ## For more information on customizing the URLs please see:
1387 ## http://www.mediawiki.org/wiki/Manual:Short_URL
1389 \$wgEnableEmail = $enableemail;
1390 \$wgEnableUserEmail = $enableuseremail;
1392 \$wgEmergencyContact = \"{$slconf['EmergencyContact']}\";
1393 \$wgPasswordSender = \"{$slconf['PasswordSender']}\";
1395 ## For a detailed description of the following switches see
1396 ## http://meta.wikimedia.org/Enotif and http://meta.wikimedia.org/Eauthent
1397 ## There are many more options for fine tuning available see
1398 ## /includes/DefaultSettings.php
1399 ## UPO means: this is also a user preference option
1400 \$wgEnotifUserTalk = $enotifusertalk; # UPO
1401 \$wgEnotifWatchlist = $enotifwatchlist; # UPO
1402 \$wgEmailAuthentication = $eauthent;
1404 \$wgDBtype = \"{$slconf['DBtype']}\";
1405 \$wgDBserver = \"{$slconf['DBserver']}\";
1406 \$wgDBname = \"{$slconf['DBname']}\";
1407 \$wgDBuser = \"{$slconf['DBuser']}\";
1408 \$wgDBpassword = \"{$slconf['DBpassword']}\";
1409 \$wgDBport = \"{$slconf['DBport']}\";
1410 \$wgDBprefix = \"{$slconf['DBprefix']}\";
1412 # Schemas for Postgres
1413 \$wgDBmwschema = \"{$slconf['DBmwschema']}\";
1414 \$wgDBts2schema = \"{$slconf['DBts2schema']}\";
1416 # Experimental charset support for MySQL 4.1/5.0.
1417 \$wgDBmysql5 = {$conf->DBmysql5};
1419 ## Shared memory settings
1420 \$wgMainCacheType = $cacheType;
1421 \$wgMemCachedServers = $mcservers;
1423 ## To enable image uploads, make sure the 'images' directory
1424 ## is writable, then set this to true:
1425 \$wgEnableUploads = false;
1426 \$wgUseImageResize = {$conf->UseImageResize};
1427 {$magic}\$wgUseImageMagick = true;
1428 {$magic}\$wgImageMagickConvertCommand = \"{$convert}\";
1430 ## If you want to use image uploads under safe mode,
1431 ## create the directories images/archive, images/thumb and
1432 ## images/temp, and make them all writable. Then uncomment
1433 ## this, if it's not already uncommented:
1434 {$hashedUploads}\$wgHashedUploadDirectory = false;
1436 ## If you have the appropriate support software installed
1437 ## you can enable inline LaTeX equations:
1440 \$wgLocalInterwiki = \$wgSitename;
1442 \$wgLanguageCode = \"{$slconf['LanguageCode']}\";
1444 \$wgProxyKey = \"$secretKey\";
1446 ## Default skin: you can change the default skin. Use the internal symbolic
1447 ## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook':
1448 \$wgDefaultSkin = 'monobook';
1450 ## For attaching licensing metadata to pages, and displaying an
1451 ## appropriate copyright notice / icon. GNU Free Documentation
1452 ## License and Creative Commons licenses are supported so far.
1453 {$rights}\$wgEnableCreativeCommonsRdf = true;
1454 \$wgRightsPage = \"\"; # Set to the title of a wiki page that describes your license/copyright
1455 \$wgRightsUrl = \"{$slconf['RightsUrl']}\";
1456 \$wgRightsText = \"{$slconf['RightsText']}\";
1457 \$wgRightsIcon = \"{$slconf['RightsIcon']}\";
1458 # \$wgRightsCode = \"{$slconf['RightsCode']}\"; # Not yet used
1460 \$wgDiff3 = \"{$slconf['diff3']}\";
1462 # When you make changes to this configuration file, this will make
1463 # sure that cached pages are cleared.
1464 \$configdate = gmdate( 'YmdHis', @filemtime( __FILE__ ) );
1465 \$wgCacheEpoch = max( \$wgCacheEpoch, \$configdate );
1466 "; ## End of setting the $localsettings string
1468 // Keep things in Unix line endings internally;
1469 // the system will write out as local text type.
1470 return str_replace( "\r\n", "\n", $localsettings );
1473 function dieout( $text ) {
1474 die( $text . "\n\n</body>\n</html>" );
1477 function importVar( &$var, $name, $default = "" ) {
1478 if( isset( $var[$name] ) ) {
1479 $retval = $var[$name];
1480 if ( get_magic_quotes_gpc() ) {
1481 $retval = stripslashes( $retval );
1489 function importPost( $name, $default = "" ) {
1490 return importVar( $_POST, $name, $default );
1493 function importCheck( $name ) {
1494 return isset( $_POST[$name] );
1497 function importRequest( $name, $default = "" ) {
1498 return importVar( $_REQUEST, $name, $default );
1503 function aField( &$conf, $field, $text, $type = "text", $value = "", $onclick = '' ) {
1506 $xtype = "type=\"$type\"";
1512 $nolabel = ($type == "radio") ||
($type == "hidden");
1514 if ($type == 'radio')
1515 $id .= $radioCount++
;
1520 echo "\t\t<label class='column' for=\"$id\">$text</label>\n";
1523 if( $type == "radio" && $value == $conf->$field ) {
1524 $checked = "checked='checked'";
1528 echo "\t\t<input $xtype name=\"$field\" id=\"$id\" class=\"iput-$type\" $checked ";
1530 echo " onclick='toggleDBarea(\"$value\",1)' " ;
1533 if( $type == "radio" ) {
1534 echo htmlspecialchars( $value );
1536 echo htmlspecialchars( $conf->$field );
1542 echo " $text</label>\n";
1546 if(isset($errs[$field])) echo "<span class='error'>" . $errs[$field] . "</span>\n";
1549 function getLanguageList() {
1550 global $wgLanguageNames;
1551 if( !isset( $wgLanguageNames ) ) {
1552 require_once( "languages/Names.php" );
1557 $d = opendir( "../languages/messages" );
1558 /* In case we are called from the root directory */
1560 $d = opendir( "languages/messages");
1561 while( false !== ($f = readdir( $d ) ) ) {
1563 if( preg_match( '/Messages([A-Z][a-z_]+)\.php$/', $f, $m ) ) {
1564 $code = str_replace( '_', '-', strtolower( $m[1] ) );
1565 if( isset( $wgLanguageNames[$code] ) ) {
1566 $name = $code . ' - ' . $wgLanguageNames[$code];
1570 $codes[$code] = $name;
1578 #Check for location of an executable
1579 # @param string $loc single location to check
1580 # @param array $names filenames to check for.
1581 # @param mixed $versioninfo array of details to use when checking version, use false for no version checking
1582 function locate_executable($loc, $names, $versioninfo = false) {
1583 if (!is_array($names))
1584 $names = array($names);
1586 foreach ($names as $name) {
1587 $command = "$loc".DIRECTORY_SEPARATOR
."$name";
1588 if (file_exists($command)) {
1592 $file = str_replace('$1', $command, $versioninfo[0]);
1593 if (strstr(`
$file`
, $versioninfo[1]) !== false)
1600 # Test a memcached server
1601 function testMemcachedServer( $server ) {
1602 $hostport = explode(":", $server);
1605 if ( !function_exists( 'fsockopen' ) ) {
1606 $errstr = "Can't connect to memcached, fsockopen() not present";
1608 if ( !$errstr && count( $hostport ) != 2 ) {
1609 $errstr = 'Please specify host and port';
1610 var_dump( $hostport );
1613 list( $host, $port ) = $hostport;
1617 $fp = @fsockopen
( $host, $port, $errno, $fsockerr, 1.0 );
1618 if ( $fp === false ) {
1619 $errstr = "Cannot connect to memcached on $host:$port : $fsockerr";
1623 $command = "version\r\n";
1624 $bytes = fwrite( $fp, $command );
1625 if ( $bytes != strlen( $command ) ) {
1626 $errstr = "Cannot write to memcached socket on $host:$port";
1630 $expected = "VERSION ";
1631 $response = fread( $fp, strlen( $expected ) );
1632 if ( $response != $expected ) {
1633 $errstr = "Didn't get correct memcached response from $host:$port";
1640 echo "<li>Connected to memcached on $host:$port successfully";
1645 function database_picker($conf) {
1648 foreach(array_keys($ourdb) as $db) {
1649 if ($ourdb[$db]['havedriver']) {
1651 aField( $conf, "DBtype", $ourdb[$db]['fullname'], 'radio', $db, 'onclick');
1658 function database_switcher($db) {
1660 $color = $ourdb[$db]['bgcolor'];
1661 $full = $ourdb[$db]['fullname'];
1662 print "<div id='$db' style='display:none; background: $color'>\n";
1663 print "<h3>$full specific options:</h3>\n";
1666 function printListItem( $item ) {
1667 print "<li>$item</li>";
1672 <div
class="license">
1674 <p
>This program is free software
; you can redistribute it
and/or modify
1675 it under the terms of the GNU General
Public License
as published by
1676 the Free Software Foundation
; either version
2 of the License
, or
1677 (at your option
) any later version
.</p
>
1679 <p
>This program is distributed in the hope that it will be useful
,
1680 but WITHOUT ANY WARRANTY
; without even the implied warranty of
1681 MERCHANTABILITY
or FITNESS
FOR A PARTICULAR PURPOSE
. See the
1682 GNU General
Public License
for more details
.</p
>
1684 <p
>You should have received
<a href
="../COPYING">a copy of the GNU General
Public License
</a
>
1685 along with this program
; if not
, write to the Free Software
1686 Foundation
, Inc
., 51 Franklin Street
, Fifth Floor
, Boston
, MA
02110-1301, USA
.
1687 or <a href
="http://www.gnu.org/copyleft/gpl.html">read it online
</a
></p
>
1693 <div id
="column-one">
1694 <div
class="portlet" id
="p-logo">
1695 <a style
="background-image: url(../skins/common/images/mediawiki.png);"
1696 href
="http://www.mediawiki.org/"
1697 title
="Main Page"></a
>
1699 <script type
="text/javascript"> if (window
.isMSIE55
) fixalpha(); </script
>
1700 <div
class='portlet'><div
class='pBody'>
1702 <li
><strong
><a href
="http://www.mediawiki.org/">MediaWiki home
</a
></strong
></li
>
1703 <li
><a href
="../README">Readme
</a
></li
>
1704 <li
><a href
="../RELEASE-NOTES">Release notes
</a
></li
>
1705 <li
><a href
="../docs/">Documentation
</a
></li
>
1706 <li
><a href
="http://meta.wikipedia.org/wiki/MediaWiki_User's_Guide">User
's Guide</a></li>
1707 <li><a href="http://meta.wikimedia.org/wiki/MediaWiki_FAQ">FAQ</a></li>
1709 <p style="font-size:90%;margin-top:1em">MediaWiki is Copyright © 2001-2007 by Magnus Manske, Brion Vibber, Lee Daniel Crocker, Tim Starling, Erik Möller, Gabriel Wicke and others.</p>