3 # MediaWiki web-based config/installation
4 # Copyright (C) 2004 Brion Vibber <brion@pobox.com>, 2006 Rob Church <robchur@gmail.com>
5 # http://www.mediawiki.org/
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along
18 # with this program; if not, write to the Free Software Foundation, Inc.,
19 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 # http://www.gnu.org/copyleft/gpl.html
22 error_reporting( E_ALL
);
23 header( "Content-type: text/html; charset=utf-8" );
24 @ini_set
( "display_errors", true );
26 # In case of errors, let output be clean.
27 $wgRequestTime = microtime( true );
29 # Attempt to set up the include path, to fix problems with relative includes
30 $IP = dirname( dirname( __FILE__
) );
31 define( 'MW_INSTALL_PATH', $IP );
33 # Define an entry point and include some files
34 define( "MEDIAWIKI", true );
35 define( "MEDIAWIKI_INSTALL", true );
37 // Run version checks before including other files
38 // so people don't see a scary parse error.
39 require_once( "$IP/install-utils.inc" );
40 install_version_checks();
42 require_once( "$IP/includes/Defines.php" );
43 require_once( "$IP/includes/DefaultSettings.php" );
44 require_once( "$IP/includes/AutoLoader.php" );
45 require_once( "$IP/includes/MagicWord.php" );
46 require_once( "$IP/includes/Namespace.php" );
47 require_once( "$IP/includes/ProfilerStub.php" );
48 require_once( "$IP/includes/GlobalFunctions.php" );
49 require_once( "$IP/includes/Hooks.php" );
50 require_once( "$IP/includes/Exception.php" );
52 # If we get an exception, the user needs to know
54 $wgShowExceptionDetails = true;
55 $wgShowSQLErrors = true;
56 wfInstallExceptionHandler();
57 ## Databases we support:
60 $ourdb['mysql']['fullname'] = 'MySQL';
61 $ourdb['mysql']['havedriver'] = 0;
62 $ourdb['mysql']['compile'] = 'mysql';
63 $ourdb['mysql']['bgcolor'] = '#ffe5a7';
64 $ourdb['mysql']['rootuser'] = 'root';
66 $ourdb['postgres']['fullname'] = 'PostgreSQL';
67 $ourdb['postgres']['havedriver'] = 0;
68 $ourdb['postgres']['compile'] = 'pgsql';
69 $ourdb['postgres']['bgcolor'] = '#aaccff';
70 $ourdb['postgres']['rootuser'] = 'postgres';
72 $ourdb['sqlite']['fullname'] = 'SQLite';
73 $ourdb['sqlite']['havedriver'] = 0;
74 $ourdb['sqlite']['compile'] = 'pdo_sqlite';
75 $ourdb['sqlite']['bgcolor'] = '#b1ebb1';
76 $ourdb['sqlite']['rootuser'] = '';
78 $ourdb['mssql']['fullname'] = 'MSSQL';
79 $ourdb['mssql']['havedriver'] = 0;
80 $ourdb['mssql']['compile'] = 'mssql not ready'; # Change to 'mssql' after includes/DatabaseMssql.php added;
81 $ourdb['mssql']['bgcolor'] = '#ffc0cb';
82 $ourdb['mssql']['rootuser'] = 'administrator';
84 $ourdb['ibm_db2']['fullname'] = 'DB2';
85 $ourdb['ibm_db2']['havedriver'] = 0;
86 $ourdb['ibm_db2']['compile'] = 'ibm_db2';
87 $ourdb['ibm_db2']['bgcolor'] = '#ffeba1';
88 $ourdb['ibm_db2']['rootuser'] = 'db2admin';
90 $ourdb['oracle']['fullname'] = 'Oracle';
91 $ourdb['oracle']['havedriver'] = 0;
92 $ourdb['oracle']['compile'] = 'oci8';
93 $ourdb['oracle']['bgcolor'] = '#ffeba1';
94 $ourdb['oracle']['rootuser'] = '';
97 <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
98 <html xmlns
="http://www.w3.org/1999/xhtml" xml
:lang
="en" lang
="en" dir
="ltr">
100 <meta http
-equiv
="Content-type" content
="text/html; charset=utf-8" />
101 <meta name
="robots" content
="noindex,nofollow"/>
102 <title
>MediaWiki
<?php
echo htmlspecialchars( $wgVersion ); ?
> Installation
</title
>
103 <style type
="text/css">
105 @import
"../skins/monobook/main.css";
109 margin
: 1em
0 1em
2.5em
;
116 .config
-section label
.column
{
128 zoom
: 100%
; /* IE hack */
131 .config
-section
.config
-desc
{
133 margin
: 0 0 2em
18em
;
138 .iput
-text
, .iput
-password
{
145 background
-color
: #fff;
153 background
-color
: #FFF0F0;
154 border
: 2px solid red
;
162 list-style
-type
: none
;
163 list-style
-image
: none
;
180 span
.success
-message
{
190 <script type
="text/javascript">
193 <?php
foreach (array_keys($ourdb) as $db) {
194 echo "\n var i = document.getElementById('$db'); if (i) i.style.display='none';";
199 function toggleDBarea(id
,defaultroot
) {
201 var dbarea
= document
.getElementById(id
);
202 if (dbarea
) dbarea
.style
.display
= (dbarea
.style
.display
== 'none') ?
'block' : 'none';
203 var db
= document
.getElementById('RootUser');
205 <?php
foreach (array_keys($ourdb) as $db) {
206 echo " if (id == '$db') { db.value = '".$ourdb[$db]['rootuser']."';}\n";
215 <div id
="globalWrapper">
216 <div id
="column-content">
218 <div id
="bodyContent">
220 <h1
>MediaWiki
<?php
print htmlspecialchars( $wgVersion ) ?
> Installation
</h1
>
223 $mainListOpened = false; # Is the main list (environement checking) opend ? Used by dieout
225 /* Check for existing configurations and bug out! */
227 if( file_exists( "../LocalSettings.php" ) ) {
228 $script = defined('MW_INSTALL_PHP5_EXT') ?
'index.php5' : 'index.php';
229 dieout( "<p><strong>Setup has completed, <a href='../$script'>your wiki</a> is configured.</strong></p>
230 <p>Please delete the /config directory for extra security.</p>" );
233 if( file_exists( "./LocalSettings.php" ) ) {
234 writeSuccessMessage();
238 if( !is_writable( "." ) ) {
239 dieout( "<h2>Can't write config file, aborting</h2>
241 <p>In order to configure the wiki you have to make the <tt>config</tt> subdirectory
242 writable by the web server. Once configuration is done you'll move the created
243 <tt>LocalSettings.php</tt> to the parent directory, and for added safety you can
244 then remove the <tt>config</tt> subdirectory entirely.</p>
246 <p>To make the directory writable on a Unix/Linux system:</p>
249 cd <i>/path/to/wiki</i>
253 <p>Afterwards retry to start the <a href=\"\">setup</a>.</p>" );
257 require_once( "$IP/install-utils.inc" );
258 require_once( "$IP/maintenance/updaters.inc" );
261 function getEncoded( $data ) {
262 # removing latin1 support, no need...
265 function getSitename() { return $this->getEncoded( $this->Sitename
); }
266 function getSysopName() { return $this->getEncoded( $this->SysopName
); }
267 function getSysopPass() { return $this->getEncoded( $this->SysopPass
); }
269 function setSchema( $schema, $engine ) {
270 $this->DBschema
= $schema;
271 if ( !preg_match( '/^\w*$/', $engine ) ){
274 switch ( $this->DBschema
) {
276 $this->DBTableOptions
= "ENGINE=$engine, DEFAULT CHARSET=utf8";
277 $this->DBmysql5
= 'true';
279 case 'mysql5-binary':
280 $this->DBTableOptions
= "ENGINE=$engine, DEFAULT CHARSET=binary";
281 $this->DBmysql5
= 'true';
284 $this->DBTableOptions
= "TYPE=$engine";
285 $this->DBmysql5
= 'false';
287 $this->DBengine
= $engine;
289 # Set the global for use during install
290 global $wgDBTableOptions;
291 $wgDBTableOptions = $this->DBTableOptions
;
299 <b
>Don
't forget security updates!</b> Keep an eye on the
300 <a href="http://lists.wikimedia.org/mailman/listinfo/mediawiki-announce">low-traffic
301 release announcements mailing list</a>.
306 <h2>Checking environment...</h2>
307 <p><em>Please include all of the lines below when reporting installation problems.</em></p>
308 <ul class="env-check">
310 $mainListOpened = true;
314 define( 'MW_NO_OUTPUT_BUFFER
', 1 );
315 $conf = new ConfigData;
317 install_version_checks();
318 $self = 'Installer
'; # Maintenance script name, to please Setup.php
320 print "<li>PHP " . htmlspecialchars( phpversion() ) . " installed</li>\n";
322 error_reporting( 0 );
323 $phpdatabases = array();
324 foreach (array_keys($ourdb) as $db) {
325 $compname = $ourdb[$db]['compile
'];
326 if( extension_loaded( $compname ) || ( mw_have_dl() && dl( "{$compname}." . PHP_SHLIB_SUFFIX ) ) ) {
327 array_push($phpdatabases, $db);
328 $ourdb[$db]['havedriver
'] = 1;
331 error_reporting( E_ALL );
333 if (!$phpdatabases) {
334 print "Could not find a suitable database driver!<ul>";
335 foreach (array_keys($ourdb) AS $db) {
336 $comp = $ourdb[$db]['compile
'];
337 $full = $ourdb[$db]['fullname
'];
338 print "<li>For <b>$full</b>, compile PHP using <b>--with-$comp</b>, "
339 ."or install the $comp.so module</li>\n";
345 print "<li>Found database drivers for:";
347 foreach (array_keys($ourdb) AS $db) {
348 if ($ourdb[$db]['havedriver
']) {
349 if ( $DefaultDBtype == '' ) {
350 $DefaultDBtype = $db;
352 print " ".$ourdb[$db]['fullname
'];
357 if( wfIniGetBool( "register_globals" ) ) {
360 <div style="font-size:110%">
361 <strong class="error">Warning:</strong>
362 <strong>PHP's
<tt
><a href
="http://php.net/register_globals">register_globals
</a
></tt
> option is enabled
. Disable it
if you can
.</strong
>
364 MediaWiki will work
, but your server is more exposed to PHP
-based security vulnerabilities
.
371 if( wfIniGetBool( "magic_quotes_runtime" ) ) {
373 ?
><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
>
374 This option corrupts data input unpredictably
; you cannot install
or use
375 MediaWiki unless this option is disabled
.</li
>
379 if( wfIniGetBool( "magic_quotes_sybase" ) ) {
381 ?
><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
>
382 This option corrupts data input unpredictably
; you cannot install
or use
383 MediaWiki unless this option is disabled
.</li
>
387 if( wfIniGetBool( "mbstring.func_overload" ) ) {
389 ?
><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
>
390 This option causes errors
and may corrupt data unpredictably
;
391 you cannot install
or use MediaWiki unless this option is disabled
.</li
>
395 if( wfIniGetBool( "zend.ze1_compatibility_mode" ) ) {
397 ?
><li
class="error"><strong
>Fatal
: <a href
="http://www.php.net/manual/en/ini.core.php">zend
.ze1_compatibility_mode
</a
> is active
!</strong
>
398 This option causes horrible bugs with MediaWiki
; you cannot install
or use
399 MediaWiki unless this option is disabled
.</li
>
405 dieout( "Cannot install MediaWiki." );
408 if( wfIniGetBool( "safe_mode" ) ) {
409 $conf->safeMode
= true;
411 <li
><b
class='error'>Warning
:</b
> <strong
>PHP
's
412 <a href='http
://www.php.net/features.safe-mode'>safe mode</a> is active.</strong>
413 You may have problems caused by this
, particularly
if using image uploads
.
417 $conf->safeMode
= false;
420 $sapi = htmlspecialchars( php_sapi_name() );
421 print "<li>PHP server API is $sapi; ";
422 $script = defined('MW_INSTALL_PHP5_EXT') ?
'index.php5' : 'index.php';
423 if( $wgUsePathInfo ) {
424 print "ok, using pretty URLs (<tt>$script/Page_Title</tt>)";
426 print "using ugly URLs (<tt>$script?title=Page_Title</tt>)";
430 $conf->xml
= function_exists( "utf8_encode" );
432 print "<li>Have XML / Latin1-UTF-8 conversion support.</li>\n";
434 dieout( "PHP's XML module is missing; the wiki requires functions in
435 this module and won't work in this configuration.
436 If you're running Mandrake, install the php-xml package." );
439 # Check for session support
440 if( !function_exists( 'session_name' ) )
441 dieout( "PHP's session module is missing. MediaWiki requires session support in order to function." );
443 # session.save_path doesn't *have* to be set, but if it is, and it's
444 # not valid/writable/etc. then it can cause problems
445 $sessionSavePath = mw_get_session_save_path();
446 $ssp = htmlspecialchars( $sessionSavePath );
447 # Warn the user if it's not set, but let them proceed
448 if( !$sessionSavePath ) {
449 print "<li><strong>Warning:</strong> A value for <tt>session.save_path</tt>
450 has not been set in PHP.ini. If the default value causes problems with
451 saving session data, set it to a valid path which is read/write/execute
452 for the user your web server is running under.</li>";
453 } elseif ( is_dir( $sessionSavePath ) && is_writable( $sessionSavePath ) ) {
454 # All good? Let the user know
455 print "<li>Session save path (<tt>{$ssp}</tt>) appears to be valid.</li>";
457 # Something not right? Warn the user, but let them proceed
458 print "<li><strong>Warning:</strong> Your <tt>session.save_path</tt> value (<tt>{$ssp}</tt>)
459 appears to be invalid or is not writable. PHP needs to be able to save data to
460 this location for correct session operation.</li>";
463 # Check for PCRE support
464 if( !function_exists( 'preg_match' ) )
465 dieout( "The PCRE support module appears to be missing. MediaWiki requires the
466 Perl-compatible regular expression functions." );
468 $memlimit = ini_get( "memory_limit" );
469 $conf->raiseMemory
= false;
470 if( empty( $memlimit ) ||
$memlimit == -1 ) {
471 print "<li>PHP is configured with no <tt>memory_limit</tt>.</li>\n";
473 print "<li>PHP's <tt>memory_limit</tt> is " . htmlspecialchars( $memlimit ) . ". ";
474 $n = intval( $memlimit );
475 if( preg_match( '/^([0-9]+)[Mm]$/', trim( $memlimit ), $m ) ) {
476 $n = intval( $m[1] * (1024*1024) );
478 if( $n < 20*1024*1024 ) {
479 print "Attempting to raise limit to 20M... ";
480 if( false === ini_set( "memory_limit", "20M" ) ) {
481 print "failed.<br /><b>" . htmlspecialchars( $memlimit ) . " seems too low, installation may fail!</b>";
483 $conf->raiseMemory
= true;
490 $conf->turck
= function_exists( 'mmcache_get' );
491 if ( $conf->turck
) {
492 print "<li><a href=\"http://turck-mmcache.sourceforge.net/\">Turck MMCache</a> installed</li>\n";
495 $conf->xcache
= function_exists( 'xcache_get' );
497 print "<li><a href=\"http://trac.lighttpd.net/xcache/\">XCache</a> installed</li>\n";
499 $conf->apc
= function_exists('apc_fetch');
501 print "<li><a href=\"http://www.php.net/apc\">APC</a> installed</li>\n";
504 $conf->eaccel
= function_exists( 'eaccelerator_get' );
505 if ( $conf->eaccel
) {
506 $conf->turck
= 'eaccelerator';
507 print "<li><a href=\"http://eaccelerator.sourceforge.net/\">eAccelerator</a> installed</li>\n";
510 $conf->dba
= function_exists( 'dba_open' );
512 if( !( $conf->turck ||
$conf->eaccel ||
$conf->apc ||
$conf->xcache
) ) {
513 echo( '<li>Couldn\'t find <a href="http://turck-mmcache.sourceforge.net">Turck MMCache</a>,
514 <a href="http://eaccelerator.sourceforge.net">eAccelerator</a>,
515 <a href="http://www.php.net/apc">APC</a> or <a href="http://trac.lighttpd.net/xcache/">XCache</a>;
516 cannot use these for object caching.</li>' );
519 $conf->diff3
= false;
520 $diff3locations = array_merge(
527 explode( PATH_SEPARATOR
, getenv( "PATH" ) ) );
528 $diff3names = array( "gdiff3", "diff3", "diff3.exe" );
530 $diff3versioninfo = array( '$1 --version 2>&1', 'diff3 (GNU diffutils)' );
531 foreach ($diff3locations as $loc) {
532 $exe = locate_executable($loc, $diff3names, $diff3versioninfo);
533 if ($exe !== false) {
540 print "<li>Found GNU diff3: <tt>$conf->diff3</tt>.</li>";
542 print "<li>GNU diff3 not found.</li>";
544 $conf->ImageMagick
= false;
545 $imcheck = array( "/usr/bin", "/opt/csw/bin", "/usr/local/bin", "/sw/bin", "/opt/local/bin" );
546 foreach( $imcheck as $dir ) {
547 $im = "$dir/convert";
548 if( @file_exists
( $im ) ) {
549 print "<li>Found ImageMagick: <tt>$im</tt>; image thumbnailing will be enabled if you enable uploads.</li>\n";
550 $conf->ImageMagick
= $im;
555 $conf->HaveGD
= function_exists( "imagejpeg" );
556 if( $conf->HaveGD
) {
557 print "<li>Found GD graphics library built-in";
558 if( !$conf->ImageMagick
) {
559 print ", image thumbnailing will be enabled if you enable uploads";
563 if( !$conf->ImageMagick
) {
564 print "<li>Couldn't find GD library or ImageMagick; image thumbnailing disabled.</li>\n";
568 $conf->IP
= dirname( dirname( __FILE__
) );
569 print "<li>Installation directory: <tt>" . htmlspecialchars( $conf->IP
) . "</tt></li>\n";
572 // PHP_SELF isn't available sometimes, such as when PHP is CGI but
573 // cgi.fix_pathinfo is disabled. In that case, fall back to SCRIPT_NAME
574 // to get the path to the current script... hopefully it's reliable. SIGH
575 $path = ($_SERVER["PHP_SELF"] === '')
576 ?
$_SERVER["SCRIPT_NAME"]
577 : $_SERVER["PHP_SELF"];
579 $conf->ScriptPath
= preg_replace( '{^(.*)/config.*$}', '$1', $path );
580 print "<li>Script URI path: <tt>" . htmlspecialchars( $conf->ScriptPath
) . "</tt></li>\n";
584 // We may be installing from *.php5 extension file, if so, print message
585 $conf->ScriptExtension
= '.php';
586 if (defined('MW_INSTALL_PHP5_EXT')) {
587 $conf->ScriptExtension
= '.php5';
588 print "<li>Installing MediaWiki with <tt>php5</tt> file extensions</li>\n";
590 print "<li>Installing MediaWiki with <tt>php</tt> file extensions</li>\n";
594 print "<li style='font-weight:bold;color:green;font-size:110%'>Environment checked. You can install MediaWiki.</li>\n";
595 $conf->posted
= ($_SERVER["REQUEST_METHOD"] == "POST");
597 $conf->Sitename
= ucfirst( importPost( "Sitename", "" ) );
598 $defaultEmail = empty( $_SERVER["SERVER_ADMIN"] )
600 : $_SERVER["SERVER_ADMIN"];
601 $conf->EmergencyContact
= importPost( "EmergencyContact", $defaultEmail );
602 $conf->DBtype
= importPost( "DBtype", $DefaultDBtype );
603 if ( !isset( $ourdb[$conf->DBtype
] ) ) {
604 $conf->DBtype
= $DefaultDBtype;
607 $conf->DBserver
= importPost( "DBserver", "localhost" );
608 $conf->DBname
= importPost( "DBname", "wikidb" );
609 $conf->DBuser
= importPost( "DBuser", "wikiuser" );
610 $conf->DBpassword
= importPost( "DBpassword" );
611 $conf->DBpassword2
= importPost( "DBpassword2" );
612 $conf->SysopName
= importPost( "SysopName", "WikiSysop" );
613 $conf->SysopPass
= importPost( "SysopPass" );
614 $conf->SysopPass2
= importPost( "SysopPass2" );
615 $conf->RootUser
= importPost( "RootUser", "root" );
616 $conf->RootPW
= importPost( "RootPW", "" );
617 $useRoot = importCheck( 'useroot', false );
618 $conf->LanguageCode
= importPost( "LanguageCode", "en" );
620 $conf->DBprefix
= importPost( "DBprefix" );
622 importPost( "DBschema", "mysql5-binary" ),
623 importPost( "DBengine", "InnoDB" ) );
625 ## Postgres specific:
626 $conf->DBport
= importPost( "DBport", "5432" );
627 $conf->DBmwschema
= importPost( "DBmwschema", "mediawiki" );
628 $conf->DBts2schema
= importPost( "DBts2schema", "public" );
631 $conf->SQLiteDataDir
= importPost( "SQLiteDataDir", "" );
634 // We need a second field so it doesn't overwrite the MySQL one
635 $conf->DBprefix2
= importPost( "DBprefix2" );
638 // New variable in order to have a different default port number
639 $conf->DBport_db2
= importPost( "DBport_db2", "50000" );
640 $conf->DBmwschema
= importPost( "DBmwschema", "mediawiki" );
641 $conf->DBcataloged
= importPost( "DBcataloged", "cataloged" );
644 $conf->DBprefix_ora
= importPost( "DBprefix_ora" );
645 $conf->DBdefTS_ora
= importPost( "DBdefTS_ora", "USERS" );
646 $conf->DBtempTS_ora
= importPost( "DBtempTS_ora", "TEMP" );
648 $conf->ShellLocale
= getShellLocale( $conf->LanguageCode
);
650 /* Check for validity */
653 if( preg_match( '/^$|^mediawiki$|#/i', $conf->Sitename
) ) {
654 $errs["Sitename"] = "Must not be blank or \"MediaWiki\" and may not contain \"#\"";
656 if( $conf->DBuser
== "" ) {
657 $errs["DBuser"] = "Must not be blank";
659 if( ($conf->DBtype
== 'mysql') && (strlen($conf->DBuser
) > 16) ) {
660 $errs["DBuser"] = "Username too long";
662 if( $conf->DBpassword
== "" && $conf->DBtype
!= "postgres" ) {
663 $errs["DBpassword"] = "Must not be blank";
665 if( $conf->DBpassword
!= $conf->DBpassword2
) {
666 $errs["DBpassword2"] = "Passwords don't match!";
668 if( !preg_match( '/^[A-Za-z_0-9]*$/', $conf->DBprefix
) ) {
669 $errs["DBprefix"] = "Invalid table prefix";
671 untaint( $conf->DBprefix
, TC_MYSQL
);
673 if( !preg_match( '/^[A-Za-z_0-9]*$/', $conf->DBprefix_ora
) ) {
674 $errs["DBprefix_ora"] = "Invalid table prefix";
677 error_reporting( E_ALL
);
680 * Initialise $wgLang and $wgContLang to something so we can
681 * call case-folding methods. Per Brion, this is English for
682 * now, although we could be clever and initialise to the
683 * user-selected language.
685 $wgContLang = Language
::factory( 'en' );
686 $wgLang = $wgContLang;
689 * We're messing about with users, so we need a stub
690 * authentication plugin...
692 $wgAuth = new AuthPlugin();
695 * Validate the initial administrator account; username,
696 * password checks, etc.
698 if( $conf->SysopName
) {
699 # Check that the user can be created
700 $u = User
::newFromName( $conf->SysopName
);
701 if( is_a($u, 'User') ) { // please do not use instanceof, it breaks PHP4
702 # Various password checks
703 if( $conf->SysopPass
!= '' ) {
704 if( $conf->SysopPass
== $conf->SysopPass2
) {
705 if( !$u->isValidPassword( $conf->SysopPass
) ) {
706 $errs['SysopPass'] = "Bad password";
709 $errs['SysopPass2'] = "Passwords don't match";
712 $errs['SysopPass'] = "Cannot be blank";
716 $errs['SysopName'] = "Bad username";
720 $conf->License
= importRequest( "License", "none" );
721 if( $conf->License
== "gfdl1_2" ) {
722 $conf->RightsUrl
= "http://www.gnu.org/licenses/old-licenses/fdl-1.2.txt";
723 $conf->RightsText
= "GNU Free Documentation License 1.2";
724 $conf->RightsCode
= "gfdl1_2";
725 $conf->RightsIcon
= '${wgScriptPath}/skins/common/images/gnu-fdl.png';
726 } elseif( $conf->License
== "gfdl1_3" ) {
727 $conf->RightsUrl
= "http://www.gnu.org/copyleft/fdl.html";
728 $conf->RightsText
= "GNU Free Documentation License 1.3";
729 $conf->RightsCode
= "gfdl1_3";
730 $conf->RightsIcon
= '${wgScriptPath}/skins/common/images/gnu-fdl.png';
731 } elseif( $conf->License
== "none" ) {
732 $conf->RightsUrl
= $conf->RightsText
= $conf->RightsCode
= $conf->RightsIcon
= "";
733 } elseif( $conf->License
== "pd" ) {
734 $conf->RightsUrl
= "http://creativecommons.org/licenses/publicdomain/";
735 $conf->RightsText
= "Public Domain";
736 $conf->RightsCode
= "pd";
737 $conf->RightsIcon
= '${wgScriptPath}/skins/common/images/public-domain.png';
739 $conf->RightsUrl
= importRequest( "RightsUrl", "" );
740 $conf->RightsText
= importRequest( "RightsText", "" );
741 $conf->RightsCode
= importRequest( "RightsCode", "" );
742 $conf->RightsIcon
= importRequest( "RightsIcon", "" );
745 $conf->Shm
= importRequest( "Shm", "none" );
746 $conf->MCServers
= importRequest( "MCServers" );
748 /* Test memcached servers */
750 if ( $conf->Shm
== 'memcached' && $conf->MCServers
) {
751 $conf->MCServerArray
= wfArrayMap( 'trim', explode( ',', $conf->MCServers
) );
752 foreach ( $conf->MCServerArray
as $server ) {
753 $error = testMemcachedServer( $server );
755 $errs["MCServers"] = $error;
759 } else if ( $conf->Shm
== 'memcached' ) {
760 $errs["MCServers"] = "Please specify at least one server if you wish to use memcached";
763 /* default values for installation */
764 $conf->Email
= importRequest("Email", "email_enabled");
765 $conf->Emailuser
= importRequest("Emailuser", "emailuser_enabled");
766 $conf->Enotif
= importRequest("Enotif", "enotif_allpages");
767 $conf->Eauthent
= importRequest("Eauthent", "eauthent_enabled");
769 if( $conf->posted
&& ( 0 == count( $errs ) ) ) {
770 do { /* So we can 'continue' to end prematurely */
771 $conf->Root
= ($conf->RootPW
!= "");
773 /* Load up the settings and get installin' */
774 $local = writeLocalSettings( $conf );
775 echo "<li style=\"list-style: none\">\n";
776 echo "<p><b>Generating configuration file...</b></p>\n";
779 $wgCommandLineMode = false;
781 $ok = eval( $local );
782 if( $ok === false ) {
783 dieout( "<p>Errors in generated configuration; " .
784 "most likely due to a bug in the installer... " .
785 "Config file was: </p>" .
787 htmlspecialchars( $local ) .
790 $conf->DBtypename
= '';
791 foreach (array_keys($ourdb) as $db) {
792 if ($conf->DBtype
=== $db)
793 $conf->DBtypename
= $ourdb[$db]['fullname'];
795 if ( ! strlen($conf->DBtype
)) {
796 $errs["DBpicktype"] = "Please choose a database type";
800 if (! $conf->DBtypename
) {
801 $errs["DBtype"] = "Unknown database type '$conf->DBtype'";
804 print "<li>Database type: " . htmlspecialchars( $conf->DBtypename
) . "</li>\n";
805 $dbclass = 'Database'.ucfirst($conf->DBtype
);
806 $wgDBtype = $conf->DBtype
;
807 $wgDBadminuser = "root";
808 $wgDBadminpassword = $conf->RootPW
;
811 $wgDBprefix = $conf->DBprefix
;
813 ## Postgres specific:
814 $wgDBport = $conf->DBport
;
815 $wgDBmwschema = $conf->DBmwschema
;
816 $wgDBts2schema = $conf->DBts2schema
;
818 if( $conf->DBprefix2
!= '' ) {
820 $wgDBprefix = $conf->DBprefix2
;
821 } elseif( $conf->DBprefix_ora
!= '' ) {
823 $wgDBprefix = $conf->DBprefix_ora
;
827 $wgDBcataloged = $conf->DBcataloged
;
829 $wgCommandLineMode = true;
830 if (! defined ( 'STDERR' ) )
831 define( 'STDERR', fopen("php://stderr", "wb"));
832 $wgUseDatabaseMessages = false; /* FIXME: For database failure */
833 require_once( "$IP/includes/Setup.php" );
836 $wgTitle = Title
::newFromText( "Installation script" );
837 error_reporting( E_ALL
);
838 print "<li>Loading class: " . htmlspecialchars( $dbclass ) . "</li>\n";
839 if ( $conf->DBtype
!= 'sqlite' ) {
843 if( $conf->DBtype
== 'mysql' ) {
844 $mysqlOldClient = version_compare( mysql_get_client_info(), "4.1.0", "lt" );
845 if( $mysqlOldClient ) {
846 print "<li><b>PHP is linked with old MySQL client libraries. If you are
847 using a MySQL 4.1 server and have problems connecting to the database,
848 see <a href='http://dev.mysql.com/doc/mysql/en/old-client.html'
849 >http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b></li>\n";
851 $ok = true; # Let's be optimistic
853 # Decide if we're going to use the superuser or the regular database user
854 $conf->Root
= $useRoot;
856 $db_user = $conf->RootUser
;
857 $db_pass = $conf->RootPW
;
859 $db_user = $wgDBuser;
860 $db_pass = $wgDBpassword;
864 echo( "<li>Attempting to connect to database server as " . htmlspecialchars( $db_user ) . "..." );
865 $wgDatabase = Database
::newFromParams( $wgDBserver, $db_user, $db_pass, '', 1 );
867 # Check the connection and respond to errors
868 if( $wgDatabase->isOpen() ) {
871 $wgDBadminuser = $db_user;
872 $wgDBadminpassword = $db_pass;
873 echo( "success.</li>\n" );
874 $wgDatabase->ignoreErrors( true );
875 $myver = $wgDatabase->getServerVersion();
877 # There were errors, report them and back out
879 $errno = mysql_errno();
880 $errtx = htmlspecialchars( mysql_error() );
884 echo( "failed due to authentication errors. Check passwords.</li>" );
886 # The superuser details are wrong
887 $errs["RootUser"] = "Check username";
888 $errs["RootPW"] = "and password";
890 # The regular user details are wrong
891 $errs["DBuser"] = "Check username";
892 $errs["DBpassword"] = "and password";
898 # General connection problem
899 echo( htmlspecialchars( "failed with error [$errno] $errtx." ) . "</li>\n" );
900 $errs["DBserver"] = "Connection failed";
905 if( !$ok ) { continue; }
907 else if( $conf->DBtype
== 'ibm_db2' ) {
909 $db_user = $conf->RootUser
;
910 $db_pass = $conf->RootPW
;
912 $db_user = $wgDBuser;
913 $db_pass = $wgDBpassword;
916 echo( "<li>Attempting to connect to database \"" . htmlspecialchars( $wgDBname ) .
917 "\" as \"" . htmlspecialchars( $db_user ) . "\"..." );
918 $wgDatabase = $dbc->newFromParams($wgDBserver, $db_user, $db_pass, $wgDBname, 1);
919 if (!$wgDatabase->isOpen()) {
920 print " error: " . htmlspecialchars( $wgDatabase->lastError() ) . "</li>\n";
922 $myver = $wgDatabase->getServerVersion();
924 if (is_callable(array($wgDatabase, 'initial_setup'))) $wgDatabase->initial_setup('', $wgDBname);
926 } elseif ( $conf->DBtype
== 'sqlite' ) {
927 if ("$wgSQLiteDataDir" == '') {
928 $wgSQLiteDataDir = dirname($_SERVER['DOCUMENT_ROOT']).'/data';
930 echo "<li>Attempting to connect to SQLite database at \"" .
931 htmlspecialchars( $wgSQLiteDataDir ) . "\"";
932 if ( !is_dir( $wgSQLiteDataDir ) ) {
933 if ( is_writable( dirname( $wgSQLiteDataDir ) ) ) {
934 $ok = wfMkdirParents( $wgSQLiteDataDir, $wgSQLiteDataDirMode );
939 echo ": cannot create data directory</li>";
940 $errs['SQLiteDataDir'] = 'Enter a valid data directory';
944 if ( !is_writable( $wgSQLiteDataDir ) ) {
945 echo ": data directory not writable</li>";
946 $errs['SQLiteDataDir'] = 'Enter a writable data directory';
949 $dataFile = "$wgSQLiteDataDir/$wgDBname.sqlite";
950 if ( file_exists( $dataFile ) && !is_writable( $dataFile ) ) {
951 echo ": data file not writable</li>";
952 $errs['SQLiteDataDir'] = "$wgDBname.sqlite is not writable";
955 $wgDatabase = new DatabaseSqlite( false, false, false, $wgDBname, 1 );
956 if (!$wgDatabase->isOpen()) {
957 print ": error: " . htmlspecialchars( $wgDatabase->lastError() ) . "</li>\n";
958 $errs['SQLiteDataDir'] = 'Could not connect to database';
961 $myver = $wgDatabase->getServerVersion();
963 if (is_callable(array($wgDatabase, 'initial_setup'))) $wgDatabase->initial_setup('', $wgDBname);
965 } elseif ( $conf->DBtype
== 'oracle' ) {
966 echo "<li>Attempting to connect to database \"" . htmlspecialchars( $wgDBname ) ."\"</li>";
967 $wgDatabase = $dbc->newFromParams('DUMMY', $wgDBuser, $wgDBpassword, $wgDBname, 1);
968 if (!$wgDatabase->isOpen()) {
970 echo "<li>Connect failed.</li>";
972 if (ini_get('oci8.privileged_connect') === false) {
973 echo "<li>Privileged connect disabled, please set oci8.privileged_connect or run maintenance/ora/user.sql script manually prior to continuing.</li>";
976 $wgDBadminuser = $conf->RootUser
;
977 $wgDBadminpassword = $conf->RootPW
;
978 echo "<li>Attempting to create DB user.</li>";
979 $wgDatabase = $dbc->newFromParams('DUMMY', $wgDBadminuser, $wgDBadminpassword, $wgDBname, 1, 64);
980 if ($wgDatabase->isOpen()) {
981 $wgDBOracleDefTS = $conf->DBdefTS_ora
;
982 $wgDBOracleTempTS = $conf->DBtempTS_ora
;
983 dbsource( "../maintenance/ora/user.sql", $wgDatabase );
985 echo "<li>Invalid database superuser, please supply a valid superuser account.</li>";
986 echo "<li>ERR: ".print_r(oci_error(), true)."</li>";
991 echo "<li>Database superuser missing, please supply a valid superuser account.</li>";
995 $errs["RootUser"] = "Check username";
996 $errs["RootPW"] = "and password";
998 echo "<li>Attempting to connect to database with new user \"" . htmlspecialchars( $wgDBname ) ."\"</li>";
999 $wgDatabase = $dbc->newFromParams('DUMMY', $wgDBuser, $wgDBpassword, $wgDBname, 1);
1003 $myver = $wgDatabase->getServerVersion();
1005 } else { # not mysql
1006 error_reporting( E_ALL
);
1008 ## Possible connect as a superuser
1009 // Changed !mysql to postgres check since it seems to only apply to postgres
1010 if( $useRoot && $conf->DBtype
== 'postgres' ) {
1011 $wgDBsuperuser = $conf->RootUser
;
1012 echo( "<li>Attempting to connect to database \"postgres\" as superuser \"" .
1013 htmlspecialchars( $wgDBsuperuser ) . "\"..." );
1014 $wgDatabase = $dbc->newFromParams($wgDBserver, $wgDBsuperuser, $conf->RootPW
, "postgres", 1);
1015 if (!$wgDatabase->isOpen()) {
1016 print " error: " . htmlspecialchars( $wgDatabase->lastError() ) . "</li>\n";
1017 $errs["DBserver"] = "Could not connect to database as superuser";
1018 $errs["RootUser"] = "Check username";
1019 $errs["RootPW"] = "and password";
1022 $wgDatabase->initial_setup($conf->RootPW
, 'postgres');
1024 echo( "<li>Attempting to connect to database \"" . htmlspecialchars( $wgDBname ) .
1025 "\" as \"" . htmlspecialchars( $wgDBuser ) . "\"..." );
1026 $wgDatabase = $dbc->newFromParams($wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1);
1027 if (!$wgDatabase->isOpen()) {
1028 print " error: " . htmlspecialchars( $wgDatabase->lastError() ) . "</li>\n";
1030 $myver = $wgDatabase->getServerVersion();
1032 if (is_callable(array($wgDatabase, 'initial_setup'))) $wgDatabase->initial_setup('', $wgDBname);
1035 if ( !$wgDatabase->isOpen() ) {
1036 $errs["DBserver"] = "Couldn't connect to database";
1040 print "<li>Connected to " . htmlspecialchars( "{$conf->DBtype} $myver" );
1041 if ($conf->DBtype
== 'mysql') {
1042 if( version_compare( $myver, "4.0.14" ) < 0 ) {
1044 dieout( "-- mysql 4.0.14 or later required. Aborting." );
1046 $mysqlNewAuth = version_compare( $myver, "4.1.0", "ge" );
1047 if( $mysqlNewAuth && $mysqlOldClient ) {
1048 print "; <b class='error'>You are using MySQL 4.1 server, but PHP is linked
1049 to old client libraries; if you have trouble with authentication, see
1050 <a href='http://dev.mysql.com/doc/mysql/en/old-client.html'
1051 >http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b>";
1054 if( $mysqlNewAuth ) {
1055 print "; enabling MySQL 4.1/5.0 charset mode";
1057 print "; <b class='error'>MySQL 4.1/5.0 charset mode enabled,
1058 but older version detected; will likely fail.</b>";
1063 @$sel = $wgDatabase->selectDB( $wgDBname );
1065 print "<li>Database <tt>" . htmlspecialchars( $wgDBname ) . "</tt> exists</li>\n";
1067 $err = mysql_errno();
1068 $databaseSafe = htmlspecialchars( $wgDBname );
1069 if( $err == 1102 /* Invalid database name */ ) {
1070 print "<ul><li><strong>{$databaseSafe}</strong> is not a valid database name.</li></ul>";
1072 } elseif( $err != 1049 /* Database doesn't exist */ ) {
1073 print "<ul><li>Error selecting database <strong>{$databaseSafe}</strong>: {$err} ";
1074 print htmlspecialchars( mysql_error() ) . "</li></ul>";
1077 print "<li>Attempting to create database...</li>";
1078 $res = $wgDatabase->query( "CREATE DATABASE `$wgDBname`" );
1080 print "<li>Couldn't create database <tt>" .
1081 htmlspecialchars( $wgDBname ) .
1082 "</tt>; try with root access or check your username/pass.</li>\n";
1083 $errs["RootPW"] = "<- Enter";
1086 print "<li>Created database <tt>" . htmlspecialchars( $wgDBname ) . "</tt></li>\n";
1088 $wgDatabase->selectDB( $wgDBname );
1090 else if ($conf->DBtype
== 'postgres') {
1091 if( version_compare( $myver, "8.0" ) < 0 ) {
1092 dieout( "<b>Postgres 8.0 or later is required</b>. Aborting." );
1096 if( $wgDatabase->tableExists( "cur" ) ||
$wgDatabase->tableExists( "revision" ) ) {
1097 print "<li>There are already MediaWiki tables in this database. Checking if updates are needed...</li>\n";
1099 if ( $conf->DBtype
== 'mysql') {
1100 # Determine existing default character set
1101 if ( $wgDatabase->tableExists( "revision" ) ) {
1102 $revision = $wgDatabase->escapeLike( $conf->DBprefix
. 'revision' );
1103 $res = $wgDatabase->query( "SHOW TABLE STATUS LIKE '$revision'" );
1104 $row = $wgDatabase->fetchObject( $res );
1106 echo "<li>SHOW TABLE STATUS query failed!</li>\n";
1107 $existingSchema = false;
1108 $existingEngine = false;
1110 if ( preg_match( '/^latin1/', $row->Collation
) ) {
1111 $existingSchema = 'mysql4';
1112 } elseif ( preg_match( '/^utf8/', $row->Collation
) ) {
1113 $existingSchema = 'mysql5';
1114 } elseif ( preg_match( '/^binary/', $row->Collation
) ) {
1115 $existingSchema = 'mysql5-binary';
1117 $existingSchema = false;
1118 echo "<li><strong>Warning:</strong> Unrecognised existing collation</li>\n";
1120 if ( isset( $row->Engine
) ) {
1121 $existingEngine = $row->Engine
;
1123 $existingEngine = $row->Type
;
1126 if ( $existingSchema && $existingSchema != $conf->DBschema
) {
1127 $encExisting = htmlspecialchars( $existingSchema );
1128 $encRequested = htmlspecialchars( $conf->DBschema
);
1129 print "<li><strong>Warning:</strong> you requested the $encRequested schema, " .
1130 "but the existing database has the $encExisting schema. This upgrade script ".
1131 "can't convert it, so it will remain $encExisting.</li>\n";
1132 $conf->setSchema( $existingSchema, $conf->DBengine
);
1134 if ( $existingEngine && $existingEngine != $conf->DBengine
) {
1135 $encExisting = htmlspecialchars( $existingEngine );
1136 $encRequested = htmlspecialchars( $conf->DBengine
);
1137 print "<li><strong>Warning:</strong> you requested the $encRequested storage " .
1138 "engine, but the existing database uses the $encExisting engine. This upgrade " .
1139 "script can't convert it, so it will remain $encExisting.</li>\n";
1140 $conf->setSchema( $conf->DBschema
, $existingEngine );
1144 # Create user if required
1145 if ( $conf->Root
) {
1146 $conn = $dbc->newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1 );
1147 if ( $conn->isOpen() ) {
1148 print "<li>DB user account ok</li>\n";
1151 print "<li>Granting user permissions...";
1152 if( $mysqlOldClient && $mysqlNewAuth ) {
1153 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>";
1156 dbsource( "../maintenance/users.sql", $wgDatabase );
1160 print "</ul><pre>\n";
1166 print "<ul><li>Finished update checks.</li>\n";
1168 # Determine available storage engines if possible
1169 if ( $conf->DBtype
== 'mysql' && version_compare( $myver, "4.1.2", "ge" ) ) {
1170 $res = $wgDatabase->query( 'SHOW ENGINES' );
1172 while ( $row = $wgDatabase->fetchObject( $res ) ) {
1173 if ( $row->Engine
== $conf->DBengine
) {
1178 $wgDatabase->freeResult( $res );
1179 if ( !$found && $conf->DBengine
!= 'MyISAM' ) {
1180 echo "<li><strong>Warning:</strong> " . htmlspecialchars( $conf->DBengine
) .
1181 " storage engine not available, " .
1182 "using MyISAM instead</li>\n";
1183 $conf->setSchema( $conf->DBschema
, 'MyISAM' );
1187 # FIXME: Check for errors
1188 print "<li>Creating tables...";
1189 if ($conf->DBtype
== 'mysql') {
1190 dbsource( "../maintenance/tables.sql", $wgDatabase );
1191 dbsource( "../maintenance/interwiki.sql", $wgDatabase );
1192 } elseif (is_callable(array($wgDatabase, 'setup_database'))) {
1193 $wgDatabase->setup_database();
1196 $errs["DBtype"] = "Do not know how to handle database type '$conf->DBtype'";
1200 print " done.</li>\n";
1202 print "<li>Initializing statistics...</li>\n";
1203 $wgDatabase->insert( 'site_stats',
1204 array ( 'ss_row_id' => 1,
1205 'ss_total_views' => 0,
1206 'ss_total_edits' => 1, # Main page first edit
1207 'ss_good_articles' => 0, # Main page is not a good article - no internal link
1208 'ss_total_pages' => 1, # Main page
1209 'ss_users' => $conf->SysopName ?
1 : 0, # Sysop account, if created
1210 'ss_admins' => $conf->SysopName ?
1 : 0, # Sysop account, if created
1211 'ss_images' => 0 ) );
1213 # Set up the "regular user" account *if we can, and if we need to*
1214 if( $conf->Root
and $conf->DBtype
== 'mysql') {
1216 $wgDatabase2 = $dbc->newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1 );
1217 if( $wgDatabase2->isOpen() ) {
1218 # Nope, just close the test connection and continue
1219 $wgDatabase2->close();
1220 echo( "<li>User " . htmlspecialchars( $wgDBuser ) . " exists. Skipping grants.</li>\n" );
1222 # Yes, so run the grants
1223 echo( "<li>" . htmlspecialchars( "Granting user permissions to $wgDBuser on $wgDBname..." ) );
1224 dbsource( "../maintenance/users.sql", $wgDatabase );
1225 echo( "success.</li>\n" );
1229 if( $conf->SysopName
) {
1230 $u = User
::newFromName( $conf->getSysopName() );
1232 print "<li><strong class=\"error\">Warning:</strong> Skipped sysop account creation - invalid username!</li>\n";
1234 else if ( 0 == $u->idForName() ) {
1235 $u->addToDatabase();
1236 $u->setPassword( $conf->getSysopPass() );
1239 $u->addGroup( "sysop" );
1240 $u->addGroup( "bureaucrat" );
1242 print "<li>Created sysop account <tt>" .
1243 htmlspecialchars( $conf->SysopName
) . "</tt>.</li>\n";
1245 print "<li>Could not create user - already exists!</li>\n";
1248 print "<li>Skipped sysop account creation, no name given.</li>\n";
1251 $titleobj = Title
::newFromText( wfMsgNoDB( "mainpage" ) );
1252 $article = new Article( $titleobj );
1253 $newid = $article->insertOn( $wgDatabase );
1254 $revision = new Revision( array(
1256 'text' => wfMsg( 'mainpagetext' ) . "\n\n" . wfMsgNoTrans( 'mainpagedocfooter' ),
1259 'user_text' => 'MediaWiki default',
1261 $revid = $revision->insertOn( $wgDatabase );
1262 $article->updateRevisionOn( $wgDatabase, $revision );
1264 // Now that all database work is done, make sure everything is committed
1265 $wgDatabase->commit();
1267 /* Write out the config file now that all is well */
1268 print "<li style=\"list-style: none\">\n";
1269 print "<p>Creating LocalSettings.php...</p>\n\n";
1270 $localSettings = "<" . "?php$endl$local";
1271 // Fix up a common line-ending problem (due to CVS on Windows)
1272 $localSettings = str_replace( "\r\n", "\n", $localSettings );
1273 $f = fopen( "LocalSettings.php", 'xt' );
1277 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" .
1278 "<p>Here's the file that would have been written, try to paste it into place manually:</p>\n" .
1279 "<pre>\n" . htmlspecialchars( $localSettings ) . "</pre>\n" );
1281 if(fwrite( $f, $localSettings ) ) {
1284 writeSuccessMessage();
1288 dieout( "<p class='error'>An error occured while writing the config/LocalSettings.php file. Check user rights and disk space then try again.</p></li>\n" );
1295 $mainListOpened = false;
1297 if( count( $errs ) ) {
1298 /* Display options form */
1300 if( $conf->posted
) {
1301 echo "<p class='error-top'>Something's not quite right yet; make sure everything below is filled out correctly.</p>\n";
1305 <form action
="<?php echo defined('MW_INSTALL_PHP5_EXT') ? 'index.php5' : 'index.php'; ?>" name
="config" method
="post">
1307 <h2
>Site config
</h2
>
1309 <div
class="config-section">
1310 <div
class="config-input">
1311 <?php
aField( $conf, "Sitename", "Wiki name:" ); ?
>
1313 <p
class="config-desc">
1314 Preferably a short word without punctuation
, i
.e
. "Wikipedia".<br
/>
1315 Will appear
as the
namespace name
for "meta" pages
, and throughout the
interface.
1317 <div
class="config-input"><?php
aField( $conf, "EmergencyContact", "Contact e-mail:" ); ?
></div
>
1318 <p
class="config-desc">
1319 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
.
1322 <div
class="config-input">
1323 <label
class='column' for="LanguageCode">Language
:</label
>
1324 <select id
="LanguageCode" name
="LanguageCode"><?php
1325 $list = getLanguageList();
1326 foreach( $list as $code => $name ) {
1327 $sel = ($code == $conf->LanguageCode
) ?
'selected="selected"' : '';
1328 $encCode = htmlspecialchars( $code );
1329 $encName = htmlspecialchars( $name );
1330 echo "\n\t\t<option value=\"$encCode\" $sel>$encName</option>";
1336 <p
class="config-desc">
1337 Select the language
for your wiki
's interface. Some localizations aren't fully complete
. Unicode (UTF
-8) is used
for all localizations
.
1340 <div
class="config-input">
1341 <label
class='column'>Copyright
/license
:</label
>
1344 <li
><?php
aField( $conf, "License", "No license metadata", "radio", "none" ); ?
></li
>
1345 <li
><?php
aField( $conf, "License", "Public Domain", "radio", "pd" ); ?
></li
>
1346 <li
><?php
aField( $conf, "License", "GNU Free Documentation License 1.2 (Wikipedia-compatible)", "radio", "gfdl1_2" ); ?
></li
>
1347 <li
><?php
aField( $conf, "License", "GNU Free Documentation License 1.3", "radio", "gfdl1_3" ); ?
></li
>
1349 aField( $conf, "License", "A Creative Commons license - ", "radio", "cc" );
1350 $partner = "MediaWiki";
1351 $script = defined('MW_INSTALL_PHP5_EXT') ?
'index.php5' : 'index.php';
1352 $exit = urlencode( "$wgServer{$conf->ScriptPath}/config/$script?License=cc&RightsUrl=[license_url]&RightsText=[license_name]&RightsCode=[license_code]&RightsIcon=[license_button]" );
1353 $icon = urlencode( "$wgServer$wgUploadPath/wiki.png" );
1354 $ccApp = htmlspecialchars( "http://creativecommons.org/license/?partner=$partner&exit_url=$exit&partner_icon_url=$icon" );
1355 print "<a href=\"$ccApp\" target='_blank'>choose</a>";
1356 if( $conf->License
== "cc" ) { ?
>
1358 <li
><?php
aField( $conf, "RightsIcon", "<img src=\"" . htmlspecialchars( $conf->RightsIcon
) . "\" alt='(Creative Commons icon)' />", "hidden" ); ?
></li
>
1359 <li
><?php
aField( $conf, "RightsText", htmlspecialchars( $conf->RightsText
), "hidden" ); ?
></li
>
1360 <li
><?php
aField( $conf, "RightsCode", "code: " . htmlspecialchars( $conf->RightsCode
), "hidden" ); ?
></li
>
1361 <li
><?php
aField( $conf, "RightsUrl", "<a href=\"" . htmlspecialchars( $conf->RightsUrl
) . "\">" . htmlspecialchars( $conf->RightsUrl
) . "</a>", "hidden" ); ?
></li
>
1367 <p
class="config-desc">
1368 A notice
, icon
, and machine
-readable copyright metadata will be displayed
for the license you pick
.
1372 <div
class="config-input">
1373 <?php
aField( $conf, "SysopName", "Admin username:" ) ?
>
1375 <div
class="config-input">
1376 <?php
aField( $conf, "SysopPass", "Password:", "password" ) ?
>
1378 <div
class="config-input">
1379 <?php
aField( $conf, "SysopPass2", "Password confirm:", "password" ) ?
>
1381 <p
class="config-desc">
1382 An admin can lock
/delete pages
, block users from editing
, and do other maintenance tasks
.<br
/>
1383 A
new account will be added only when creating a
new wiki database
.
1385 The password cannot be the same
as the username
.
1388 <div
class="config-input">
1389 <label
class='column'>Object caching
:</label
>
1392 <li
><?php
aField( $conf, "Shm", "No caching", "radio", "none" ); ?
></li
>
1394 if ( $conf->turck
) {
1396 aField( $conf, "Shm", "Turck MMCache", "radio", "turck" );
1399 if( $conf->xcache
) {
1401 aField( $conf, 'Shm', 'XCache', 'radio', 'xcache' );
1406 aField( $conf, "Shm", "APC", "radio", "apc" );
1409 if ( $conf->eaccel
) {
1411 aField( $conf, "Shm", "eAccelerator", "radio", "eaccel" );
1416 aField( $conf, "Shm", "DBA (not recommended)", "radio", "dba" );
1420 <li
><?php
aField( $conf, "Shm", "Memcached", "radio", "memcached" ); ?
></li
>
1422 <div style
="clear:left"><?php
aField( $conf, "MCServers", "Memcached servers:", "text" ) ?
></div
>
1424 <p
class="config-desc">
1425 An
object caching system such
as memcached will provide a significant performance boost
,
1426 but needs to be installed
. Provide the server addresses
and ports in a comma
-separated
list.
1428 MediaWiki can also detect
and support eAccelerator
, Turck MMCache
, APC
, and XCache
, but
1429 these should not be used
if the wiki will be running on multiple application servers
.
1431 DBA (Berkeley
-style DB
) is generally slower than using no cache at all
, and is only
1432 recommended
for testing
.
1436 <h2
>E
-mail
, e
-mail notification
and authentication setup
</h2
>
1438 <div
class="config-section">
1439 <div
class="config-input">
1440 <label
class='column'>E
-mail
features (global):</label
>
1442 <li
><?php
aField( $conf, "Email", "Enabled", "radio", "email_enabled" ); ?
></li
>
1443 <li
><?php
aField( $conf, "Email", "Disabled", "radio", "email_disabled" ); ?
></li
>
1446 <p
class="config-desc">
1447 Use this to disable all e
-mail
functions (password reminders
, user
-to
-user e
-mail
, and e
-mail notifications
)
1448 if sending mail doesn
't work on your server.
1451 <div class="config-input">
1452 <label class='column
'>User-to-user e-mail:</label>
1454 <li><?php aField( $conf, "Emailuser", "Enabled", "radio", "emailuser_enabled" ); ?></li>
1455 <li><?php aField( $conf, "Emailuser", "Disabled", "radio", "emailuser_disabled" ); ?></li>
1458 <p class="config-desc">
1459 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.
1461 <div class="config-input">
1462 <label class='column
'>E-mail notification about changes:</label>
1464 <li><?php aField( $conf, "Enotif", "Disabled", "radio", "enotif_disabled" ); ?></li>
1465 <li><?php aField( $conf, "Enotif", "Enabled for changes to user discussion pages only", "radio", "enotif_usertalk" ); ?></li>
1466 <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>
1469 <div class="config-desc">
1471 For this feature to work, an e-mail address must be present for the user account, and the notification
1472 options in the user's preferences must be enabled
. Also note the
1473 authentication option below
. When testing the feature
, keep in mind that your own changes will never trigger notifications to be sent to yourself
.</p
>
1475 <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
>
1478 <div
class="config-input">
1479 <label
class='column'>E
-mail address authentication
:</label
>
1481 <li
><?php
aField( $conf, "Eauthent", "Disabled", "radio", "eauthent_disabled" ); ?
></li
>
1482 <li
><?php
aField( $conf, "Eauthent", "Enabled", "radio", "eauthent_enabled" ); ?
></li
>
1485 <div
class="config-desc">
1486 <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
1487 change notification mails
. Setting this option is
<b
>recommended
</b
> for public wikis because of potential abuse of the e
-mail features above
.</p
>
1492 <h2
>Database config
</h2
>
1494 <div
class="config-section">
1495 <div
class="config-input">
1496 <label
class='column'>Database type
:</label
>
1498 if (isset($errs['DBpicktype'])) {
1499 print "\t<span class='error'>" . htmlspecialchars( $errs['DBpicktype'] ) . "</span>\n";
1502 <ul
class='plain'><?php
1503 database_picker($conf);
1507 <div
class="config-input" style
="clear:left">
1508 <?php
aField( $conf, "DBserver", "Database host:" ); ?
>
1510 <p
class="config-desc">
1511 If your database server isn
't on your web server, enter the name or IP address here.
1514 <div class="config-input"><?php aField( $conf, "DBname", "Database name:" ); ?></div>
1515 <div class="config-input"><?php aField( $conf, "DBuser", "DB username:" ); ?></div>
1516 <div class="config-input"><?php aField( $conf, "DBpassword", "DB password:", "password" ); ?></div>
1517 <div class="config-input"><?php aField( $conf, "DBpassword2", "DB password confirm:", "password" ); ?></div>
1518 <p class="config-desc">
1519 If you only have a single user account and database available,
1520 enter those here. If you have database root access (see below)
1521 you can specify new accounts/databases to be created. This account
1522 will not be created if it pre-exists. If this is the case, ensure that it
1523 has SELECT, INSERT, UPDATE, and DELETE permissions on the MediaWiki database.
1526 <div class="config-input">
1527 <label class="column">Superuser account:</label>
1528 <input type="checkbox" name="useroot" id="useroot" <?php if( $useRoot ) { ?>checked="checked" <?php } ?> />
1529 <label for="useroot">Use superuser account</label>
1531 <div class="config-input"><?php aField( $conf, "RootUser", "Superuser name:", "text" ); ?></div>
1532 <div class="config-input"><?php aField( $conf, "RootPW", "Superuser password:", "password" ); ?></div>
1534 <p class="config-desc">
1535 If the database user specified above does not exist, or does not have access to create
1536 the database (if needed) or tables within it, please check the box and provide details
1537 of a superuser account, such as <strong>root</strong>, which does.
1540 <?php database_switcher('mysql
'); ?>
1541 <div class="config-input"><?php aField( $conf, "DBprefix", "Database table prefix:" ); ?></div>
1542 <div class="config-desc">
1543 <p>If you need to share one database between multiple wikis, or
1544 between MediaWiki and another web application, you may choose to
1545 add a prefix to all the table names to avoid conflicts.</p>
1547 <p>Avoid exotic characters; something like <tt>mw_</tt> is good.</p>
1550 <div class="config-input"><label class="column">Storage Engine</label>
1551 <div>Select one:</div>
1553 <li><?php aField( $conf, "DBengine", "InnoDB", "radio", "InnoDB" ); ?></li>
1554 <li><?php aField( $conf, "DBengine", "MyISAM", "radio", "MyISAM" ); ?></li>
1557 <p class="config-desc">
1558 InnoDB is best for public web installations, since it has good concurrency
1559 support. MyISAM may be faster in single-user installations. MyISAM databases
1560 tend to get corrupted more often than InnoDB databases.
1562 <div class="config-input"><label class="column">Database character set</label>
1563 <div>Select one:</div>
1565 <li><?php aField( $conf, "DBschema", "MySQL 4.1/5.0 binary", "radio", "mysql5-binary" ); ?></li>
1566 <li><?php aField( $conf, "DBschema", "MySQL 4.1/5.0 UTF-8", "radio", "mysql5" ); ?></li>
1567 <li><?php aField( $conf, "DBschema", "MySQL 4.0 backwards-compatible UTF-8", "radio", "mysql4" ); ?></li>
1570 <p class="config-desc">
1571 This option is ignored on upgrade, the same character set will be kept.
1573 <b>WARNING:</b> If you use <b>backwards-compatible UTF-8</b> on MySQL 4.1+, and subsequently back up the database with <tt>mysqldump</tt>, it may destroy all non-ASCII characters, irreversibly corrupting your backups!.
1575 In <b>binary mode</b>, MediaWiki stores UTF-8 text to the database in binary fields. This is more efficient than MySQL's UTF
-8 mode
, and allows you to
use the full range of Unicode characters
. In
<b
>UTF
-8 mode
</b
>, MySQL will know what character set your data is in
, and can present
and convert it appropriately
, but it won
't let you store characters above the <a target="_blank" href="http://en.wikipedia.org/wiki/Mapping_of_Unicode_character_planes">Basic Multilingual Plane</a>.
1579 <?php database_switcher('postgres
'); ?>
1580 <div class="config-input"><?php aField( $conf, "DBport", "Database port:" ); ?></div>
1581 <div class="config-input"><?php aField( $conf, "DBmwschema", "Schema for mediawiki:" ); ?></div>
1582 <div class="config-input"><?php aField( $conf, "DBts2schema", "Schema for tsearch2:" ); ?></div>
1583 <div class="config-desc">
1584 <p>The username specified above (at "DB username") will have its search path set to the above schemas,
1585 so it is recommended that you create a new user. The above schemas are generally correct:
1586 only change them if you are sure you need to.</p>
1590 <?php database_switcher('sqlite
'); ?>
1591 <div class="config-desc">
1592 <b>NOTE:</b> SQLite only uses the <i>Database name</i> setting above, the user, password and root settings are ignored.
1594 <div class="config-input"><?php
1595 aField( $conf, "SQLiteDataDir", "SQLite data directory:" );
1597 <div class="config-desc">
1598 <p>SQLite stores table data into files in the filesystem.
1599 If you do not provide an explicit path, a "data" directory in
1600 the parent of your document root will be used.</p>
1602 <p>This directory must exist and be writable by the web server.</p>
1606 <?php database_switcher('mssql
'); ?>
1607 <div class="config-input"><?php
1608 aField( $conf, "DBprefix2", "Database table prefix:" );
1610 <div class="config-desc">
1611 <p>If you need to share one database between multiple wikis, or
1612 between MediaWiki and another web application, you may choose to
1613 add a prefix to all the table names to avoid conflicts.</p>
1615 <p>Avoid exotic characters; something like <tt>mw_</tt> is good.</p>
1619 <?php database_switcher('ibm_db2
'); ?>
1620 <div class="config-input"><?php
1621 aField( $conf, "DBport_db2", "Database port:" );
1623 <div class="config-input"><?php
1624 aField( $conf, "DBmwschema", "Schema for mediawiki:" );
1626 <div>Select one:</div>
1628 <li><?php aField( $conf, "DBcataloged", "Cataloged (DB2 installed locally)", "radio", "cataloged" ); ?></li>
1629 <li><?php aField( $conf, "DBcataloged", "Uncataloged (remote DB2 through ODBC)", "radio", "uncataloged" ); ?></li>
1631 <div class="config-desc">
1632 <p>If you need to share one database between multiple wikis, or
1633 between MediaWiki and another web application, you may specify
1634 a different schema to avoid conflicts.</p>
1638 <?php database_switcher('oracle
'); ?>
1639 <div class="config-input"><?php aField( $conf, "DBprefix_ora", "Database table prefix:" ); ?></div>
1640 <div class="config-desc">
1641 <p>If you need to share one database between multiple wikis, or
1642 between MediaWiki and another web application, you may choose to
1643 add a prefix to all the table names to avoid conflicts.</p>
1645 <p>Avoid exotic characters; something like <tt>mw_</tt> is good.</p>
1647 <div class="config-input"><?php aField( $conf, "DBdefTS_ora", "Default tablespace:" ); ?></div>
1648 <div class="config-input"><?php aField( $conf, "DBtempTS_ora", "Temporary tablespace:" ); ?></div>
1651 <div class="config-input" style="padding:2em 0 3em">
1652 <label class='column
'> </label>
1653 <input type="submit" value="Install MediaWiki!" class="btn-install" />
1657 <script type="text/javascript">
1658 window.onload = toggleDBarea( <?php echo Xml::encodeJsVar( $conf->DBtype ); ?>,
1660 ## If they passed in a root user name, don't populate it on page load
1661 echo strlen(importPost('RootUser', '')) ?
0 : 1;
1667 /* -------------------------------------------------------------------------------------- */
1668 function writeSuccessMessage() {
1669 $script = defined('MW_INSTALL_PHP5_EXT') ?
'index.php5' : 'index.php';
1670 if ( wfIniGetBool( 'safe_mode' ) && !ini_get( 'open_basedir' ) ) {
1672 <div class="success-box">
1673 <p>Installation successful!</p>
1674 <p>To complete the installation, please do the following:
1676 <li>Download config/LocalSettings.php with your FTP client or file manager</li>
1677 <li>Upload it to the parent directory</li>
1678 <li>Delete config/LocalSettings.php</li>
1679 <li>Start using <a href='../$script'>your wiki</a>!
1681 <p>If you are in a shared hosting environment, do <strong>not</strong> just move LocalSettings.php
1682 remotely. LocalSettings.php is currently owned by the user your webserver is running under,
1683 which means that anyone on the same server can read your database password! Downloading
1684 it and uploading it again will hopefully change the ownership to a user ID specific to you.</p>
1689 <div class="success-box">
1691 <span class="success-message">Installation successful!</span>
1692 Move the <tt>config/LocalSettings.php</tt> file to the parent directory, then follow
1693 <a href="../$script"> this link</a> to your wiki.</p>
1694 <p>You should change file permissions for <tt>LocalSettings.php</tt> as required to
1695 prevent other users on the server reading passwords and altering configuration data.</p>
1702 function escapePhpString( $string ) {
1703 if ( is_array( $string ) ||
is_object( $string ) ) {
1706 return strtr( $string,
1717 function writeLocalSettings( $conf ) {
1718 $conf->PasswordSender
= $conf->EmergencyContact
;
1719 $magic = ($conf->ImageMagick ?
"" : "# ");
1720 $convert = ($conf->ImageMagick ?
$conf->ImageMagick
: "/usr/bin/convert" );
1721 $rights = ($conf->RightsUrl
) ?
"" : "# ";
1722 $hashedUploads = $conf->safeMode ?
'' : '# ';
1724 if ( $conf->ShellLocale
) {
1728 $conf->ShellLocale
= 'en_US.UTF-8';
1731 switch ( $conf->Shm
) {
1733 $cacheType = 'CACHE_MEMCACHED';
1734 $mcservers = var_export( $conf->MCServerArray
, true );
1740 $cacheType = 'CACHE_ACCEL';
1741 $mcservers = 'array()';
1744 $cacheType = 'CACHE_DBA';
1745 $mcservers = 'array()';
1748 $cacheType = 'CACHE_NONE';
1749 $mcservers = 'array()';
1752 if ( $conf->Email
== 'email_enabled' ) {
1753 $enableemail = 'true';
1754 $enableuseremail = ( $conf->Emailuser
== 'emailuser_enabled' ) ?
'true' : 'false' ;
1755 $eauthent = ( $conf->Eauthent
== 'eauthent_enabled' ) ?
'true' : 'false' ;
1756 switch ( $conf->Enotif
) {
1757 case 'enotif_usertalk':
1758 $enotifusertalk = 'true';
1759 $enotifwatchlist = 'false';
1761 case 'enotif_allpages':
1762 $enotifusertalk = 'true';
1763 $enotifwatchlist = 'true';
1766 $enotifusertalk = 'false';
1767 $enotifwatchlist = 'false';
1770 $enableuseremail = 'false';
1771 $enableemail = 'false';
1772 $eauthent = 'false';
1773 $enotifusertalk = 'false';
1774 $enotifwatchlist = 'false';
1777 $file = @fopen
( "/dev/urandom", "r" );
1779 $secretKey = bin2hex( fread( $file, 32 ) );
1783 for ( $i=0; $i<8; $i++
) {
1784 $secretKey .= dechex(mt_rand(0, 0x7fffffff));
1786 print "<li>Warning: \$wgSecretKey key is insecure, generated with mt_rand(). Consider changing it manually.</li>\n";
1789 # Add slashes to strings for double quoting
1790 $slconf = wfArrayMap( "escapePhpString", get_object_vars( $conf ) );
1791 if( $conf->License
== 'gfdl1_2' ||
$conf->License
== 'pd' ||
$conf->License
== 'gfdl1_3' ) {
1792 # Needs literal string interpolation for the current style path
1793 $slconf['RightsIcon'] = $conf->RightsIcon
;
1796 if( $conf->DBtype
== 'mysql' ) {
1798 "# MySQL specific settings
1799 \$wgDBprefix = \"{$slconf['DBprefix']}\";
1801 # MySQL table options to use during installation or update
1802 \$wgDBTableOptions = \"{$slconf['DBTableOptions']}\";
1804 # Experimental charset support for MySQL 4.1/5.0.
1805 \$wgDBmysql5 = {$conf->DBmysql5};";
1806 } elseif( $conf->DBtype
== 'postgres' ) {
1808 "# Postgres specific settings
1809 \$wgDBport = \"{$slconf['DBport']}\";
1810 \$wgDBmwschema = \"{$slconf['DBmwschema']}\";
1811 \$wgDBts2schema = \"{$slconf['DBts2schema']}\";";
1812 } elseif( $conf->DBtype
== 'sqlite' ) {
1814 "# SQLite-specific settings
1815 \$wgSQLiteDataDir = \"{$slconf['SQLiteDataDir']}\";";
1816 } elseif( $conf->DBtype
== 'mssql' ) {
1818 "# MSSQL specific settings
1819 \$wgDBprefix = \"{$slconf['DBprefix2']}\";";
1820 } elseif( $conf->DBtype
== 'ibm_db2' ) {
1822 "# DB2 specific settings
1823 \$wgDBport_db2 = \"{$slconf['DBport_db2']}\";
1824 \$wgDBmwschema = \"{$slconf['DBmwschema']}\";
1825 \$wgDBcataloged = \"{$slconf['DBcataloged']}\";";
1826 } elseif( $conf->DBtype
== 'oracle' ) {
1828 "# Oracle specific settings
1829 \$wgDBprefix = \"{$slconf['DBprefix']}\";";
1837 # This file was automatically generated by the MediaWiki installer.
1838 # If you make manual changes, please keep track in case you need to
1839 # recreate them later.
1841 # See includes/DefaultSettings.php for all configurable settings
1842 # and their default values, but don't forget to make changes in _this_
1845 # Further documentation for configuration settings may be found at:
1846 # http://www.mediawiki.org/wiki/Manual:Configuration_settings
1848 # If you customize your file layout, set \$IP to the directory that contains
1849 # the other MediaWiki files. It will be used as a base to locate files.
1850 if( defined( 'MW_INSTALL_PATH' ) ) {
1851 \$IP = MW_INSTALL_PATH;
1853 \$IP = dirname( __FILE__ );
1856 \$path = array( \$IP, \"\$IP/includes\", \"\$IP/languages\" );
1857 set_include_path( implode( PATH_SEPARATOR, \$path ) . PATH_SEPARATOR . get_include_path() );
1859 require_once( \"\$IP/includes/DefaultSettings.php\" );
1861 # If PHP's memory limit is very low, some operations may fail.
1862 " . ($conf->raiseMemory ?
'' : '# ' ) . "ini_set( 'memory_limit', '20M' );" . "
1864 if ( \$wgCommandLineMode ) {
1865 if ( isset( \$_SERVER ) && array_key_exists( 'REQUEST_METHOD', \$_SERVER ) ) {
1866 die( \"This script must be run from the command line\\n\" );
1869 ## Uncomment this to disable output compression
1870 # \$wgDisableOutputCompression = true;
1872 \$wgSitename = \"{$slconf['Sitename']}\";
1874 ## The URL base path to the directory containing the wiki;
1875 ## defaults for all runtime URL paths are based off of this.
1876 ## For more information on customizing the URLs please see:
1877 ## http://www.mediawiki.org/wiki/Manual:Short_URL
1878 \$wgScriptPath = \"{$slconf['ScriptPath']}\";
1879 \$wgScriptExtension = \"{$slconf['ScriptExtension']}\";
1881 ## UPO means: this is also a user preference option
1883 \$wgEnableEmail = $enableemail;
1884 \$wgEnableUserEmail = $enableuseremail; # UPO
1886 \$wgEmergencyContact = \"{$slconf['EmergencyContact']}\";
1887 \$wgPasswordSender = \"{$slconf['PasswordSender']}\";
1889 \$wgEnotifUserTalk = $enotifusertalk; # UPO
1890 \$wgEnotifWatchlist = $enotifwatchlist; # UPO
1891 \$wgEmailAuthentication = $eauthent;
1893 ## Database settings
1894 \$wgDBtype = \"{$slconf['DBtype']}\";
1895 \$wgDBserver = \"{$slconf['DBserver']}\";
1896 \$wgDBname = \"{$slconf['DBname']}\";
1897 \$wgDBuser = \"{$slconf['DBuser']}\";
1898 \$wgDBpassword = \"{$slconf['DBpassword']}\";
1902 ## Shared memory settings
1903 \$wgMainCacheType = $cacheType;
1904 \$wgMemCachedServers = $mcservers;
1906 ## To enable image uploads, make sure the 'images' directory
1907 ## is writable, then set this to true:
1908 \$wgEnableUploads = false;
1909 {$magic}\$wgUseImageMagick = true;
1910 {$magic}\$wgImageMagickConvertCommand = \"{$convert}\";
1912 ## If you use ImageMagick (or any other shell command) on a
1913 ## Linux server, this will need to be set to the name of an
1914 ## available UTF-8 locale
1915 {$locale}\$wgShellLocale = \"{$slconf['ShellLocale']}\";
1917 ## If you want to use image uploads under safe mode,
1918 ## create the directories images/archive, images/thumb and
1919 ## images/temp, and make them all writable. Then uncomment
1920 ## this, if it's not already uncommented:
1921 {$hashedUploads}\$wgHashedUploadDirectory = false;
1923 ## If you have the appropriate support software installed
1924 ## you can enable inline LaTeX equations:
1927 \$wgLocalInterwiki = strtolower( \$wgSitename );
1929 \$wgLanguageCode = \"{$slconf['LanguageCode']}\";
1931 \$wgSecretKey = \"$secretKey\";
1933 ## Default skin: you can change the default skin. Use the internal symbolic
1934 ## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook':
1935 \$wgDefaultSkin = 'monobook';
1937 ## For attaching licensing metadata to pages, and displaying an
1938 ## appropriate copyright notice / icon. GNU Free Documentation
1939 ## License and Creative Commons licenses are supported so far.
1940 {$rights}\$wgEnableCreativeCommonsRdf = true;
1941 \$wgRightsPage = \"\"; # Set to the title of a wiki page that describes your license/copyright
1942 \$wgRightsUrl = \"{$slconf['RightsUrl']}\";
1943 \$wgRightsText = \"{$slconf['RightsText']}\";
1944 \$wgRightsIcon = \"{$slconf['RightsIcon']}\";
1945 # \$wgRightsCode = \"{$slconf['RightsCode']}\"; # Not yet used
1947 \$wgDiff3 = \"{$slconf['diff3']}\";
1949 # When you make changes to this configuration file, this will make
1950 # sure that cached pages are cleared.
1951 \$wgCacheEpoch = max( \$wgCacheEpoch, gmdate( 'YmdHis', @filemtime( __FILE__ ) ) );
1952 "; ## End of setting the $localsettings string
1954 // Keep things in Unix line endings internally;
1955 // the system will write out as local text type.
1956 return str_replace( "\r\n", "\n", $localsettings );
1959 function dieout( $text ) {
1960 global $mainListOpened;
1961 if( $mainListOpened ) echo( "</ul>" );
1962 if( $text != '' && substr( $text, 0, 2 ) != '<p' && substr( $text, 0, 2 ) != '<h' ){
1963 echo "<p>$text</p>\n";
1967 die( "\n\n</div>\n</div>\n</div>\n</div>\n</body>\n</html>" );
1970 function importVar( &$var, $name, $default = "" ) {
1971 if( isset( $var[$name] ) ) {
1972 $retval = $var[$name];
1973 if ( get_magic_quotes_gpc() ) {
1974 $retval = stripslashes( $retval );
1983 function importPost( $name, $default = "" ) {
1984 return importVar( $_POST, $name, $default );
1987 function importCheck( $name ) {
1988 return isset( $_POST[$name] );
1991 function importRequest( $name, $default = "" ) {
1992 return importVar( $_REQUEST, $name, $default );
1995 function aField( &$conf, $field, $text, $type = "text", $value = "", $onclick = '' ) {
1996 static $radioCount = 0;
1998 $xtype = "type=\"$type\"";
2004 $nolabel = ($type == "radio") ||
($type == "hidden");
2006 if ($type == 'radio')
2007 $id .= $radioCount++
;
2010 echo "<label class='column' for=\"$id\">$text</label>";
2013 if( $type == "radio" && $value == $conf->$field ) {
2014 $checked = "checked='checked'";
2018 echo "<input $xtype name=\"$field\" id=\"$id\" class=\"iput-$type\" $checked ";
2020 echo " onclick='toggleDBarea(\"$value\",1)' " ;
2023 if( $type == "radio" ) {
2024 echo htmlspecialchars( $value );
2026 echo htmlspecialchars( $conf->$field );
2032 echo "<label for=\"$id\">$text</label>";
2036 if(isset($errs[$field])) {
2037 echo "<span class='error'>" . htmlspecialchars( $errs[$field] ) . "</span>\n";
2041 function getLanguageList() {
2042 global $wgLanguageNames, $IP;
2043 if( !isset( $wgLanguageNames ) ) {
2044 require_once( "$IP/languages/Names.php" );
2049 $d = opendir( "../languages/messages" );
2050 /* In case we are called from the root directory */
2052 $d = opendir( "languages/messages");
2053 while( false !== ($f = readdir( $d ) ) ) {
2055 if( preg_match( '/Messages([A-Z][a-z_]+)\.php$/', $f, $m ) ) {
2056 $code = str_replace( '_', '-', strtolower( $m[1] ) );
2057 if( isset( $wgLanguageNames[$code] ) ) {
2058 $name = $code . ' - ' . $wgLanguageNames[$code];
2062 $codes[$code] = $name;
2070 #Check for location of an executable
2071 # @param string $loc single location to check
2072 # @param array $names filenames to check for.
2073 # @param mixed $versioninfo array of details to use when checking version, use false for no version checking
2074 function locate_executable($loc, $names, $versioninfo = false) {
2075 if (!is_array($names))
2076 $names = array($names);
2078 foreach ($names as $name) {
2079 $command = "$loc".DIRECTORY_SEPARATOR
."$name";
2080 if (@file_exists
($command)) {
2084 $file = str_replace('$1', $command, $versioninfo[0]);
2085 if (strstr(`
$file`
, $versioninfo[1]) !== false)
2092 # Test a memcached server
2093 function testMemcachedServer( $server ) {
2094 $hostport = explode(":", $server);
2097 if ( !function_exists( 'fsockopen' ) ) {
2098 $errstr = "Can't connect to memcached, fsockopen() not present";
2100 if ( !$errstr && count( $hostport ) != 2 ) {
2101 $errstr = 'Please specify host and port';
2104 list( $host, $port ) = $hostport;
2108 $fp = @fsockopen
( $host, $port, $errno, $fsockerr, 1.0 );
2109 if ( $fp === false ) {
2110 $errstr = "Cannot connect to memcached on $host:$port : $fsockerr";
2114 $command = "version\r\n";
2115 $bytes = fwrite( $fp, $command );
2116 if ( $bytes != strlen( $command ) ) {
2117 $errstr = "Cannot write to memcached socket on $host:$port";
2121 $expected = "VERSION ";
2122 $response = fread( $fp, strlen( $expected ) );
2123 if ( $response != $expected ) {
2124 $errstr = "Didn't get correct memcached response from $host:$port";
2131 echo "<li>Connected to memcached on " . htmlspecialchars( "$host:$port" ) ." successfully</li>";
2136 function database_picker($conf) {
2139 foreach(array_keys($ourdb) as $db) {
2140 if ($ourdb[$db]['havedriver']) {
2142 aField( $conf, "DBtype", $ourdb[$db]['fullname'], 'radio', $db, 'onclick');
2149 function database_switcher($db) {
2151 $color = $ourdb[$db]['bgcolor'];
2152 $full = $ourdb[$db]['fullname'];
2153 print "<fieldset id='$db'><legend>$full specific options</legend>\n";
2156 function printListItem( $item ) {
2157 print "<li>$item</li>";
2160 # Determine a suitable value for $wgShellLocale
2161 function getShellLocale( $wikiLang ) {
2162 # Give up now if we're in safe mode or open_basedir
2163 # It's theoretically possible but tricky to work with
2164 if ( wfIniGetBool( "safe_mode" ) ||
ini_get( 'open_basedir' ) ) {
2168 $os = php_uname( 's' );
2169 $supported = array( 'Linux', 'SunOS', 'HP-UX' ); # Tested these
2170 if ( !in_array( $os, $supported ) ) {
2174 # Get a list of available locales
2175 $lines = $ret = false;
2176 exec( '/usr/bin/locale -a', $lines, $ret );
2181 $lines = wfArrayMap( 'trim', $lines );
2182 $candidatesByLocale = array();
2183 $candidatesByLang = array();
2184 foreach ( $lines as $line ) {
2185 if ( $line === '' ) {
2188 if ( !preg_match( '/^([a-zA-Z]+)(_[a-zA-Z]+|)\.(utf8|UTF-8)(@[a-zA-Z_]*|)$/i', $line, $m ) ) {
2191 list( $all, $lang, $territory, $charset, $modifier ) = $m;
2192 $candidatesByLocale[$m[0]] = $m;
2193 $candidatesByLang[$lang][] = $m;
2196 # Try the current value of LANG
2197 if ( isset( $candidatesByLocale[ getenv( 'LANG' ) ] ) ) {
2198 return getenv( 'LANG' );
2201 # Try the most common ones
2202 $commonLocales = array( 'en_US.UTF-8', 'en_US.utf8', 'de_DE.UTF-8', 'de_DE.utf8' );
2203 foreach ( $commonLocales as $commonLocale ) {
2204 if ( isset( $candidatesByLocale[$commonLocale] ) ) {
2205 return $commonLocale;
2209 # Is there an available locale in the Wiki's language?
2210 if ( isset( $candidatesByLang[$wikiLang] ) ) {
2211 $m = reset( $candidatesByLang[$wikiLang] );
2215 # Are there any at all?
2216 if ( count( $candidatesByLocale ) ) {
2217 $m = reset( $candidatesByLocale );
2225 function wfArrayMap( $function, $input ) {
2226 $ret = array_map( $function, $input );
2227 foreach ( $ret as $key => $value ) {
2228 $taint = istainted( $input[$key] );
2230 taint( $ret[$key], $taint );
2238 <div
class="license">
2240 <p
>This program is free software
; you can redistribute it
and/or modify
2241 it under the terms of the GNU General
Public License
as published by
2242 the Free Software Foundation
; either version
2 of the License
, or
2243 (at your option
) any later version
.</p
>
2245 <p
>This program is distributed in the hope that it will be useful
,
2246 but WITHOUT ANY WARRANTY
; without even the implied warranty of
2247 MERCHANTABILITY
or FITNESS
FOR A PARTICULAR PURPOSE
. See the
2248 GNU General
Public License
for more details
.</p
>
2250 <p
>You should have received
<a href
="../COPYING">a copy of the GNU General
Public License
</a
>
2251 along with this program
; if not
, write to the Free Software
2252 Foundation
, Inc
., 51 Franklin Street
, Fifth Floor
, Boston
, MA
02110-1301, USA
.
2253 or <a href
="http://www.gnu.org/copyleft/gpl.html">read it online
</a
></p
>
2259 <div id
="column-one">
2260 <div
class="portlet" id
="p-logo">
2261 <a style
="background-image: url(../skins/common/images/mediawiki.png);"
2263 title
="Main Page"></a
>
2265 <script type
="text/javascript"> if (window
.isMSIE55
) fixalpha(); </script
>
2266 <div
class='portlet'><div
class='pBody'>
2268 <li
><a href
="../README">Readme
</a
></li
>
2269 <li
><a href
="../RELEASE-NOTES">Release notes
</a
></li
>
2270 <li
><a href
="../docs/">Documentation
</a
></li
>
2271 <li
><a href
="http://www.mediawiki.org/wiki/Help:Contents">User
's Guide</a></li>
2272 <li><a href="http://www.mediawiki.org/wiki/Manual:Contents">Administrator's Guide
</a
></li
>
2273 <li
><a href
="http://www.mediawiki.org/wiki/Manual:FAQ">FAQ
</a
></li
>
2275 <p style
="font-size:90%;margin-top:1em">MediaWiki is Copyright ©
2001-2009 by Magnus Manske
, Brion Vibber
,
2276 Lee Daniel Crocker
, Tim Starling
, Erik Möller
, Gabriel Wicke
, Æ
var Arnfjörð Bjarmason
, Niklas Laxström
,
2277 Domas Mituzas
, Rob Church
, Yuri Astrakhan
, Aryeh Gregor
, Aaron Schulz
and others
.</p
>