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 );
40 require_once( "includes/Defines.php" );
41 require_once( "includes/DefaultSettings.php" );
42 require_once( "includes/MagicWord.php" );
43 require_once( "includes/Namespace.php" );
44 require_once( "includes/ProfilerStub.php" );
46 ## Databases we support:
49 $ourdb['mysql']['fullname'] = 'MySQL';
50 $ourdb['mysql']['havedriver'] = 0;
51 $ourdb['mysql']['compile'] = 'mysql';
52 $ourdb['mysql']['bgcolor'] = '#ffe5a7';
53 $ourdb['mysql']['rootuser'] = 'root';
55 $ourdb['postgres']['fullname'] = 'PostgreSQL';
56 $ourdb['postgres']['havedriver'] = 0;
57 $ourdb['postgres']['compile'] = 'pgsql';
58 $ourdb['postgres']['bgcolor'] = '#aaccff';
59 $ourdb['postgres']['rootuser'] = 'postgres';
62 <!DOCTYPE HTML
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
65 <meta http
-equiv
="Content-type" content
="text/html; charset=utf-8">
66 <title
>MediaWiki
<?php
echo( $wgVersion ); ?
> Installation
</title
>
67 <style type
="text/css">
69 @import
"../skins/monobook/main.css";
73 margin
: 1em
0 1em
2.5em
;
80 .config
-section label
.column
{
92 zoom
: 100%
; /* IE hack */
95 .config
-section
.config
-desc
{
102 .iput
-text
, .iput
-password
{
109 background
-color
: #fff;
117 background
-color
: #FFF0F0;
118 border
: 2px solid red
;
126 list-style
-type
: none
;
127 list-style
-image
: none
;
145 <script type
="text/javascript">
149 <?php
foreach (array_keys($ourdb) as $db) {
150 echo "\n document.getElementById('$db').style.display='none';";
155 function toggleDBarea(id
) {
157 var dbarea
= document
.getElementById(id
).style
;
158 dbarea
.display
= (dbarea
.display
== 'none') ?
'block' : 'none';
166 var db
= document
.getElementById('RootUser');
167 <?php
foreach (array_keys($ourdb) as $db) {
168 echo "\n if (id == '$db') { db.value = '".$ourdb[$db]['rootuser']."';}";
178 <div id
="globalWrapper">
179 <div id
="column-content">
181 <div id
="bodyContent">
183 <h1
>MediaWiki
<?php
print $wgVersion ?
> Installation
</h1
>
187 /* Check for existing configurations and bug out! */
189 if( file_exists( "../LocalSettings.php" ) ) {
190 dieout( " <p><strong>Setup has completed, <a href='../index.php'>your wiki</a> is configured.</strong></p>
192 <p>Please delete the /config directory for extra security.</p></div></div></div></div>" );
195 if( file_exists( "./LocalSettings.php" ) ) {
196 writeSuccessMessage();
201 if( !is_writable( "." ) ) {
202 dieout( "<h2>Can't write config file, aborting</h2>
204 <p>In order to configure the wiki you have to make the <tt>config</tt> subdirectory
205 writable by the web server. Once configuration is done you'll move the created
206 <tt>LocalSettings.php</tt> to the parent directory, and for added safety you can
207 then remove the <tt>config</tt> subdirectory entirely.</p>
209 <p>To make the directory writable on a Unix/Linux system:</p>
212 cd <i>/path/to/wiki</i>
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>)";
357 case "apache2filter":
359 print "using ugly URLs (<tt>index.php?title=Page_Title</tt>)";
360 $conf->prettyURLs
= false;
365 $conf->xml
= function_exists( "utf8_encode" );
367 print "<li>Have XML / Latin1-UTF-8 conversion support.</li>\n";
369 dieout( "PHP's XML module is missing; the wiki requires functions in
370 this module and won't work in this configuration.
371 If you're running Mandrake, install the php-xml package." );
374 # Crude check for session support
375 if( !function_exists( 'session_name' ) )
376 dieout( "PHP's session module is missing. MediaWiki requires session support in order to function." );
379 if( !function_exists( 'preg_match' ) )
380 dieout( "The PCRE regular expression functions are missing. MediaWiki requires these in order to function." );
382 $memlimit = ini_get( "memory_limit" );
383 $conf->raiseMemory
= false;
384 if( empty( $memlimit ) ||
$memlimit == -1 ) {
385 print "<li>PHP is configured with no <tt>memory_limit</tt>.</li>\n";
387 print "<li>PHP's <tt>memory_limit</tt> is " . htmlspecialchars( $memlimit ) . ". <strong>If this is too low, installation may fail!</strong> ";
388 $n = intval( $memlimit );
389 if( preg_match( '/^([0-9]+)[Mm]$/', trim( $memlimit ), $m ) ) {
390 $n = intval( $m[1] * (1024*1024) );
392 if( $n < 20*1024*1024 ) {
393 print "Attempting to raise limit to 20M... ";
394 if( false === ini_set( "memory_limit", "20M" ) ) {
397 $conf->raiseMemory
= true;
404 $conf->zlib
= function_exists( "gzencode" );
406 print "<li>Have zlib support; enabling output compression.</li>\n";
408 print "<li>No zlib support.</li>\n";
411 $conf->turck
= function_exists( 'mmcache_get' );
412 if ( $conf->turck
) {
413 print "<li><a href=\"http://turck-mmcache.sourceforge.net/\">Turck MMCache</a> installed</li>\n";
416 $conf->apc
= function_exists('apc_fetch');
418 print "<li><a href=\"http://www.php.net/apc\">APC</a> installed</li>";
421 $conf->eaccel
= function_exists( 'eaccelerator_get' );
422 if ( $conf->eaccel
) {
423 $conf->turck
= 'eaccelerator';
424 print "<li><a href=\"http://eaccelerator.sourceforge.net/\">eAccelerator</a> installed</li>\n";
427 if( !$conf->turck
&& !$conf->eaccel
&& !$conf->apc
) {
428 echo( '<li>Couldn\'t find <a href="http://turck-mmcache.sourceforge.net">Turck MMCache</a>,
429 <a href="http://eaccelerator.sourceforge.net">eAccelerator</a> or
430 <a href="http://www.php.net/apc">APC</a>. Object caching functions cannot be used.</li>' );
433 $conf->diff3
= false;
434 $diff3locations = array( "/usr/bin", "/usr/local/bin", "/opt/csw/bin", "/usr/gnu/bin", "/usr/sfw/bin" ) +
explode( $sep, getenv( "PATH" ) );
435 $diff3names = array( "gdiff3", "diff3", "diff3.exe" );
437 $diff3versioninfo = array( '$1 --version 2>&1', 'diff3 (GNU diffutils)' );
438 foreach ($diff3locations as $loc) {
439 $exe = locate_executable($loc, $diff3names, $diff3versioninfo);
440 if ($exe !== false) {
447 print "<li>Found GNU diff3: <tt>$conf->diff3</tt>.</li>";
449 print "<li>GNU diff3 not found.</li>";
451 $conf->ImageMagick
= false;
452 $imcheck = array( "/usr/bin", "/opt/csw/bin", "/usr/local/bin", "/sw/bin", "/opt/local/bin" );
453 foreach( $imcheck as $dir ) {
454 $im = "$dir/convert";
455 if( file_exists( $im ) ) {
456 print "<li>Found ImageMagick: <tt>$im</tt>; image thumbnailing will be enabled if you enable uploads.</li>\n";
457 $conf->ImageMagick
= $im;
462 $conf->HaveGD
= function_exists( "imagejpeg" );
463 if( $conf->HaveGD
) {
464 print "<li>Found GD graphics library built-in";
465 if( !$conf->ImageMagick
) {
466 print ", image thumbnailing will be enabled if you enable uploads";
470 if( !$conf->ImageMagick
) {
471 print "<li>Couldn't find GD library or ImageMagick; image thumbnailing disabled.</li>\n";
475 $conf->UseImageResize
= $conf->HaveGD ||
$conf->ImageMagick
;
477 $conf->IP
= dirname( dirname( __FILE__
) );
478 print "<li>Installation directory: <tt>" . htmlspecialchars( $conf->IP
) . "</tt></li>\n";
480 $conf->ScriptPath
= preg_replace( '{^(.*)/config.*$}', '$1', $_SERVER["PHP_SELF"] ); # was SCRIPT_NAME
481 print "<li>Script URI path: <tt>" . htmlspecialchars( $conf->ScriptPath
) . "</tt></li>\n";
483 print "<li style='font-weight:bold;color:green;font-size:110%'>Environment checked. You can install MediaWiki.</li>\n";
484 $conf->posted
= ($_SERVER["REQUEST_METHOD"] == "POST");
486 $conf->Sitename
= ucfirst( importPost( "Sitename", "" ) );
487 $defaultEmail = empty( $_SERVER["SERVER_ADMIN"] )
489 : $_SERVER["SERVER_ADMIN"];
490 $conf->EmergencyContact
= importPost( "EmergencyContact", $defaultEmail );
491 $conf->DBtype
= importPost( "DBtype", $DefaultDBtype );
495 $conf->DBserver
= importPost( "DBserver", "localhost" );
496 $conf->DBname
= importPost( "DBname", "wikidb" );
497 $conf->DBuser
= importPost( "DBuser", "wikiuser" );
498 $conf->DBpassword
= importPost( "DBpassword" );
499 $conf->DBpassword2
= importPost( "DBpassword2" );
500 $conf->SysopName
= importPost( "SysopName", "WikiSysop" );
501 $conf->SysopPass
= importPost( "SysopPass" );
502 $conf->SysopPass2
= importPost( "SysopPass2" );
503 $conf->RootUser
= importPost( "RootUser", "root" );
504 $conf->RootPW
= importPost( "RootPW", "-" );
507 $conf->DBprefix
= importPost( "DBprefix" );
508 $conf->DBmysql5
= (importPost( "DBmysql5" ) == "true") ?
"true" : "false";
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
== "" ) {
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
= '${wgStylePath}/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 "<p><b>Generating configuration file...</b></p>\n";
588 // for debugging: // echo "<pre>" . htmlspecialchars( $local ) . "</pre>\n";
590 $wgCommandLineMode = false;
593 $conf->DBtypename
= '';
594 foreach (array_keys($ourdb) as $db) {
595 if ($conf->DBtype
=== $db)
596 $conf->DBtypename
= $ourdb[$db]['fullname'];
598 if ( ! strlen($conf->DBtype
)) {
599 $errs["DBpicktype"] = "Please choose a database type";
603 if (! $conf->DBtypename
) {
604 $errs["DBtype"] = "Unknown database type '$conf->DBtype'";
607 print "<li>Database type: {$conf->DBtypename}</li>\n";
608 $dbclass = 'Database'.ucfirst($conf->DBtype
);
609 $wgDBtype = $conf->DBtype
;
610 $wgDBadminuser = "root";
611 $wgDBadminpassword = $conf->RootPW
;
614 $wgDBprefix = $conf->DBprefix
;
616 ## Postgres specific:
617 $wgDBport = $conf->DBport
;
618 $wgDBmwschema = $conf->DBmwschema
;
619 $wgDBts2schema = $conf->DBts2schema
;
621 $wgCommandLineMode = true;
622 $wgUseDatabaseMessages = false; /* FIXME: For database failure */
623 require_once( "includes/Setup.php" );
626 require_once( "maintenance/InitialiseMessages.inc" );
628 $wgTitle = Title
::newFromText( "Installation script" );
629 error_reporting( E_ALL
);
630 print "<li>Loading class: $dbclass";
633 if( $conf->DBtype
== 'mysql' ) {
634 $mysqlOldClient = version_compare( mysql_get_client_info(), "4.1.0", "lt" );
635 if( $mysqlOldClient ) {
636 print "<li><b>PHP is linked with old MySQL client libraries. If you are
637 using a MySQL 4.1 server and have problems connecting to the database,
638 see <a href='http://dev.mysql.com/doc/mysql/en/old-client.html'
639 >http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b></li>\n";
641 $ok = true; # Let's be optimistic
643 # Decide if we're going to use the superuser or the regular database user
644 if( $conf->RootPW
== '-' ) {
647 $db_user = $wgDBuser;
648 $db_pass = $wgDBpassword;
652 $db_user = $conf->RootUser
;
653 $db_pass = $conf->RootPW
;
657 echo( "<li>Attempting to connect to database server as $db_user..." );
658 $wgDatabase = Database
::newFromParams( $wgDBserver, $db_user, $db_pass, '', 1 );
660 # Check the connection and respond to errors
661 if( $wgDatabase->isOpen() ) {
664 $wgDBadminuser = $db_user;
665 $wgDBadminpassword = $db_pass;
666 echo( "success.</li>\n" );
667 $wgDatabase->ignoreErrors( true );
668 $myver = $wgDatabase->getServerVersion();
670 # There were errors, report them and back out
672 $errno = mysql_errno();
673 $errtx = htmlspecialchars( mysql_error() );
677 echo( "failed due to authentication errors. Check passwords.</li>" );
679 # The superuser details are wrong
680 $errs["RootUser"] = "Check username";
681 $errs["RootPW"] = "and password";
683 # The regular user details are wrong
684 $errs["DBuser"] = "Check username";
685 $errs["DBpassword"] = "and password";
691 # General connection problem
692 echo( "failed with error [$errno] $errtx.</li>\n" );
693 $errs["DBserver"] = "Connection failed";
698 if( !$ok ) { continue; }
700 } else /* not mysql */ {
701 error_reporting( E_ALL
);
703 ## Possible connect as a superuser
704 if( $conf->RootPW
!= '-' and strlen($conf->RootPW
)) {
705 $wgDBsuperuser = $conf->RootUser
;
706 echo( "<li>Attempting to connect to database \"postgres\" as superuser \"$wgDBsuperuser\"..." );
707 $wgDatabase = $dbc->newFromParams($wgDBserver, $wgDBsuperuser, $conf->RootPW
, "postgres", 1);
708 if (!$wgDatabase->isOpen()) {
709 print " error: " . $wgDatabase->lastError() . "</li>\n";
710 $errs["DBserver"] = "Couldn't connect to database as superuser";
711 $errs["RootUser"] = "Check username";
712 $errs["RootPW"] = "and password";
716 echo( "<li>Attempting to connect to database \"$wgDBname\" as \"$wgDBuser\"..." );
717 $wgDatabase = $dbc->newFromParams($wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1);
718 if (!$wgDatabase->isOpen()) {
719 print " error: " . $wgDatabase->lastError() . "</li>\n";
721 $myver = $wgDatabase->getServerVersion();
725 if ( !$wgDatabase->isOpen() ) {
726 $errs["DBserver"] = "Couldn't connect to database";
730 print "<li>Connected to $myver";
731 if ($conf->DBtype
== 'mysql') {
732 if( version_compare( $myver, "4.0.14" ) < 0 ) {
733 dieout( " -- mysql 4.0.14 or later required. Aborting." );
735 $mysqlNewAuth = version_compare( $myver, "4.1.0", "ge" );
736 if( $mysqlNewAuth && $mysqlOldClient ) {
737 print "; <b class='error'>You are using MySQL 4.1 server, but PHP is linked
738 to old client libraries; if you have trouble with authentication, see
739 <a href='http://dev.mysql.com/doc/mysql/en/old-client.html'
740 >http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b>";
743 if( $mysqlNewAuth ) {
744 print "; enabling MySQL 4.1/5.0 charset mode";
746 print "; <b class='error'>MySQL 4.1/5.0 charset mode enabled,
747 but older version detected; will likely fail.</b>";
752 @$sel = $wgDatabase->selectDB( $wgDBname );
754 print "<li>Database <tt>" . htmlspecialchars( $wgDBname ) . "</tt> exists</li>\n";
756 $err = mysql_errno();
757 if ( $err != 1049 ) {
758 print "<ul><li>Error selecting database $wgDBname: $err " .
759 htmlspecialchars( mysql_error() ) . "</li></ul>";
762 $res = $wgDatabase->query( "CREATE DATABASE `$wgDBname`" );
764 print "<li>Couldn't create database <tt>" .
765 htmlspecialchars( $wgDBname ) .
766 "</tt>; try with root access or check your username/pass.</li>\n";
767 $errs["RootPW"] = "<- Enter";
770 print "<li>Created database <tt>" . htmlspecialchars( $wgDBname ) . "</tt></li>\n";
772 $wgDatabase->selectDB( $wgDBname );
774 else if ($conf->DBtype
== 'postgres') {
775 if( version_compare( $myver, "PostgreSQL 8.0" ) < 0 ) {
776 dieout( " <b>Postgres 8.0 or later is required</b>. Aborting.</li></ul>" );
780 if( $wgDatabase->tableExists( "cur" ) ||
$wgDatabase->tableExists( "revision" ) ) {
781 print "<li>There are already MediaWiki tables in this database. Checking if updates are needed...</li>\n";
783 # Create user if required (todo: other databases)
784 if ( $conf->Root
&& $conf->DBtype
== 'mysql') {
785 $conn = $dbc->newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1 );
786 if ( $conn->isOpen() ) {
787 print "<li>DB user account ok</li>\n";
790 print "<li>Granting user permissions...";
791 if( $mysqlOldClient && $mysqlNewAuth ) {
792 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>";
795 dbsource( "../maintenance/users.sql", $wgDatabase );
798 if ( $conf->DBtype
== 'mysql') {
806 print "<li>Finished update checks.</li>\n";
808 # FIXME: Check for errors
809 print "<li>Creating tables...";
810 if ($conf->DBtype
== 'mysql') {
812 print " using MySQL 5 table defs...";
813 dbsource( "../maintenance/mysql5/tables.sql", $wgDatabase );
815 print " using MySQL 4 table defs...";
816 dbsource( "../maintenance/tables.sql", $wgDatabase );
818 dbsource( "../maintenance/interwiki.sql", $wgDatabase );
819 } else if ($conf->DBtype
== 'postgres') {
820 $wgDatabase->setup_database();
823 $errs["DBtype"] = "Do not know how to handle database type '$conf->DBtype'";
827 print " done.</li>\n";
829 print "<li>Initializing data...";
830 $wgDatabase->insert( 'site_stats',
831 array( 'ss_row_id' => 1,
832 'ss_total_views' => 0,
833 'ss_total_edits' => 0,
834 'ss_good_articles' => 0 ) );
836 # Set up the "regular user" account *if we can, and if we need to*
837 if( $conf->Root
and $conf->DBtype
== 'mysql') {
839 $wgDatabase2 = $dbc->newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1 );
840 if( $wgDatabase2->isOpen() ) {
841 # Nope, just close the test connection and continue
842 $wgDatabase2->close();
843 echo( "<li>User $wgDBuser exists. Skipping grants.</li>" );
845 # Yes, so run the grants
846 echo( "<li>Granting user permissions to $wgDBuser on $wgDBname..." );
847 dbsource( "../maintenance/users.sql", $wgDatabase );
848 echo( "success.</li>" );
852 if( $conf->SysopName
) {
853 $u = User
::newFromName( $conf->getSysopName() );
854 if ( 0 == $u->idForName() ) {
856 $u->setPassword( $conf->getSysopPass() );
859 $u->addGroup( "sysop" );
860 $u->addGroup( "bureaucrat" );
862 print "<li>Created sysop account <tt>" .
863 htmlspecialchars( $conf->SysopName
) . "</tt>.</li>\n";
865 print "<li>Could not create user - already exists!</li>\n";
868 print "<li>Skipped sysop account creation, no name given.</li>\n";
871 $titleobj = Title
::newFromText( wfMsgNoDB( "mainpage" ) );
872 $article = new Article( $titleobj );
873 $newid = $article->insertOn( $wgDatabase );
874 $revision = new Revision( array(
876 'text' => wfMsg( 'mainpagetext' ) . "\n\n" . wfMsg( 'mainpagedocfooter' ),
879 'user_text' => 'MediaWiki default',
881 $revid = $revision->insertOn( $wgDatabase );
882 $article->updateRevisionOn( $wgDatabase, $revision );
885 initialiseMessages();
886 print "</pre></li>\n";
889 /* Write out the config file now that all is well */
890 print "<p>Creating LocalSettings.php...</p>\n\n";
891 $localSettings = "<" . "?php$endl$local$endl?" . ">";
892 // Fix up a common line-ending problem (due to CVS on Windows)
893 $localSettings = str_replace( "\r\n", "\n", $localSettings );
895 if( version_compare( phpversion(), "4.3.2" ) >= 0 ) {
896 $xt = "xt"; # Refuse to overwrite an existing file
898 $xt = "wt"; # 'x' is not available prior to PHP 4.3.2. We did check above, but race conditions blah blah
900 $f = fopen( "LocalSettings.php", $xt );
903 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" .
904 "<p>Here's the file that would have been written, try to paste it into place manually:</p>\n" .
905 "<pre>\n" . htmlspecialchars( $localSettings ) . "</pre>\n" );
907 if(fwrite( $f, $localSettings ) ) {
909 writeSuccessMessage();
912 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");
924 if( count( $errs ) ) {
925 /* Display options form */
927 if( $conf->posted
) {
928 echo "<p class='error-top'>Something's not quite right yet; make sure everything below is filled out correctly.</p>\n";
932 <form action
="index.php" name
="config" method
="post">
937 <div
class="config-section">
938 <div
class="config-input">
940 aField( $conf, "Sitename", "Wiki name:" );
943 <p
class="config-desc">
944 Preferably a short word without punctuation
, i
.e
. "Wikipedia".<br
/>
945 Will appear
as the
namespace name
for "meta" pages
, and throughout the
interface.
948 <div
class="config-input">
950 aField( $conf, "EmergencyContact", "Contact e-mail:" );
953 <p
class="config-desc">
954 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
.
957 <div
class="config-input">
958 <label
class='column' for="LanguageCode">Language
:</label
>
959 <select id
="LanguageCode" name
="LanguageCode">
962 $list = getLanguageList();
963 foreach( $list as $code => $name ) {
964 $sel = ($code == $conf->LanguageCode
) ?
'selected="selected"' : '';
965 echo "\t\t<option value=\"$code\" $sel>$name</option>\n";
970 <p
class="config-desc">
971 Select the language
for your wiki
's interface. Some localizations aren't fully complete
. Unicode (UTF
-8) used
for all localizations
.
974 <div
class="config-input">
975 <label
class='column'>Copyright
/license
:</label
>
978 <li
><?php
aField( $conf, "License", "No license metadata", "radio", "none" ); ?
></li
>
979 <li
><?php
aField( $conf, "License", "GNU Free Documentation License 1.2 (Wikipedia-compatible)", "radio", "gfdl" ); ?
></li
>
981 aField( $conf, "License", "A Creative Commons license - ", "radio", "cc" );
982 $partner = "MediaWiki";
983 $exit = urlencode( "$wgServer{$conf->ScriptPath}/config/index.php?License=cc&RightsUrl=[license_url]&RightsText=[license_name]&RightsCode=[license_code]&RightsIcon=[license_button]" );
984 $icon = urlencode( "$wgServer$wgUploadPath/wiki.png" );
985 $ccApp = htmlspecialchars( "http://creativecommons.org/license/?partner=$partner&exit_url=$exit&partner_icon_url=$icon" );
986 print "<a href=\"$ccApp\" target='_blank'>choose</a>";
988 <?php
if( $conf->License
== "cc" ) { ?
>
990 <li
><?php
aField( $conf, "RightsIcon", "<img src=\"" . htmlspecialchars( $conf->RightsIcon
) . "\" alt='icon' />", "hidden" ); ?
></li
>
991 <li
><?php
aField( $conf, "RightsText", htmlspecialchars( $conf->RightsText
), "hidden" ); ?
></li
>
992 <li
><?php
aField( $conf, "RightsCode", "code: " . htmlspecialchars( $conf->RightsCode
), "hidden" ); ?
></li
>
993 <li
><?php
aField( $conf, "RightsUrl", "<a href=\"" . htmlspecialchars( $conf->RightsUrl
) . "\">" . htmlspecialchars( $conf->RightsUrl
) . "</a>", "hidden" ); ?
></li
>
999 <p
class="config-desc">
1000 A notice
, icon
, and machine
-readable copyright metadata will be displayed
for the license you pick
.
1004 <div
class="config-input">
1005 <?php
aField( $conf, "SysopName", "Admin username:" ) ?
>
1007 <div
class="config-input">
1008 <?php
aField( $conf, "SysopPass", "Password:", "password" ) ?
>
1010 <div
class="config-input">
1011 <?php
aField( $conf, "SysopPass2", "Password confirm:", "password" ) ?
>
1013 <p
class="config-desc">
1014 An admin can lock
/delete pages
, block users from editing
, and other maintenance tasks
.<br
/>
1015 A
new account will be added only when creating a
new wiki database
.
1018 <div
class="config-input">
1019 <label
class='column'>Shared memory caching
:</label
>
1022 <li
><?php
aField( $conf, "Shm", "No caching", "radio", "none" ); ?
></li
>
1024 if ( $conf->turck
) {
1026 aField( $conf, "Shm", "Turck MMCache", "radio", "turck" );
1031 aField( $conf, "Shm", "APC", "radio", "apc" );
1034 if ( $conf->eaccel
) {
1036 aField( $conf, "Shm", "eAccelerator", "radio", "eaccel" );
1040 <li
><?php
aField( $conf, "Shm", "Memcached", "radio", "memcached" ); ?
></li
>
1042 <div style
="clear:left"><?php
aField( $conf, "MCServers", "Memcached servers:", "text" ) ?
></div
>
1044 <p
class="config-desc">
1045 Using a shared memory system such
as Turck MMCache
, APC
, eAccelerator
, or Memcached
1046 will speed up MediaWiki significantly
. Memcached is the best solution but needs to be
1047 installed
. Specify the server addresses
and ports in a comma
-separted
list. Only
1048 use Turck shared memory
if the wiki will be running on a single Apache server
.
1052 <h2
>E
-mail
, e
-mail notification
and authentication setup
</h2
>
1054 <div
class="config-section">
1055 <div
class="config-input">
1056 <label
class='column'>E
-mail
features (global):</label
>
1058 <li
><?php
aField( $conf, "Email", "Enabled", "radio", "email_enabled" ); ?
></li
>
1059 <li
><?php
aField( $conf, "Email", "Disabled", "radio", "email_disabled" ); ?
></li
>
1062 <p
class="config-desc">
1063 Use this to disable all e
-mail
functions (password reminders
, user
-to
-user e
-mail
and e
-mail notifications
)
1064 if sending mail doesn
't work on your server.
1067 <div class="config-input">
1068 <label class='column
'>User-to-user e-mail:</label>
1070 <li><?php aField( $conf, "Emailuser", "Enabled", "radio", "emailuser_enabled" ); ?></li>
1071 <li><?php aField( $conf, "Emailuser", "Disabled", "radio", "emailuser_disabled" ); ?></li>
1074 <p class="config-desc">
1075 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.
1077 <div class="config-input">
1078 <label class='column
'>E-mail notification about changes:</label>
1080 <li><?php aField( $conf, "Enotif", "Disabled", "radio", "enotif_disabled" ); ?></li>
1081 <li><?php aField( $conf, "Enotif", "Enabled for changes to user discussion pages only", "radio", "enotif_usertalk" ); ?></li>
1082 <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>
1085 <div class="config-desc">
1087 For this feature to work, an e-mail address must be present for the user account, and the notification
1088 options in the user's preferences must be enabled
. Also note the
1089 authentication option below
. When testing the feature
, keep in mind that your own changes will never trigger notifications to be sent to yourself
.</p
>
1091 <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
>
1094 <div
class="config-input">
1095 <label
class='column'>E
-mail address authentication
:</label
>
1097 <li
><?php
aField( $conf, "Eauthent", "Disabled", "radio", "eauthent_disabled" ); ?
></li
>
1098 <li
><?php
aField( $conf, "Eauthent", "Enabled", "radio", "eauthent_enabled" ); ?
></li
>
1101 <div
class="config-desc">
1102 <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
1103 change notification mails
. Setting this option is
<B
>recommended
</B
> for public wikis because of potential abuse of the e
-mail features above
.</p
>
1108 <h2
>Database config
</h2
>
1110 <div
class="config-section">
1111 <div
class="config-input">
1112 <label
class='column'>Database type
:</label
>
1113 <?php
if (isset($errs['DBpicktype'])) print "<span class='error'>$errs[DBpicktype]</span>\n"; ?
>
1114 <ul
class='plain'><?php
database_picker($conf) ?
></ul
>
1117 <div
class="config-input" style
="clear:left"><?php
1118 aField( $conf, "DBserver", "Database host:" );
1120 <p
class="config-desc">
1121 If your database server isn
't on your web server, enter the name or IP address here.
1124 <div class="config-input"><?php
1125 aField( $conf, "DBname", "Database name:" );
1127 <div class="config-input"><?php
1128 aField( $conf, "DBuser", "DB username:" );
1130 <div class="config-input"><?php
1131 aField( $conf, "DBpassword", "DB password:", "password" );
1133 <div class="config-input"><?php
1134 aField( $conf, "DBpassword2", "DB password confirm:", "password" );
1136 <p class="config-desc">
1137 If you only have a single user account and database available,
1138 enter those here. If you have database root access (see below)
1139 you can specify new accounts/databases to be created.
1142 This account will not be created if it pre-exists. If this is the case, ensure that it
1143 has SELECT, INSERT, UPDATE and DELETE permissions on the MediaWiki database.
1146 <?php database_switcher('mysql
'); ?>
1147 <div class="config-input"><?php
1148 aField( $conf, "DBprefix", "Database table prefix:" );
1150 <div class="config-desc">
1151 <p>If you need to share one database between multiple wikis, or
1152 MediaWiki and another web application, you may choose to
1153 add a prefix to all the table names to avoid conflicts.</p>
1155 <p>Avoid exotic characters; something like <tt>mw_</tt> is good.</p>
1158 <div class="config-input"><label class="column">Database charset</label>
1159 <div>Select one:</div>
1161 <li><?php aField( $conf, "DBmysql5", "Backwards-compatible UTF-8", "radio", "false" ); ?></li>
1162 <li><?php aField( $conf, "DBmysql5", "Experimental MySQL 4.1/5.0 UTF-8", "radio", "true" ); ?></li>
1165 <p class="config-desc">
1166 <b>EXPERIMENTAL:</b> You can enable explicit Unicode charset support
1167 for MySQL 4.1 and 5.0 servers. This is not well tested and may
1168 cause things to break. <b>If upgrading an older installation, leave
1169 in backwards-compatible mode.</b>
1173 <?php database_switcher('postgres
'); ?>
1174 <div class="config-input"><?php
1175 aField( $conf, "DBport", "Database port:" );
1177 <div class="config-input"><?php
1178 aField( $conf, "DBmwschema", "Schema for mediawiki:" );
1180 <div class="config-input"><?php
1181 aField( $conf, "DBts2schema", "Schema for tsearch2:" );
1183 <div class="config-desc">
1184 <p>The username specified above will have it's search path set to the above schemas
,
1185 so it is recommended that you create a
new user
.</p
>
1189 <div
class="config-input">
1191 aField( $conf, "RootUser", "Superuser account:", "superuser" );
1194 <div
class="config-input">
1196 aField( $conf, "RootPW", "Superuser password:", "password" );
1200 <p
class="config-desc">
1201 If the database user specified above does not exist
, or does not have access to create
1202 the
database (if needed
) or tables within it
, please provide details of a superuser account
,
1203 such
as <strong
>root
</strong
>, which does
. Leave the password set to
<strong
>-</strong
> if this is not needed
.
1206 <div
class="config-input" style
="padding:2em 0 3em">
1207 <label
class='column'> 
;</label
>
1208 <input type
="submit" value
="Install MediaWiki!" class="btn-install" />
1213 <script type
="text/javascript">
1214 window
.onload
= toggleDBarea('<?php echo $conf->DBtype; ?>');
1222 /* -------------------------------------------------------------------------------------- */
1223 function writeSuccessMessage() {
1224 if ( ini_get( 'safe_mode' ) && !ini_get( 'open_basedir' ) ) {
1226 <p>Installation successful!</p>
1227 <p>To complete the installation, please do the following:
1229 <li>Download config/LocalSettings.php with your FTP client or file manager</li>
1230 <li>Upload it to the parent directory</li>
1231 <li>Delete config/LocalSettings.php</li>
1232 <li>Start using <a href='../index.php'>your wiki</a>!
1234 <p>If you are in a shared hosting environment, do <strong>not</strong> just move LocalSettings.php
1235 remotely. LocalSettings.php is currently owned by the user your webserver is running under,
1236 which means that anyone on the same server can read your database password! Downloading
1237 it and uploading it again will hopefully change the ownership to a user ID specific to you.</p>
1240 echo "<p>Installation successful! Move the config/LocalSettings.php file into the parent directory, then follow
1241 <a href='../index.php'>this link</a> to your wiki.</p>\n";
1246 function escapePhpString( $string ) {
1247 return strtr( $string,
1258 function writeLocalSettings( $conf ) {
1259 $conf->UseImageResize
= $conf->UseImageResize ?
'true' : 'false';
1260 $conf->PasswordSender
= $conf->EmergencyContact
;
1261 $zlib = ($conf->zlib ?
"" : "# ");
1262 $magic = ($conf->ImageMagick ?
"" : "# ");
1263 $convert = ($conf->ImageMagick ?
$conf->ImageMagick
: "/usr/bin/convert" );
1264 $pretty = ($conf->prettyURLs ?
"" : "# ");
1265 $ugly = ($conf->prettyURLs ?
"# " : "");
1266 $rights = ($conf->RightsUrl
) ?
"" : "# ";
1267 $hashedUploads = $conf->safeMode ?
'' : '# ';
1269 switch ( $conf->Shm
) {
1271 $cacheType = 'CACHE_MEMCACHED';
1272 $mcservers = var_export( $conf->MCServerArray
, true );
1277 $cacheType = 'CACHE_ACCEL';
1278 $mcservers = 'array()';
1281 $cacheType = 'CACHE_NONE';
1282 $mcservers = 'array()';
1285 if ( $conf->Email
== 'email_enabled' ) {
1286 $enableemail = 'true';
1287 $enableuseremail = ( $conf->Emailuser
== 'emailuser_enabled' ) ?
'true' : 'false' ;
1288 $eauthent = ( $conf->Eauthent
== 'eauthent_enabled' ) ?
'true' : 'false' ;
1289 switch ( $conf->Enotif
) {
1290 case 'enotif_usertalk':
1291 $enotifusertalk = 'true';
1292 $enotifwatchlist = 'false';
1294 case 'enotif_allpages':
1295 $enotifusertalk = 'true';
1296 $enotifwatchlist = 'true';
1299 $enotifusertalk = 'false';
1300 $enotifwatchlist = 'false';
1303 $enableuseremail = 'false';
1304 $enableemail = 'false';
1305 $eauthent = 'false';
1306 $enotifusertalk = 'false';
1307 $enotifwatchlist = 'false';
1310 $file = @fopen
( "/dev/urandom", "r" );
1312 $secretKey = bin2hex( fread( $file, 32 ) );
1316 for ( $i=0; $i<8; $i++
) {
1317 $secretKey .= dechex(mt_rand(0, 0x7fffffff));
1319 print "<li>Warning: \$wgSecretKey key is insecure, generated with mt_rand(). Consider changing it manually.</li>\n";
1322 # Add slashes to strings for double quoting
1323 $slconf = array_map( "escapePhpString", get_object_vars( $conf ) );
1324 if( $conf->License
== 'gfdl' ) {
1325 # Needs literal string interpolation for the current style path
1326 $slconf['RightsIcon'] = $conf->RightsIcon
;
1330 # This file was automatically generated by the MediaWiki installer.
1331 # If you make manual changes, please keep track in case you need to
1332 # recreate them later.
1334 # See includes/DefaultSettings.php for all configurable settings
1335 # and their default values, but don't forget to make changes in _this_
1338 # If you customize your file layout, set \$IP to the directory that contains
1339 # the other MediaWiki files. It will be used as a base to locate files.
1340 if( defined( 'MW_INSTALL_PATH' ) ) {
1341 \$IP = MW_INSTALL_PATH;
1343 \$IP = dirname( __FILE__ );
1346 \$path = array( \$IP, \"\$IP/includes\", \"\$IP/languages\" );
1347 set_include_path( implode( PATH_SEPARATOR, \$path ) . PATH_SEPARATOR . get_include_path() );
1349 require_once( \"includes/DefaultSettings.php\" );
1351 # If PHP's memory limit is very low, some operations may fail.
1352 " . ($conf->raiseMemory ?
'' : '# ' ) . "ini_set( 'memory_limit', '20M' );" . "
1354 if ( \$wgCommandLineMode ) {
1355 if ( isset( \$_SERVER ) && array_key_exists( 'REQUEST_METHOD', \$_SERVER ) ) {
1356 die( \"This script must be run from the command line\\n\" );
1358 } elseif ( empty( \$wgNoOutputBuffer ) ) {
1359 ## Compress output if the browser supports it
1360 {$zlib}if( !ini_get( 'zlib.output_compression' ) ) @ob_start( 'ob_gzhandler' );
1363 \$wgSitename = \"{$slconf['Sitename']}\";
1365 \$wgScriptPath = \"{$slconf['ScriptPath']}\";
1366 \$wgScript = \"\$wgScriptPath/index.php\";
1367 \$wgRedirectScript = \"\$wgScriptPath/redirect.php\";
1369 ## For more information on customizing the URLs please see:
1370 ## http://meta.wikimedia.org/wiki/Eliminating_index.php_from_the_url
1371 ## If using PHP as a CGI module, the ?title= style usually must be used.
1372 {$pretty}\$wgArticlePath = \"\$wgScript/\$1\";
1373 {$ugly}\$wgArticlePath = \"\$wgScript?title=\$1\";
1375 \$wgStylePath = \"\$wgScriptPath/skins\";
1376 \$wgStyleDirectory = \"\$IP/skins\";
1377 \$wgLogo = \"\$wgStylePath/common/images/wiki.png\";
1379 \$wgUploadPath = \"\$wgScriptPath/images\";
1380 \$wgUploadDirectory = \"\$IP/images\";
1382 \$wgEnableEmail = $enableemail;
1383 \$wgEnableUserEmail = $enableuseremail;
1385 \$wgEmergencyContact = \"{$slconf['EmergencyContact']}\";
1386 \$wgPasswordSender = \"{$slconf['PasswordSender']}\";
1388 ## For a detailed description of the following switches see
1389 ## http://meta.wikimedia.org/Enotif and http://meta.wikimedia.org/Eauthent
1390 ## There are many more options for fine tuning available see
1391 ## /includes/DefaultSettings.php
1392 ## UPO means: this is also a user preference option
1393 \$wgEnotifUserTalk = $enotifusertalk; # UPO
1394 \$wgEnotifWatchlist = $enotifwatchlist; # UPO
1395 \$wgEmailAuthentication = $eauthent;
1397 \$wgDBserver = \"{$slconf['DBserver']}\";
1398 \$wgDBname = \"{$slconf['DBname']}\";
1399 \$wgDBuser = \"{$slconf['DBuser']}\";
1400 \$wgDBpassword = \"{$slconf['DBpassword']}\";
1401 \$wgDBprefix = \"{$slconf['DBprefix']}\";
1402 \$wgDBtype = \"{$slconf['DBtype']}\";
1403 \$wgDBport = \"{$slconf['DBport']}\";
1405 # Experimental charset support for MySQL 4.1/5.0.
1406 \$wgDBmysql5 = {$conf->DBmysql5};
1408 ## Shared memory settings
1409 \$wgMainCacheType = $cacheType;
1410 \$wgMemCachedServers = $mcservers;
1412 ## To enable image uploads, make sure the 'images' directory
1413 ## is writable, then set this to true:
1414 \$wgEnableUploads = false;
1415 \$wgUseImageResize = {$conf->UseImageResize};
1416 {$magic}\$wgUseImageMagick = true;
1417 {$magic}\$wgImageMagickConvertCommand = \"{$convert}\";
1419 ## If you want to use image uploads under safe mode,
1420 ## create the directories images/archive, images/thumb and
1421 ## images/temp, and make them all writable. Then uncomment
1422 ## this, if it's not already uncommented:
1423 {$hashedUploads}\$wgHashedUploadDirectory = false;
1425 ## If you have the appropriate support software installed
1426 ## you can enable inline LaTeX equations:
1428 \$wgMathPath = \"{\$wgUploadPath}/math\";
1429 \$wgMathDirectory = \"{\$wgUploadDirectory}/math\";
1430 \$wgTmpDirectory = \"{\$wgUploadDirectory}/tmp\";
1432 \$wgLocalInterwiki = \$wgSitename;
1434 \$wgLanguageCode = \"{$slconf['LanguageCode']}\";
1436 \$wgProxyKey = \"$secretKey\";
1438 ## Default skin: you can change the default skin. Use the internal symbolic
1439 ## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook':
1440 \$wgDefaultSkin = 'monobook';
1442 ## For attaching licensing metadata to pages, and displaying an
1443 ## appropriate copyright notice / icon. GNU Free Documentation
1444 ## License and Creative Commons licenses are supported so far.
1445 {$rights}\$wgEnableCreativeCommonsRdf = true;
1446 \$wgRightsPage = \"\"; # Set to the title of a wiki page that describes your license/copyright
1447 \$wgRightsUrl = \"{$slconf['RightsUrl']}\";
1448 \$wgRightsText = \"{$slconf['RightsText']}\";
1449 \$wgRightsIcon = \"{$slconf['RightsIcon']}\";
1450 # \$wgRightsCode = \"{$slconf['RightsCode']}\"; # Not yet used
1452 \$wgDiff3 = \"{$slconf['diff3']}\";
1454 # When you make changes to this configuration file, this will make
1455 # sure that cached pages are cleared.
1456 \$configdate = gmdate( 'YmdHis', @filemtime( __FILE__ ) );
1457 \$wgCacheEpoch = max( \$wgCacheEpoch, \$configdate );
1459 // Keep things in Unix line endings internally;
1460 // the system will write out as local text type.
1461 return str_replace( "\r\n", "\n", $localsettings );
1464 function dieout( $text ) {
1465 die( $text . "\n\n</body>\n</html>" );
1468 function importVar( &$var, $name, $default = "" ) {
1469 if( isset( $var[$name] ) ) {
1470 $retval = $var[$name];
1471 if ( get_magic_quotes_gpc() ) {
1472 $retval = stripslashes( $retval );
1480 function importPost( $name, $default = "" ) {
1481 return importVar( $_POST, $name, $default );
1484 function importRequest( $name, $default = "" ) {
1485 return importVar( $_REQUEST, $name, $default );
1490 function aField( &$conf, $field, $text, $type = "text", $value = "", $onclick = '' ) {
1493 $xtype = "type=\"$type\"";
1499 $nolabel = ($type == "radio") ||
($type == "hidden");
1501 if ($type == 'radio')
1502 $id .= $radioCount++
;
1507 echo "\t\t<label class='column' for=\"$id\">$text</label>\n";
1510 if( $type == "radio" && $value == $conf->$field ) {
1511 $checked = "checked='checked'";
1515 echo "\t\t<input $xtype name=\"$field\" id=\"$id\" class=\"iput-$type\" $checked ";
1517 echo " onclick='toggleDBarea(\"$value\")' " ;
1520 if( $type == "radio" ) {
1521 echo htmlspecialchars( $value );
1523 echo htmlspecialchars( $conf->$field );
1529 echo " $text</label>\n";
1533 if(isset($errs[$field])) echo "<span class='error'>" . $errs[$field] . "</span>\n";
1536 function getLanguageList() {
1537 global $wgLanguageNames;
1538 if( !isset( $wgLanguageNames ) ) {
1539 require_once( "languages/Names.php" );
1544 $d = opendir( "../languages" );
1545 /* In case we are called from the root directory */
1547 $d = opendir( "languages");
1548 while( false !== ($f = readdir( $d ) ) ) {
1550 if( preg_match( '/Language([A-Z][a-z_]+)\.php$/', $f, $m ) ) {
1551 $code = str_replace( '_', '-', strtolower( $m[1] ) );
1552 if( isset( $wgLanguageNames[$code] ) ) {
1553 $name = $code . ' - ' . $wgLanguageNames[$code];
1557 $codes[$code] = $name;
1565 #Check for location of an executable
1566 # @param string $loc single location to check
1567 # @param array $names filenames to check for.
1568 # @param mixed $versioninfo array of details to use when checking version, use false for no version checking
1569 function locate_executable($loc, $names, $versioninfo = false) {
1570 if (!is_array($names))
1571 $names = array($names);
1573 foreach ($names as $name) {
1574 $command = "$loc".DIRECTORY_SEPARATOR
."$name";
1575 if (file_exists($command)) {
1579 $file = str_replace('$1', $command, $versioninfo[0]);
1580 if (strstr(`
$file`
, $versioninfo[1]) !== false)
1587 # Test a memcached server
1588 function testMemcachedServer( $server ) {
1589 $hostport = explode(":", $server);
1592 if ( !function_exists( 'fsockopen' ) ) {
1593 $errstr = "Can't connect to memcached, fsockopen() not present";
1595 if ( !$errstr && count( $hostport ) != 2 ) {
1596 $errstr = 'Please specify host and port';
1597 var_dump( $hostport );
1600 list( $host, $port ) = $hostport;
1604 $fp = @fsockopen
( $host, $port, $errno, $fsockerr, 1.0 );
1605 if ( $fp === false ) {
1606 $errstr = "Cannot connect to memcached on $host:$port : $fsockerr";
1610 $command = "version\r\n";
1611 $bytes = fwrite( $fp, $command );
1612 if ( $bytes != strlen( $command ) ) {
1613 $errstr = "Cannot write to memcached socket on $host:$port";
1617 $expected = "VERSION ";
1618 $response = fread( $fp, strlen( $expected ) );
1619 if ( $response != $expected ) {
1620 $errstr = "Didn't get correct memcached response from $host:$port";
1627 echo "<li>Connected to memcached on $host:$port successfully";
1632 function database_picker($conf) {
1635 foreach(array_keys($ourdb) as $db) {
1636 if ($ourdb[$db]['havedriver']) {
1638 aField( $conf, "DBtype", $ourdb[$db]['fullname'], 'radio', $db, 'onclick');
1645 function database_switcher($db) {
1647 $color = $ourdb[$db]['bgcolor'];
1648 $full = $ourdb[$db]['fullname'];
1649 print "<div id='$db' style='display:none; background: $color'>\n";
1650 print "<h3>$full specific options:</h3>\n";
1655 <div
class="license">
1657 <p
>This program is free software
; you can redistribute it
and/or modify
1658 it under the terms of the GNU General
Public License
as published by
1659 the Free Software Foundation
; either version
2 of the License
, or
1660 (at your option
) any later version
.</p
>
1662 <p
>This program is distributed in the hope that it will be useful
,
1663 but WITHOUT ANY WARRANTY
; without even the implied warranty of
1664 MERCHANTABILITY
or FITNESS
FOR A PARTICULAR PURPOSE
. See the
1665 GNU General
Public License
for more details
.</p
>
1667 <p
>You should have received
<a href
="../COPYING">a copy of the GNU General
Public License
</a
>
1668 along with this program
; if not
, write to the Free Software
1669 Foundation
, Inc
., 51 Franklin Street
, Fifth Floor
, Boston
, MA
02110-1301, USA
.
1670 or <a href
="http://www.gnu.org/copyleft/gpl.html">read it online
</a
></p
>
1676 <div id
="column-one">
1677 <div
class="portlet" id
="p-logo">
1678 <a style
="background-image: url(../skins/common/images/mediawiki.png);"
1679 href
="http://www.mediawiki.org/"
1680 title
="Main Page"></a
>
1682 <script type
="text/javascript"> if (window
.isMSIE55
) fixalpha(); </script
>
1683 <div
class='portlet'><div
class='pBody'>
1685 <li
><strong
><a href
="http://www.mediawiki.org/">MediaWiki home
</a
></strong
></li
>
1686 <li
><a href
="../README">Readme
</a
></li
>
1687 <li
><a href
="../RELEASE-NOTES">Release notes
</a
></li
>
1688 <li
><a href
="../docs/">Documentation
</a
></li
>
1689 <li
><a href
="http://meta.wikipedia.org/wiki/MediaWiki_User's_Guide">User
's Guide</a></li>
1690 <li><a href="http://meta.wikimedia.org/wiki/MediaWiki_FAQ">FAQ</a></li>
1692 <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>