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';
91 <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
92 <html xmlns
="http://www.w3.org/1999/xhtml" xml
:lang
="en" lang
="en" dir
="ltr">
94 <meta http
-equiv
="Content-type" content
="text/html; charset=utf-8" />
95 <meta name
="robots" content
="noindex,nofollow"/>
96 <title
>MediaWiki
<?php
echo htmlspecialchars( $wgVersion ); ?
> Installation
</title
>
97 <style type
="text/css">
99 @import
"../skins/monobook/main.css";
103 margin
: 1em
0 1em
2.5em
;
110 .config
-section label
.column
{
122 zoom
: 100%
; /* IE hack */
125 .config
-section
.config
-desc
{
127 margin
: 0 0 2em
18em
;
132 .iput
-text
, .iput
-password
{
139 background
-color
: #fff;
147 background
-color
: #FFF0F0;
148 border
: 2px solid red
;
156 list-style
-type
: none
;
157 list-style
-image
: none
;
174 span
.success
-message
{
184 <script type
="text/javascript">
187 <?php
foreach (array_keys($ourdb) as $db) {
188 echo "\n var i = document.getElementById('$db'); if (i) i.style.display='none';";
193 function toggleDBarea(id
,defaultroot
) {
195 var dbarea
= document
.getElementById(id
);
196 if (dbarea
) dbarea
.style
.display
= (dbarea
.style
.display
== 'none') ?
'block' : 'none';
197 var db
= document
.getElementById('RootUser');
199 <?php
foreach (array_keys($ourdb) as $db) {
200 echo " if (id == '$db') { db.value = '".$ourdb[$db]['rootuser']."';}\n";
209 <div id
="globalWrapper">
210 <div id
="column-content">
212 <div id
="bodyContent">
214 <h1
>MediaWiki
<?php
print htmlspecialchars( $wgVersion ) ?
> Installation
</h1
>
217 $mainListOpened = false; # Is the main list (environement checking) opend ? Used by dieout
219 /* Check for existing configurations and bug out! */
221 if( file_exists( "../LocalSettings.php" ) ) {
222 $script = defined('MW_INSTALL_PHP5_EXT') ?
'index.php5' : 'index.php';
223 dieout( "<p><strong>Setup has completed, <a href='../$script'>your wiki</a> is configured.</strong></p>
224 <p>Please delete the /config directory for extra security.</p>" );
227 if( file_exists( "./LocalSettings.php" ) ) {
228 writeSuccessMessage();
232 if( !is_writable( "." ) ) {
233 dieout( "<h2>Can't write config file, aborting</h2>
235 <p>In order to configure the wiki you have to make the <tt>config</tt> subdirectory
236 writable by the web server. Once configuration is done you'll move the created
237 <tt>LocalSettings.php</tt> to the parent directory, and for added safety you can
238 then remove the <tt>config</tt> subdirectory entirely.</p>
240 <p>To make the directory writable on a Unix/Linux system:</p>
243 cd <i>/path/to/wiki</i>
247 <p>Afterwards retry to start the <a href=\"\">setup</a>.</p>" );
251 require_once( "$IP/install-utils.inc" );
252 require_once( "$IP/maintenance/updaters.inc" );
255 function getEncoded( $data ) {
256 # removing latin1 support, no need...
259 function getSitename() { return $this->getEncoded( $this->Sitename
); }
260 function getSysopName() { return $this->getEncoded( $this->SysopName
); }
261 function getSysopPass() { return $this->getEncoded( $this->SysopPass
); }
263 function setSchema( $schema, $engine ) {
264 $this->DBschema
= $schema;
265 if ( !preg_match( '/^\w*$/', $engine ) ){
268 switch ( $this->DBschema
) {
270 $this->DBTableOptions
= "ENGINE=$engine, DEFAULT CHARSET=utf8";
271 $this->DBmysql5
= 'true';
273 case 'mysql5-binary':
274 $this->DBTableOptions
= "ENGINE=$engine, DEFAULT CHARSET=binary";
275 $this->DBmysql5
= 'true';
278 $this->DBTableOptions
= "TYPE=$engine";
279 $this->DBmysql5
= 'false';
281 $this->DBengine
= $engine;
283 # Set the global for use during install
284 global $wgDBTableOptions;
285 $wgDBTableOptions = $this->DBTableOptions
;
293 <b
>Don
't forget security updates!</b> Keep an eye on the
294 <a href="http://lists.wikimedia.org/mailman/listinfo/mediawiki-announce">low-traffic
295 release announcements mailing list</a>.
300 <h2>Checking environment...</h2>
301 <p><em>Please include all of the lines below when reporting installation problems.</em></p>
302 <ul class="env-check">
304 $mainListOpened = true;
308 define( 'MW_NO_OUTPUT_BUFFER
', 1 );
309 $conf = new ConfigData;
311 install_version_checks();
312 $self = 'Installer
'; # Maintenance script name, to please Setup.php
314 print "<li>PHP " . htmlspecialchars( phpversion() ) . " installed</li>\n";
316 error_reporting( 0 );
317 $phpdatabases = array();
318 foreach (array_keys($ourdb) as $db) {
319 $compname = $ourdb[$db]['compile
'];
320 if( extension_loaded( $compname ) || ( mw_have_dl() && dl( "{$compname}." . PHP_SHLIB_SUFFIX ) ) ) {
321 array_push($phpdatabases, $db);
322 $ourdb[$db]['havedriver
'] = 1;
325 error_reporting( E_ALL );
327 if (!$phpdatabases) {
328 print "Could not find a suitable database driver!<ul>";
329 foreach (array_keys($ourdb) AS $db) {
330 $comp = $ourdb[$db]['compile
'];
331 $full = $ourdb[$db]['fullname
'];
332 print "<li>For <b>$full</b>, compile PHP using <b>--with-$comp</b>, "
333 ."or install the $comp.so module</li>\n";
339 print "<li>Found database drivers for:";
341 foreach (array_keys($ourdb) AS $db) {
342 if ($ourdb[$db]['havedriver
']) {
343 if ( $DefaultDBtype == '' ) {
344 $DefaultDBtype = $db;
346 print " ".$ourdb[$db]['fullname
'];
351 if( wfIniGetBool( "register_globals" ) ) {
354 <div style="font-size:110%">
355 <strong class="error">Warning:</strong>
356 <strong>PHP's
<tt
><a href
="http://php.net/register_globals">register_globals
</a
></tt
> option is enabled
. Disable it
if you can
.</strong
>
358 MediaWiki will work
, but your server is more exposed to PHP
-based security vulnerabilities
.
365 if( wfIniGetBool( "magic_quotes_runtime" ) ) {
367 ?
><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
>
368 This option corrupts data input unpredictably
; you cannot install
or use
369 MediaWiki unless this option is disabled
.</li
>
373 if( wfIniGetBool( "magic_quotes_sybase" ) ) {
375 ?
><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
>
376 This option corrupts data input unpredictably
; you cannot install
or use
377 MediaWiki unless this option is disabled
.</li
>
381 if( wfIniGetBool( "mbstring.func_overload" ) ) {
383 ?
><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
>
384 This option causes errors
and may corrupt data unpredictably
;
385 you cannot install
or use MediaWiki unless this option is disabled
.</li
>
389 if( wfIniGetBool( "zend.ze1_compatibility_mode" ) ) {
391 ?
><li
class="error"><strong
>Fatal
: <a href
="http://www.php.net/manual/en/ini.core.php">zend
.ze1_compatibility_mode
</a
> is active
!</strong
>
392 This option causes horrible bugs with MediaWiki
; you cannot install
or use
393 MediaWiki unless this option is disabled
.</li
>
399 dieout( "Cannot install MediaWiki." );
402 if( wfIniGetBool( "safe_mode" ) ) {
403 $conf->safeMode
= true;
405 <li
><b
class='error'>Warning
:</b
> <strong
>PHP
's
406 <a href='http
://www.php.net/features.safe-mode'>safe mode</a> is active.</strong>
407 You may have problems caused by this
, particularly
if using image uploads
.
411 $conf->safeMode
= false;
414 $sapi = htmlspecialchars( php_sapi_name() );
415 print "<li>PHP server API is $sapi; ";
416 $script = defined('MW_INSTALL_PHP5_EXT') ?
'index.php5' : 'index.php';
417 if( $wgUsePathInfo ) {
418 print "ok, using pretty URLs (<tt>$script/Page_Title</tt>)";
420 print "using ugly URLs (<tt>$script?title=Page_Title</tt>)";
424 $conf->xml
= function_exists( "utf8_encode" );
426 print "<li>Have XML / Latin1-UTF-8 conversion support.</li>\n";
428 dieout( "PHP's XML module is missing; the wiki requires functions in
429 this module and won't work in this configuration.
430 If you're running Mandrake, install the php-xml package." );
433 # Check for session support
434 if( !function_exists( 'session_name' ) )
435 dieout( "PHP's session module is missing. MediaWiki requires session support in order to function." );
437 # session.save_path doesn't *have* to be set, but if it is, and it's
438 # not valid/writable/etc. then it can cause problems
439 $sessionSavePath = mw_get_session_save_path();
440 $ssp = htmlspecialchars( $sessionSavePath );
441 # Warn the user if it's not set, but let them proceed
442 if( !$sessionSavePath ) {
443 print "<li><strong>Warning:</strong> A value for <tt>session.save_path</tt>
444 has not been set in PHP.ini. If the default value causes problems with
445 saving session data, set it to a valid path which is read/write/execute
446 for the user your web server is running under.</li>";
447 } elseif ( is_dir( $sessionSavePath ) && is_writable( $sessionSavePath ) ) {
448 # All good? Let the user know
449 print "<li>Session save path (<tt>{$ssp}</tt>) appears to be valid.</li>";
451 # Something not right? Warn the user, but let them proceed
452 print "<li><strong>Warning:</strong> Your <tt>session.save_path</tt> value (<tt>{$ssp}</tt>)
453 appears to be invalid or is not writable. PHP needs to be able to save data to
454 this location for correct session operation.</li>";
457 # Check for PCRE support
458 if( !function_exists( 'preg_match' ) )
459 dieout( "The PCRE support module appears to be missing. MediaWiki requires the
460 Perl-compatible regular expression functions." );
462 $memlimit = ini_get( "memory_limit" );
463 $conf->raiseMemory
= false;
464 if( empty( $memlimit ) ||
$memlimit == -1 ) {
465 print "<li>PHP is configured with no <tt>memory_limit</tt>.</li>\n";
467 print "<li>PHP's <tt>memory_limit</tt> is " . htmlspecialchars( $memlimit ) . ". ";
468 $n = intval( $memlimit );
469 if( preg_match( '/^([0-9]+)[Mm]$/', trim( $memlimit ), $m ) ) {
470 $n = intval( $m[1] * (1024*1024) );
472 if( $n < 20*1024*1024 ) {
473 print "Attempting to raise limit to 20M... ";
474 if( false === ini_set( "memory_limit", "20M" ) ) {
475 print "failed.<br /><b>" . htmlspecialchars( $memlimit ) . " seems too low, installation may fail!</b>";
477 $conf->raiseMemory
= true;
484 $conf->turck
= function_exists( 'mmcache_get' );
485 if ( $conf->turck
) {
486 print "<li><a href=\"http://turck-mmcache.sourceforge.net/\">Turck MMCache</a> installed</li>\n";
489 $conf->xcache
= function_exists( 'xcache_get' );
491 print "<li><a href=\"http://trac.lighttpd.net/xcache/\">XCache</a> installed</li>\n";
493 $conf->apc
= function_exists('apc_fetch');
495 print "<li><a href=\"http://www.php.net/apc\">APC</a> installed</li>\n";
498 $conf->eaccel
= function_exists( 'eaccelerator_get' );
499 if ( $conf->eaccel
) {
500 $conf->turck
= 'eaccelerator';
501 print "<li><a href=\"http://eaccelerator.sourceforge.net/\">eAccelerator</a> installed</li>\n";
504 $conf->dba
= function_exists( 'dba_open' );
506 if( !( $conf->turck ||
$conf->eaccel ||
$conf->apc ||
$conf->xcache
) ) {
507 echo( '<li>Couldn\'t find <a href="http://turck-mmcache.sourceforge.net">Turck MMCache</a>,
508 <a href="http://eaccelerator.sourceforge.net">eAccelerator</a>,
509 <a href="http://www.php.net/apc">APC</a> or <a href="http://trac.lighttpd.net/xcache/">XCache</a>;
510 cannot use these for object caching.</li>' );
513 $conf->diff3
= false;
514 $diff3locations = array_merge(
521 explode( PATH_SEPARATOR
, getenv( "PATH" ) ) );
522 $diff3names = array( "gdiff3", "diff3", "diff3.exe" );
524 $diff3versioninfo = array( '$1 --version 2>&1', 'diff3 (GNU diffutils)' );
525 foreach ($diff3locations as $loc) {
526 $exe = locate_executable($loc, $diff3names, $diff3versioninfo);
527 if ($exe !== false) {
534 print "<li>Found GNU diff3: <tt>$conf->diff3</tt>.</li>";
536 print "<li>GNU diff3 not found.</li>";
538 $conf->ImageMagick
= false;
539 $imcheck = array( "/usr/bin", "/opt/csw/bin", "/usr/local/bin", "/sw/bin", "/opt/local/bin" );
540 foreach( $imcheck as $dir ) {
541 $im = "$dir/convert";
542 if( @file_exists
( $im ) ) {
543 print "<li>Found ImageMagick: <tt>$im</tt>; image thumbnailing will be enabled if you enable uploads.</li>\n";
544 $conf->ImageMagick
= $im;
549 $conf->HaveGD
= function_exists( "imagejpeg" );
550 if( $conf->HaveGD
) {
551 print "<li>Found GD graphics library built-in";
552 if( !$conf->ImageMagick
) {
553 print ", image thumbnailing will be enabled if you enable uploads";
557 if( !$conf->ImageMagick
) {
558 print "<li>Couldn't find GD library or ImageMagick; image thumbnailing disabled.</li>\n";
562 $conf->IP
= dirname( dirname( __FILE__
) );
563 print "<li>Installation directory: <tt>" . htmlspecialchars( $conf->IP
) . "</tt></li>\n";
566 // PHP_SELF isn't available sometimes, such as when PHP is CGI but
567 // cgi.fix_pathinfo is disabled. In that case, fall back to SCRIPT_NAME
568 // to get the path to the current script... hopefully it's reliable. SIGH
569 $path = ($_SERVER["PHP_SELF"] === '')
570 ?
$_SERVER["SCRIPT_NAME"]
571 : $_SERVER["PHP_SELF"];
573 $conf->ScriptPath
= preg_replace( '{^(.*)/config.*$}', '$1', $path );
574 print "<li>Script URI path: <tt>" . htmlspecialchars( $conf->ScriptPath
) . "</tt></li>\n";
578 // We may be installing from *.php5 extension file, if so, print message
579 $conf->ScriptExtension
= '.php';
580 if (defined('MW_INSTALL_PHP5_EXT')) {
581 $conf->ScriptExtension
= '.php5';
582 print "<li>Installing MediaWiki with <tt>php5</tt> file extensions</li>\n";
584 print "<li>Installing MediaWiki with <tt>php</tt> file extensions</li>\n";
588 print "<li style='font-weight:bold;color:green;font-size:110%'>Environment checked. You can install MediaWiki.</li>\n";
589 $conf->posted
= ($_SERVER["REQUEST_METHOD"] == "POST");
591 $conf->Sitename
= ucfirst( importPost( "Sitename", "" ) );
592 $defaultEmail = empty( $_SERVER["SERVER_ADMIN"] )
594 : $_SERVER["SERVER_ADMIN"];
595 $conf->EmergencyContact
= importPost( "EmergencyContact", $defaultEmail );
596 $conf->DBtype
= importPost( "DBtype", $DefaultDBtype );
597 if ( !isset( $ourdb[$conf->DBtype
] ) ) {
598 $conf->DBtype
= $DefaultDBtype;
601 $conf->DBserver
= importPost( "DBserver", "localhost" );
602 $conf->DBname
= importPost( "DBname", "wikidb" );
603 $conf->DBuser
= importPost( "DBuser", "wikiuser" );
604 $conf->DBpassword
= importPost( "DBpassword" );
605 $conf->DBpassword2
= importPost( "DBpassword2" );
606 $conf->SysopName
= importPost( "SysopName", "WikiSysop" );
607 $conf->SysopPass
= importPost( "SysopPass" );
608 $conf->SysopPass2
= importPost( "SysopPass2" );
609 $conf->RootUser
= importPost( "RootUser", "root" );
610 $conf->RootPW
= importPost( "RootPW", "" );
611 $useRoot = importCheck( 'useroot', false );
612 $conf->LanguageCode
= importPost( "LanguageCode", "en" );
614 $conf->DBprefix
= importPost( "DBprefix" );
616 importPost( "DBschema", "mysql5-binary" ),
617 importPost( "DBengine", "InnoDB" ) );
619 ## Postgres specific:
620 $conf->DBport
= importPost( "DBport", "5432" );
621 $conf->DBmwschema
= importPost( "DBmwschema", "mediawiki" );
622 $conf->DBts2schema
= importPost( "DBts2schema", "public" );
625 $conf->SQLiteDataDir
= importPost( "SQLiteDataDir", "" );
628 // We need a second field so it doesn't overwrite the MySQL one
629 $conf->DBprefix2
= importPost( "DBprefix2" );
632 // New variable in order to have a different default port number
633 $conf->DBport_db2
= importPost( "DBport_db2", "50000" );
634 $conf->DBmwschema
= importPost( "DBmwschema", "mediawiki" );
635 $conf->DBcataloged
= importPost( "DBcataloged", "cataloged" );
637 $conf->ShellLocale
= getShellLocale( $conf->LanguageCode
);
639 /* Check for validity */
642 if( preg_match( '/^$|^mediawiki$|#/i', $conf->Sitename
) ) {
643 $errs["Sitename"] = "Must not be blank or \"MediaWiki\" and may not contain \"#\"";
645 if( $conf->DBuser
== "" ) {
646 $errs["DBuser"] = "Must not be blank";
648 if( ($conf->DBtype
== 'mysql') && (strlen($conf->DBuser
) > 16) ) {
649 $errs["DBuser"] = "Username too long";
651 if( $conf->DBpassword
== "" && $conf->DBtype
!= "postgres" ) {
652 $errs["DBpassword"] = "Must not be blank";
654 if( $conf->DBpassword
!= $conf->DBpassword2
) {
655 $errs["DBpassword2"] = "Passwords don't match!";
657 if( !preg_match( '/^[A-Za-z_0-9]*$/', $conf->DBprefix
) ) {
658 $errs["DBprefix"] = "Invalid table prefix";
660 untaint( $conf->DBprefix
, TC_MYSQL
);
663 error_reporting( E_ALL
);
666 * Initialise $wgLang and $wgContLang to something so we can
667 * call case-folding methods. Per Brion, this is English for
668 * now, although we could be clever and initialise to the
669 * user-selected language.
671 $wgContLang = Language
::factory( 'en' );
672 $wgLang = $wgContLang;
675 * We're messing about with users, so we need a stub
676 * authentication plugin...
678 $wgAuth = new AuthPlugin();
681 * Validate the initial administrator account; username,
682 * password checks, etc.
684 if( $conf->SysopName
) {
685 # Check that the user can be created
686 $u = User
::newFromName( $conf->SysopName
);
687 if( is_a($u, 'User') ) { // please do not use instanceof, it breaks PHP4
688 # Various password checks
689 if( $conf->SysopPass
!= '' ) {
690 if( $conf->SysopPass
== $conf->SysopPass2
) {
691 if( !$u->isValidPassword( $conf->SysopPass
) ) {
692 $errs['SysopPass'] = "Bad password";
695 $errs['SysopPass2'] = "Passwords don't match";
698 $errs['SysopPass'] = "Cannot be blank";
702 $errs['SysopName'] = "Bad username";
706 $conf->License
= importRequest( "License", "none" );
707 if( $conf->License
== "gfdl1_2" ) {
708 $conf->RightsUrl
= "http://www.gnu.org/licenses/old-licenses/fdl-1.2.txt";
709 $conf->RightsText
= "GNU Free Documentation License 1.2";
710 $conf->RightsCode
= "gfdl1_2";
711 $conf->RightsIcon
= '${wgScriptPath}/skins/common/images/gnu-fdl.png';
712 } elseif( $conf->License
== "gfdl1_3" ) {
713 $conf->RightsUrl
= "http://www.gnu.org/copyleft/fdl.html";
714 $conf->RightsText
= "GNU Free Documentation License 1.3";
715 $conf->RightsCode
= "gfdl1_3";
716 $conf->RightsIcon
= '${wgScriptPath}/skins/common/images/gnu-fdl.png';
717 } elseif( $conf->License
== "none" ) {
718 $conf->RightsUrl
= $conf->RightsText
= $conf->RightsCode
= $conf->RightsIcon
= "";
719 } elseif( $conf->License
== "pd" ) {
720 $conf->RightsUrl
= "http://creativecommons.org/licenses/publicdomain/";
721 $conf->RightsText
= "Public Domain";
722 $conf->RightsCode
= "pd";
723 $conf->RightsIcon
= '${wgScriptPath}/skins/common/images/public-domain.png';
725 $conf->RightsUrl
= importRequest( "RightsUrl", "" );
726 $conf->RightsText
= importRequest( "RightsText", "" );
727 $conf->RightsCode
= importRequest( "RightsCode", "" );
728 $conf->RightsIcon
= importRequest( "RightsIcon", "" );
731 $conf->Shm
= importRequest( "Shm", "none" );
732 $conf->MCServers
= importRequest( "MCServers" );
734 /* Test memcached servers */
736 if ( $conf->Shm
== 'memcached' && $conf->MCServers
) {
737 $conf->MCServerArray
= wfArrayMap( 'trim', explode( ',', $conf->MCServers
) );
738 foreach ( $conf->MCServerArray
as $server ) {
739 $error = testMemcachedServer( $server );
741 $errs["MCServers"] = $error;
745 } else if ( $conf->Shm
== 'memcached' ) {
746 $errs["MCServers"] = "Please specify at least one server if you wish to use memcached";
749 /* default values for installation */
750 $conf->Email
= importRequest("Email", "email_enabled");
751 $conf->Emailuser
= importRequest("Emailuser", "emailuser_enabled");
752 $conf->Enotif
= importRequest("Enotif", "enotif_allpages");
753 $conf->Eauthent
= importRequest("Eauthent", "eauthent_enabled");
755 if( $conf->posted
&& ( 0 == count( $errs ) ) ) {
756 do { /* So we can 'continue' to end prematurely */
757 $conf->Root
= ($conf->RootPW
!= "");
759 /* Load up the settings and get installin' */
760 $local = writeLocalSettings( $conf );
761 echo "<li style=\"list-style: none\">\n";
762 echo "<p><b>Generating configuration file...</b></p>\n";
765 $wgCommandLineMode = false;
767 $ok = eval( $local );
768 if( $ok === false ) {
769 dieout( "<p>Errors in generated configuration; " .
770 "most likely due to a bug in the installer... " .
771 "Config file was: </p>" .
773 htmlspecialchars( $local ) .
776 $conf->DBtypename
= '';
777 foreach (array_keys($ourdb) as $db) {
778 if ($conf->DBtype
=== $db)
779 $conf->DBtypename
= $ourdb[$db]['fullname'];
781 if ( ! strlen($conf->DBtype
)) {
782 $errs["DBpicktype"] = "Please choose a database type";
786 if (! $conf->DBtypename
) {
787 $errs["DBtype"] = "Unknown database type '$conf->DBtype'";
790 print "<li>Database type: " . htmlspecialchars( $conf->DBtypename
) . "</li>\n";
791 $dbclass = 'Database'.ucfirst($conf->DBtype
);
792 $wgDBtype = $conf->DBtype
;
793 $wgDBadminuser = "root";
794 $wgDBadminpassword = $conf->RootPW
;
797 $wgDBprefix = $conf->DBprefix
;
799 ## Postgres specific:
800 $wgDBport = $conf->DBport
;
801 $wgDBmwschema = $conf->DBmwschema
;
802 $wgDBts2schema = $conf->DBts2schema
;
804 if( $conf->DBprefix2
!= '' ) {
806 $wgDBprefix = $conf->DBprefix2
;
810 $wgDBcataloged = $conf->DBcataloged
;
812 $wgCommandLineMode = true;
813 if (! defined ( 'STDERR' ) )
814 define( 'STDERR', fopen("php://stderr", "wb"));
815 $wgUseDatabaseMessages = false; /* FIXME: For database failure */
816 require_once( "$IP/includes/Setup.php" );
819 $wgTitle = Title
::newFromText( "Installation script" );
820 error_reporting( E_ALL
);
821 print "<li>Loading class: " . htmlspecialchars( $dbclass ) . "</li>\n";
824 if( $conf->DBtype
== 'mysql' ) {
825 $mysqlOldClient = version_compare( mysql_get_client_info(), "4.1.0", "lt" );
826 if( $mysqlOldClient ) {
827 print "<li><b>PHP is linked with old MySQL client libraries. If you are
828 using a MySQL 4.1 server and have problems connecting to the database,
829 see <a href='http://dev.mysql.com/doc/mysql/en/old-client.html'
830 >http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b></li>\n";
832 $ok = true; # Let's be optimistic
834 # Decide if we're going to use the superuser or the regular database user
835 $conf->Root
= $useRoot;
837 $db_user = $conf->RootUser
;
838 $db_pass = $conf->RootPW
;
840 $db_user = $wgDBuser;
841 $db_pass = $wgDBpassword;
845 echo( "<li>Attempting to connect to database server as " . htmlspecialchars( $db_user ) . "..." );
846 $wgDatabase = Database
::newFromParams( $wgDBserver, $db_user, $db_pass, '', 1 );
848 # Check the connection and respond to errors
849 if( $wgDatabase->isOpen() ) {
852 $wgDBadminuser = $db_user;
853 $wgDBadminpassword = $db_pass;
854 echo( "success.</li>\n" );
855 $wgDatabase->ignoreErrors( true );
856 $myver = $wgDatabase->getServerVersion();
858 # There were errors, report them and back out
860 $errno = mysql_errno();
861 $errtx = htmlspecialchars( mysql_error() );
865 echo( "failed due to authentication errors. Check passwords.</li>" );
867 # The superuser details are wrong
868 $errs["RootUser"] = "Check username";
869 $errs["RootPW"] = "and password";
871 # The regular user details are wrong
872 $errs["DBuser"] = "Check username";
873 $errs["DBpassword"] = "and password";
879 # General connection problem
880 echo( htmlspecialchars( "failed with error [$errno] $errtx." ) . "</li>\n" );
881 $errs["DBserver"] = "Connection failed";
886 if( !$ok ) { continue; }
888 else if( $conf->DBtype
== 'ibm_db2' ) {
890 $db_user = $conf->RootUser
;
891 $db_pass = $conf->RootPW
;
893 $db_user = $wgDBuser;
894 $db_pass = $wgDBpassword;
897 echo( "<li>Attempting to connect to database \"" . htmlspecialchars( $wgDBname ) .
898 "\" as \"" . htmlspecialchars( $db_user ) . "\"..." );
899 $wgDatabase = $dbc->newFromParams($wgDBserver, $db_user, $db_pass, $wgDBname, 1);
900 if (!$wgDatabase->isOpen()) {
901 print " error: " . htmlspecialchars( $wgDatabase->lastError() ) . "</li>\n";
903 $myver = $wgDatabase->getServerVersion();
905 if (is_callable(array($wgDatabase, 'initial_setup'))) $wgDatabase->initial_setup('', $wgDBname);
908 error_reporting( E_ALL
);
910 ## Possible connect as a superuser
911 // Changed !mysql to postgres check since it seems to only apply to postgres
912 if( $useRoot && $conf->DBtype
== 'postgres' ) {
913 $wgDBsuperuser = $conf->RootUser
;
914 echo( "<li>Attempting to connect to database \"postgres\" as superuser \"" .
915 htmlspecialchars( $wgDBsuperuser ) . "\"..." );
916 $wgDatabase = $dbc->newFromParams($wgDBserver, $wgDBsuperuser, $conf->RootPW
, "postgres", 1);
917 if (!$wgDatabase->isOpen()) {
918 print " error: " . htmlspecialchars( $wgDatabase->lastError() ) . "</li>\n";
919 $errs["DBserver"] = "Could not connect to database as superuser";
920 $errs["RootUser"] = "Check username";
921 $errs["RootPW"] = "and password";
924 $wgDatabase->initial_setup($conf->RootPW
, 'postgres');
926 echo( "<li>Attempting to connect to database \"" . htmlspecialchars( $wgDBname ) .
927 "\" as \"" . htmlspecialchars( $wgDBuser ) . "\"..." );
928 $wgDatabase = $dbc->newFromParams($wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1);
929 if (!$wgDatabase->isOpen()) {
930 print " error: " . htmlspecialchars( $wgDatabase->lastError() ) . "</li>\n";
932 $myver = $wgDatabase->getServerVersion();
934 if (is_callable(array($wgDatabase, 'initial_setup'))) $wgDatabase->initial_setup('', $wgDBname);
937 if ( !$wgDatabase->isOpen() ) {
938 $errs["DBserver"] = "Couldn't connect to database";
942 print "<li>Connected to " . htmlspecialchars( "{$conf->DBtype} $myver" );
943 if ($conf->DBtype
== 'mysql') {
944 if( version_compare( $myver, "4.0.14" ) < 0 ) {
946 dieout( "-- mysql 4.0.14 or later required. Aborting." );
948 $mysqlNewAuth = version_compare( $myver, "4.1.0", "ge" );
949 if( $mysqlNewAuth && $mysqlOldClient ) {
950 print "; <b class='error'>You are using MySQL 4.1 server, but PHP is linked
951 to old client libraries; if you have trouble with authentication, see
952 <a href='http://dev.mysql.com/doc/mysql/en/old-client.html'
953 >http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b>";
956 if( $mysqlNewAuth ) {
957 print "; enabling MySQL 4.1/5.0 charset mode";
959 print "; <b class='error'>MySQL 4.1/5.0 charset mode enabled,
960 but older version detected; will likely fail.</b>";
965 @$sel = $wgDatabase->selectDB( $wgDBname );
967 print "<li>Database <tt>" . htmlspecialchars( $wgDBname ) . "</tt> exists</li>\n";
969 $err = mysql_errno();
970 $databaseSafe = htmlspecialchars( $wgDBname );
971 if( $err == 1102 /* Invalid database name */ ) {
972 print "<ul><li><strong>{$databaseSafe}</strong> is not a valid database name.</li></ul>";
974 } elseif( $err != 1049 /* Database doesn't exist */ ) {
975 print "<ul><li>Error selecting database <strong>{$databaseSafe}</strong>: {$err} ";
976 print htmlspecialchars( mysql_error() ) . "</li></ul>";
979 print "<li>Attempting to create database...</li>";
980 $res = $wgDatabase->query( "CREATE DATABASE `$wgDBname`" );
982 print "<li>Couldn't create database <tt>" .
983 htmlspecialchars( $wgDBname ) .
984 "</tt>; try with root access or check your username/pass.</li>\n";
985 $errs["RootPW"] = "<- Enter";
988 print "<li>Created database <tt>" . htmlspecialchars( $wgDBname ) . "</tt></li>\n";
990 $wgDatabase->selectDB( $wgDBname );
992 else if ($conf->DBtype
== 'postgres') {
993 if( version_compare( $myver, "8.0" ) < 0 ) {
994 dieout( "<b>Postgres 8.0 or later is required</b>. Aborting." );
998 if( $wgDatabase->tableExists( "cur" ) ||
$wgDatabase->tableExists( "revision" ) ) {
999 print "<li>There are already MediaWiki tables in this database. Checking if updates are needed...</li>\n";
1001 if ( $conf->DBtype
== 'mysql') {
1002 # Determine existing default character set
1003 if ( $wgDatabase->tableExists( "revision" ) ) {
1004 $revision = $wgDatabase->escapeLike( $conf->DBprefix
. 'revision' );
1005 $res = $wgDatabase->query( "SHOW TABLE STATUS LIKE '$revision'" );
1006 $row = $wgDatabase->fetchObject( $res );
1008 echo "<li>SHOW TABLE STATUS query failed!</li>\n";
1009 $existingSchema = false;
1010 $existingEngine = false;
1012 if ( preg_match( '/^latin1/', $row->Collation
) ) {
1013 $existingSchema = 'mysql4';
1014 } elseif ( preg_match( '/^utf8/', $row->Collation
) ) {
1015 $existingSchema = 'mysql5';
1016 } elseif ( preg_match( '/^binary/', $row->Collation
) ) {
1017 $existingSchema = 'mysql5-binary';
1019 $existingSchema = false;
1020 echo "<li><strong>Warning:</strong> Unrecognised existing collation</li>\n";
1022 if ( isset( $row->Engine
) ) {
1023 $existingEngine = $row->Engine
;
1025 $existingEngine = $row->Type
;
1028 if ( $existingSchema && $existingSchema != $conf->DBschema
) {
1029 $encExisting = htmlspecialchars( $existingSchema );
1030 $encRequested = htmlspecialchars( $conf->DBschema
);
1031 print "<li><strong>Warning:</strong> you requested the $encRequested schema, " .
1032 "but the existing database has the $encExisting schema. This upgrade script ".
1033 "can't convert it, so it will remain $encExisting.</li>\n";
1034 $conf->setSchema( $existingSchema, $conf->DBengine
);
1036 if ( $existingEngine && $existingEngine != $conf->DBengine
) {
1037 $encExisting = htmlspecialchars( $existingEngine );
1038 $encRequested = htmlspecialchars( $conf->DBengine
);
1039 print "<li><strong>Warning:</strong> you requested the $encRequested storage " .
1040 "engine, but the existing database uses the $encExisting engine. This upgrade " .
1041 "script can't convert it, so it will remain $encExisting.</li>\n";
1042 $conf->setSchema( $conf->DBschema
, $existingEngine );
1046 # Create user if required
1047 if ( $conf->Root
) {
1048 $conn = $dbc->newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1 );
1049 if ( $conn->isOpen() ) {
1050 print "<li>DB user account ok</li>\n";
1053 print "<li>Granting user permissions...";
1054 if( $mysqlOldClient && $mysqlNewAuth ) {
1055 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>";
1058 dbsource( "../maintenance/users.sql", $wgDatabase );
1062 print "</ul><pre>\n";
1068 print "<ul><li>Finished update checks.</li>\n";
1070 # Determine available storage engines if possible
1071 if ( $conf->DBtype
== 'mysql' && version_compare( $myver, "4.1.2", "ge" ) ) {
1072 $res = $wgDatabase->query( 'SHOW ENGINES' );
1074 while ( $row = $wgDatabase->fetchObject( $res ) ) {
1075 if ( $row->Engine
== $conf->DBengine
) {
1080 $wgDatabase->freeResult( $res );
1081 if ( !$found && $conf->DBengine
!= 'MyISAM' ) {
1082 echo "<li><strong>Warning:</strong> " . htmlspecialchars( $conf->DBengine
) .
1083 " storage engine not available, " .
1084 "using MyISAM instead</li>\n";
1085 $conf->setSchema( $conf->DBschema
, 'MyISAM' );
1089 # FIXME: Check for errors
1090 print "<li>Creating tables...";
1091 if ($conf->DBtype
== 'mysql') {
1092 dbsource( "../maintenance/tables.sql", $wgDatabase );
1093 dbsource( "../maintenance/interwiki.sql", $wgDatabase );
1094 } elseif (is_callable(array($wgDatabase, 'setup_database'))) {
1095 $wgDatabase->setup_database();
1098 $errs["DBtype"] = "Do not know how to handle database type '$conf->DBtype'";
1102 print " done.</li>\n";
1104 print "<li>Initializing statistics...</li>\n";
1105 $wgDatabase->insert( 'site_stats',
1106 array ( 'ss_row_id' => 1,
1107 'ss_total_views' => 0,
1108 'ss_total_edits' => 1, # Main page first edit
1109 'ss_good_articles' => 0, # Main page is not a good article - no internal link
1110 'ss_total_pages' => 1, # Main page
1111 'ss_users' => $conf->SysopName ?
1 : 0, # Sysop account, if created
1112 'ss_admins' => $conf->SysopName ?
1 : 0, # Sysop account, if created
1113 'ss_images' => 0 ) );
1115 # Set up the "regular user" account *if we can, and if we need to*
1116 if( $conf->Root
and $conf->DBtype
== 'mysql') {
1118 $wgDatabase2 = $dbc->newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1 );
1119 if( $wgDatabase2->isOpen() ) {
1120 # Nope, just close the test connection and continue
1121 $wgDatabase2->close();
1122 echo( "<li>User " . htmlspecialchars( $wgDBuser ) . " exists. Skipping grants.</li>\n" );
1124 # Yes, so run the grants
1125 echo( "<li>" . htmlspecialchars( "Granting user permissions to $wgDBuser on $wgDBname..." ) );
1126 dbsource( "../maintenance/users.sql", $wgDatabase );
1127 echo( "success.</li>\n" );
1131 if( $conf->SysopName
) {
1132 $u = User
::newFromName( $conf->getSysopName() );
1134 print "<li><strong class=\"error\">Warning:</strong> Skipped sysop account creation - invalid username!</li>\n";
1136 else if ( 0 == $u->idForName() ) {
1137 $u->addToDatabase();
1138 $u->setPassword( $conf->getSysopPass() );
1141 $u->addGroup( "sysop" );
1142 $u->addGroup( "bureaucrat" );
1144 print "<li>Created sysop account <tt>" .
1145 htmlspecialchars( $conf->SysopName
) . "</tt>.</li>\n";
1147 print "<li>Could not create user - already exists!</li>\n";
1150 print "<li>Skipped sysop account creation, no name given.</li>\n";
1153 $titleobj = Title
::newFromText( wfMsgNoDB( "mainpage" ) );
1154 $article = new Article( $titleobj );
1155 $newid = $article->insertOn( $wgDatabase );
1156 $revision = new Revision( array(
1158 'text' => wfMsg( 'mainpagetext' ) . "\n\n" . wfMsgNoTrans( 'mainpagedocfooter' ),
1161 'user_text' => 'MediaWiki default',
1163 $revid = $revision->insertOn( $wgDatabase );
1164 $article->updateRevisionOn( $wgDatabase, $revision );
1166 // Now that all database work is done, make sure everything is committed
1167 $wgDatabase->commit();
1169 /* Write out the config file now that all is well */
1170 print "<li style=\"list-style: none\">\n";
1171 print "<p>Creating LocalSettings.php...</p>\n\n";
1172 $localSettings = "<" . "?php$endl$local";
1173 // Fix up a common line-ending problem (due to CVS on Windows)
1174 $localSettings = str_replace( "\r\n", "\n", $localSettings );
1175 $f = fopen( "LocalSettings.php", 'xt' );
1179 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" .
1180 "<p>Here's the file that would have been written, try to paste it into place manually:</p>\n" .
1181 "<pre>\n" . htmlspecialchars( $localSettings ) . "</pre>\n" );
1183 if(fwrite( $f, $localSettings ) ) {
1186 writeSuccessMessage();
1190 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" );
1197 $mainListOpened = false;
1199 if( count( $errs ) ) {
1200 /* Display options form */
1202 if( $conf->posted
) {
1203 echo "<p class='error-top'>Something's not quite right yet; make sure everything below is filled out correctly.</p>\n";
1207 <form action
="<?php echo defined('MW_INSTALL_PHP5_EXT') ? 'index.php5' : 'index.php'; ?>" name
="config" method
="post">
1209 <h2
>Site config
</h2
>
1211 <div
class="config-section">
1212 <div
class="config-input">
1213 <?php
aField( $conf, "Sitename", "Wiki name:" ); ?
>
1215 <p
class="config-desc">
1216 Preferably a short word without punctuation
, i
.e
. "Wikipedia".<br
/>
1217 Will appear
as the
namespace name
for "meta" pages
, and throughout the
interface.
1219 <div
class="config-input"><?php
aField( $conf, "EmergencyContact", "Contact e-mail:" ); ?
></div
>
1220 <p
class="config-desc">
1221 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
.
1224 <div
class="config-input">
1225 <label
class='column' for="LanguageCode">Language
:</label
>
1226 <select id
="LanguageCode" name
="LanguageCode"><?php
1227 $list = getLanguageList();
1228 foreach( $list as $code => $name ) {
1229 $sel = ($code == $conf->LanguageCode
) ?
'selected="selected"' : '';
1230 $encCode = htmlspecialchars( $code );
1231 $encName = htmlspecialchars( $name );
1232 echo "\n\t\t<option value=\"$encCode\" $sel>$encName</option>";
1238 <p
class="config-desc">
1239 Select the language
for your wiki
's interface. Some localizations aren't fully complete
. Unicode (UTF
-8) is used
for all localizations
.
1242 <div
class="config-input">
1243 <label
class='column'>Copyright
/license
:</label
>
1246 <li
><?php
aField( $conf, "License", "No license metadata", "radio", "none" ); ?
></li
>
1247 <li
><?php
aField( $conf, "License", "Public Domain", "radio", "pd" ); ?
></li
>
1248 <li
><?php
aField( $conf, "License", "GNU Free Documentation License 1.2 (Wikipedia-compatible)", "radio", "gfdl1_2" ); ?
></li
>
1249 <li
><?php
aField( $conf, "License", "GNU Free Documentation License 1.3", "radio", "gfdl1_3" ); ?
></li
>
1251 aField( $conf, "License", "A Creative Commons license - ", "radio", "cc" );
1252 $partner = "MediaWiki";
1253 $script = defined('MW_INSTALL_PHP5_EXT') ?
'index.php5' : 'index.php';
1254 $exit = urlencode( "$wgServer{$conf->ScriptPath}/config/$script?License=cc&RightsUrl=[license_url]&RightsText=[license_name]&RightsCode=[license_code]&RightsIcon=[license_button]" );
1255 $icon = urlencode( "$wgServer$wgUploadPath/wiki.png" );
1256 $ccApp = htmlspecialchars( "http://creativecommons.org/license/?partner=$partner&exit_url=$exit&partner_icon_url=$icon" );
1257 print "<a href=\"$ccApp\" target='_blank'>choose</a>";
1258 if( $conf->License
== "cc" ) { ?
>
1260 <li
><?php
aField( $conf, "RightsIcon", "<img src=\"" . htmlspecialchars( $conf->RightsIcon
) . "\" alt='(Creative Commons icon)' />", "hidden" ); ?
></li
>
1261 <li
><?php
aField( $conf, "RightsText", htmlspecialchars( $conf->RightsText
), "hidden" ); ?
></li
>
1262 <li
><?php
aField( $conf, "RightsCode", "code: " . htmlspecialchars( $conf->RightsCode
), "hidden" ); ?
></li
>
1263 <li
><?php
aField( $conf, "RightsUrl", "<a href=\"" . htmlspecialchars( $conf->RightsUrl
) . "\">" . htmlspecialchars( $conf->RightsUrl
) . "</a>", "hidden" ); ?
></li
>
1269 <p
class="config-desc">
1270 A notice
, icon
, and machine
-readable copyright metadata will be displayed
for the license you pick
.
1274 <div
class="config-input">
1275 <?php
aField( $conf, "SysopName", "Admin username:" ) ?
>
1277 <div
class="config-input">
1278 <?php
aField( $conf, "SysopPass", "Password:", "password" ) ?
>
1280 <div
class="config-input">
1281 <?php
aField( $conf, "SysopPass2", "Password confirm:", "password" ) ?
>
1283 <p
class="config-desc">
1284 An admin can lock
/delete pages
, block users from editing
, and do other maintenance tasks
.<br
/>
1285 A
new account will be added only when creating a
new wiki database
.
1287 The password cannot be the same
as the username
.
1290 <div
class="config-input">
1291 <label
class='column'>Object caching
:</label
>
1294 <li
><?php
aField( $conf, "Shm", "No caching", "radio", "none" ); ?
></li
>
1296 if ( $conf->turck
) {
1298 aField( $conf, "Shm", "Turck MMCache", "radio", "turck" );
1301 if( $conf->xcache
) {
1303 aField( $conf, 'Shm', 'XCache', 'radio', 'xcache' );
1308 aField( $conf, "Shm", "APC", "radio", "apc" );
1311 if ( $conf->eaccel
) {
1313 aField( $conf, "Shm", "eAccelerator", "radio", "eaccel" );
1318 aField( $conf, "Shm", "DBA (not recommended)", "radio", "dba" );
1322 <li
><?php
aField( $conf, "Shm", "Memcached", "radio", "memcached" ); ?
></li
>
1324 <div style
="clear:left"><?php
aField( $conf, "MCServers", "Memcached servers:", "text" ) ?
></div
>
1326 <p
class="config-desc">
1327 An
object caching system such
as memcached will provide a significant performance boost
,
1328 but needs to be installed
. Provide the server addresses
and ports in a comma
-separated
list.
1330 MediaWiki can also detect
and support eAccelerator
, Turck MMCache
, APC
, and XCache
, but
1331 these should not be used
if the wiki will be running on multiple application servers
.
1333 DBA (Berkeley
-style DB
) is generally slower than using no cache at all
, and is only
1334 recommended
for testing
.
1338 <h2
>E
-mail
, e
-mail notification
and authentication setup
</h2
>
1340 <div
class="config-section">
1341 <div
class="config-input">
1342 <label
class='column'>E
-mail
features (global):</label
>
1344 <li
><?php
aField( $conf, "Email", "Enabled", "radio", "email_enabled" ); ?
></li
>
1345 <li
><?php
aField( $conf, "Email", "Disabled", "radio", "email_disabled" ); ?
></li
>
1348 <p
class="config-desc">
1349 Use this to disable all e
-mail
functions (password reminders
, user
-to
-user e
-mail
, and e
-mail notifications
)
1350 if sending mail doesn
't work on your server.
1353 <div class="config-input">
1354 <label class='column
'>User-to-user e-mail:</label>
1356 <li><?php aField( $conf, "Emailuser", "Enabled", "radio", "emailuser_enabled" ); ?></li>
1357 <li><?php aField( $conf, "Emailuser", "Disabled", "radio", "emailuser_disabled" ); ?></li>
1360 <p class="config-desc">
1361 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.
1363 <div class="config-input">
1364 <label class='column
'>E-mail notification about changes:</label>
1366 <li><?php aField( $conf, "Enotif", "Disabled", "radio", "enotif_disabled" ); ?></li>
1367 <li><?php aField( $conf, "Enotif", "Enabled for changes to user discussion pages only", "radio", "enotif_usertalk" ); ?></li>
1368 <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>
1371 <div class="config-desc">
1373 For this feature to work, an e-mail address must be present for the user account, and the notification
1374 options in the user's preferences must be enabled
. Also note the
1375 authentication option below
. When testing the feature
, keep in mind that your own changes will never trigger notifications to be sent to yourself
.</p
>
1377 <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
>
1380 <div
class="config-input">
1381 <label
class='column'>E
-mail address authentication
:</label
>
1383 <li
><?php
aField( $conf, "Eauthent", "Disabled", "radio", "eauthent_disabled" ); ?
></li
>
1384 <li
><?php
aField( $conf, "Eauthent", "Enabled", "radio", "eauthent_enabled" ); ?
></li
>
1387 <div
class="config-desc">
1388 <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
1389 change notification mails
. Setting this option is
<b
>recommended
</b
> for public wikis because of potential abuse of the e
-mail features above
.</p
>
1394 <h2
>Database config
</h2
>
1396 <div
class="config-section">
1397 <div
class="config-input">
1398 <label
class='column'>Database type
:</label
>
1400 if (isset($errs['DBpicktype'])) {
1401 print "\t<span class='error'>" . htmlspecialchars( $errs['DBpicktype'] ) . "</span>\n";
1404 <ul
class='plain'><?php
1405 database_picker($conf);
1409 <div
class="config-input" style
="clear:left">
1410 <?php
aField( $conf, "DBserver", "Database host:" ); ?
>
1412 <p
class="config-desc">
1413 If your database server isn
't on your web server, enter the name or IP address here.
1416 <div class="config-input"><?php aField( $conf, "DBname", "Database name:" ); ?></div>
1417 <div class="config-input"><?php aField( $conf, "DBuser", "DB username:" ); ?></div>
1418 <div class="config-input"><?php aField( $conf, "DBpassword", "DB password:", "password" ); ?></div>
1419 <div class="config-input"><?php aField( $conf, "DBpassword2", "DB password confirm:", "password" ); ?></div>
1420 <p class="config-desc">
1421 If you only have a single user account and database available,
1422 enter those here. If you have database root access (see below)
1423 you can specify new accounts/databases to be created. This account
1424 will not be created if it pre-exists. If this is the case, ensure that it
1425 has SELECT, INSERT, UPDATE, and DELETE permissions on the MediaWiki database.
1428 <div class="config-input">
1429 <label class="column">Superuser account:</label>
1430 <input type="checkbox" name="useroot" id="useroot" <?php if( $useRoot ) { ?>checked="checked" <?php } ?> />
1431 <label for="useroot">Use superuser account</label>
1433 <div class="config-input"><?php aField( $conf, "RootUser", "Superuser name:", "text" ); ?></div>
1434 <div class="config-input"><?php aField( $conf, "RootPW", "Superuser password:", "password" ); ?></div>
1436 <p class="config-desc">
1437 If the database user specified above does not exist, or does not have access to create
1438 the database (if needed) or tables within it, please check the box and provide details
1439 of a superuser account, such as <strong>root</strong>, which does.
1442 <?php database_switcher('mysql
'); ?>
1443 <div class="config-input"><?php aField( $conf, "DBprefix", "Database table prefix:" ); ?></div>
1444 <div class="config-desc">
1445 <p>If you need to share one database between multiple wikis, or
1446 between MediaWiki and another web application, you may choose to
1447 add a prefix to all the table names to avoid conflicts.</p>
1449 <p>Avoid exotic characters; something like <tt>mw_</tt> is good.</p>
1452 <div class="config-input"><label class="column">Storage Engine</label>
1453 <div>Select one:</div>
1455 <li><?php aField( $conf, "DBengine", "InnoDB", "radio", "InnoDB" ); ?></li>
1456 <li><?php aField( $conf, "DBengine", "MyISAM", "radio", "MyISAM" ); ?></li>
1459 <p class="config-desc">
1460 InnoDB is best for public web installations, since it has good concurrency
1461 support. MyISAM may be faster in single-user installations. MyISAM databases
1462 tend to get corrupted more often than InnoDB databases.
1464 <div class="config-input"><label class="column">Database character set</label>
1465 <div>Select one:</div>
1467 <li><?php aField( $conf, "DBschema", "MySQL 4.1/5.0 binary", "radio", "mysql5-binary" ); ?></li>
1468 <li><?php aField( $conf, "DBschema", "MySQL 4.1/5.0 UTF-8", "radio", "mysql5" ); ?></li>
1469 <li><?php aField( $conf, "DBschema", "MySQL 4.0 backwards-compatible UTF-8", "radio", "mysql4" ); ?></li>
1472 <p class="config-desc">
1473 This option is ignored on upgrade, the same character set will be kept.
1475 <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!.
1477 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>.
1481 <?php database_switcher('postgres
'); ?>
1482 <div class="config-input"><?php aField( $conf, "DBport", "Database port:" ); ?></div>
1483 <div class="config-input"><?php aField( $conf, "DBmwschema", "Schema for mediawiki:" ); ?></div>
1484 <div class="config-input"><?php aField( $conf, "DBts2schema", "Schema for tsearch2:" ); ?></div>
1485 <div class="config-desc">
1486 <p>The username specified above (at "DB username") will have its search path set to the above schemas,
1487 so it is recommended that you create a new user. The above schemas are generally correct:
1488 only change them if you are sure you need to.</p>
1492 <?php database_switcher('sqlite
'); ?>
1493 <div class="config-desc">
1494 <b>NOTE:</b> SQLite only uses the <i>Database name</i> setting above, the user, password and root settings are ignored.
1496 <div class="config-input"><?php
1497 aField( $conf, "SQLiteDataDir", "SQLite data directory:" );
1499 <div class="config-desc">
1500 <p>SQLite stores table data into files in the filesystem.
1501 If you do not provide an explicit path, a "data" directory in
1502 the parent of your document root will be used.</p>
1504 <p>This directory must exist and be writable by the web server.</p>
1508 <?php database_switcher('mssql
'); ?>
1509 <div class="config-input"><?php
1510 aField( $conf, "DBprefix2", "Database table prefix:" );
1512 <div class="config-desc">
1513 <p>If you need to share one database between multiple wikis, or
1514 between MediaWiki and another web application, you may choose to
1515 add a prefix to all the table names to avoid conflicts.</p>
1517 <p>Avoid exotic characters; something like <tt>mw_</tt> is good.</p>
1521 <?php database_switcher('ibm_db2
'); ?>
1522 <div class="config-input"><?php
1523 aField( $conf, "DBport_db2", "Database port:" );
1525 <div class="config-input"><?php
1526 aField( $conf, "DBmwschema", "Schema for mediawiki:" );
1528 <div>Select one:</div>
1530 <li><?php aField( $conf, "DBcataloged", "Cataloged (DB2 installed locally)", "radio", "cataloged" ); ?></li>
1531 <li><?php aField( $conf, "DBcataloged", "Uncataloged (remote DB2 through ODBC)", "radio", "uncataloged" ); ?></li>
1533 <div class="config-desc">
1534 <p>If you need to share one database between multiple wikis, or
1535 between MediaWiki and another web application, you may specify
1536 a different schema to avoid conflicts.</p>
1540 <div class="config-input" style="padding:2em 0 3em">
1541 <label class='column
'> </label>
1542 <input type="submit" value="Install MediaWiki!" class="btn-install" />
1546 <script type="text/javascript">
1547 window.onload = toggleDBarea( <?php echo Xml::encodeJsVar( $conf->DBtype ); ?>,
1549 ## If they passed in a root user name, don't populate it on page load
1550 echo strlen(importPost('RootUser', '')) ?
0 : 1;
1556 /* -------------------------------------------------------------------------------------- */
1557 function writeSuccessMessage() {
1558 $script = defined('MW_INSTALL_PHP5_EXT') ?
'index.php5' : 'index.php';
1559 if ( wfIniGetBool( 'safe_mode' ) && !ini_get( 'open_basedir' ) ) {
1561 <div class="success-box">
1562 <p>Installation successful!</p>
1563 <p>To complete the installation, please do the following:
1565 <li>Download config/LocalSettings.php with your FTP client or file manager</li>
1566 <li>Upload it to the parent directory</li>
1567 <li>Delete config/LocalSettings.php</li>
1568 <li>Start using <a href='../$script'>your wiki</a>!
1570 <p>If you are in a shared hosting environment, do <strong>not</strong> just move LocalSettings.php
1571 remotely. LocalSettings.php is currently owned by the user your webserver is running under,
1572 which means that anyone on the same server can read your database password! Downloading
1573 it and uploading it again will hopefully change the ownership to a user ID specific to you.</p>
1578 <div class="success-box">
1580 <span class="success-message">Installation successful!</span>
1581 Move the <tt>config/LocalSettings.php</tt> file to the parent directory, then follow
1582 <a href="../$script"> this link</a> to your wiki.</p>
1583 <p>You should change file permissions for <tt>LocalSettings.php</tt> as required to
1584 prevent other users on the server reading passwords and altering configuration data.</p>
1591 function escapePhpString( $string ) {
1592 if ( is_array( $string ) ||
is_object( $string ) ) {
1595 return strtr( $string,
1606 function writeLocalSettings( $conf ) {
1607 $conf->PasswordSender
= $conf->EmergencyContact
;
1608 $magic = ($conf->ImageMagick ?
"" : "# ");
1609 $convert = ($conf->ImageMagick ?
$conf->ImageMagick
: "/usr/bin/convert" );
1610 $rights = ($conf->RightsUrl
) ?
"" : "# ";
1611 $hashedUploads = $conf->safeMode ?
'' : '# ';
1613 if ( $conf->ShellLocale
) {
1617 $conf->ShellLocale
= 'en_US.UTF-8';
1620 switch ( $conf->Shm
) {
1622 $cacheType = 'CACHE_MEMCACHED';
1623 $mcservers = var_export( $conf->MCServerArray
, true );
1629 $cacheType = 'CACHE_ACCEL';
1630 $mcservers = 'array()';
1633 $cacheType = 'CACHE_DBA';
1634 $mcservers = 'array()';
1637 $cacheType = 'CACHE_NONE';
1638 $mcservers = 'array()';
1641 if ( $conf->Email
== 'email_enabled' ) {
1642 $enableemail = 'true';
1643 $enableuseremail = ( $conf->Emailuser
== 'emailuser_enabled' ) ?
'true' : 'false' ;
1644 $eauthent = ( $conf->Eauthent
== 'eauthent_enabled' ) ?
'true' : 'false' ;
1645 switch ( $conf->Enotif
) {
1646 case 'enotif_usertalk':
1647 $enotifusertalk = 'true';
1648 $enotifwatchlist = 'false';
1650 case 'enotif_allpages':
1651 $enotifusertalk = 'true';
1652 $enotifwatchlist = 'true';
1655 $enotifusertalk = 'false';
1656 $enotifwatchlist = 'false';
1659 $enableuseremail = 'false';
1660 $enableemail = 'false';
1661 $eauthent = 'false';
1662 $enotifusertalk = 'false';
1663 $enotifwatchlist = 'false';
1666 $file = @fopen
( "/dev/urandom", "r" );
1668 $secretKey = bin2hex( fread( $file, 32 ) );
1672 for ( $i=0; $i<8; $i++
) {
1673 $secretKey .= dechex(mt_rand(0, 0x7fffffff));
1675 print "<li>Warning: \$wgSecretKey key is insecure, generated with mt_rand(). Consider changing it manually.</li>\n";
1678 # Add slashes to strings for double quoting
1679 $slconf = wfArrayMap( "escapePhpString", get_object_vars( $conf ) );
1680 if( $conf->License
== 'gfdl1_2' ||
$conf->License
== 'pd' ||
$conf->License
== 'gfdl1_3' ) {
1681 # Needs literal string interpolation for the current style path
1682 $slconf['RightsIcon'] = $conf->RightsIcon
;
1685 if( $conf->DBtype
== 'mysql' ) {
1687 "# MySQL specific settings
1688 \$wgDBprefix = \"{$slconf['DBprefix']}\";
1690 # MySQL table options to use during installation or update
1691 \$wgDBTableOptions = \"{$slconf['DBTableOptions']}\";
1693 # Experimental charset support for MySQL 4.1/5.0.
1694 \$wgDBmysql5 = {$conf->DBmysql5};";
1695 } elseif( $conf->DBtype
== 'postgres' ) {
1697 "# Postgres specific settings
1698 \$wgDBport = \"{$slconf['DBport']}\";
1699 \$wgDBmwschema = \"{$slconf['DBmwschema']}\";
1700 \$wgDBts2schema = \"{$slconf['DBts2schema']}\";";
1701 } elseif( $conf->DBtype
== 'sqlite' ) {
1703 "# SQLite-specific settings
1704 \$wgSQLiteDataDir = \"{$slconf['SQLiteDataDir']}\";";
1705 } elseif( $conf->DBtype
== 'mssql' ) {
1707 "# MSSQL specific settings
1708 \$wgDBprefix = \"{$slconf['DBprefix2']}\";";
1709 } elseif( $conf->DBtype
== 'ibm_db2' ) {
1711 "# DB2 specific settings
1712 \$wgDBport_db2 = \"{$slconf['DBport_db2']}\";
1713 \$wgDBmwschema = \"{$slconf['DBmwschema']}\";
1714 \$wgDBcataloged = \"{$slconf['DBcataloged']}\";";
1722 # This file was automatically generated by the MediaWiki installer.
1723 # If you make manual changes, please keep track in case you need to
1724 # recreate them later.
1726 # See includes/DefaultSettings.php for all configurable settings
1727 # and their default values, but don't forget to make changes in _this_
1730 # Further documentation for configuration settings may be found at:
1731 # http://www.mediawiki.org/wiki/Manual:Configuration_settings
1733 # If you customize your file layout, set \$IP to the directory that contains
1734 # the other MediaWiki files. It will be used as a base to locate files.
1735 if( defined( 'MW_INSTALL_PATH' ) ) {
1736 \$IP = MW_INSTALL_PATH;
1738 \$IP = dirname( __FILE__ );
1741 \$path = array( \$IP, \"\$IP/includes\", \"\$IP/languages\" );
1742 set_include_path( implode( PATH_SEPARATOR, \$path ) . PATH_SEPARATOR . get_include_path() );
1744 require_once( \"\$IP/includes/DefaultSettings.php\" );
1746 # If PHP's memory limit is very low, some operations may fail.
1747 " . ($conf->raiseMemory ?
'' : '# ' ) . "ini_set( 'memory_limit', '20M' );" . "
1749 if ( \$wgCommandLineMode ) {
1750 if ( isset( \$_SERVER ) && array_key_exists( 'REQUEST_METHOD', \$_SERVER ) ) {
1751 die( \"This script must be run from the command line\\n\" );
1754 ## Uncomment this to disable output compression
1755 # \$wgDisableOutputCompression = true;
1757 \$wgSitename = \"{$slconf['Sitename']}\";
1759 ## The URL base path to the directory containing the wiki;
1760 ## defaults for all runtime URL paths are based off of this.
1761 ## For more information on customizing the URLs please see:
1762 ## http://www.mediawiki.org/wiki/Manual:Short_URL
1763 \$wgScriptPath = \"{$slconf['ScriptPath']}\";
1764 \$wgScriptExtension = \"{$slconf['ScriptExtension']}\";
1766 ## UPO means: this is also a user preference option
1768 \$wgEnableEmail = $enableemail;
1769 \$wgEnableUserEmail = $enableuseremail; # UPO
1771 \$wgEmergencyContact = \"{$slconf['EmergencyContact']}\";
1772 \$wgPasswordSender = \"{$slconf['PasswordSender']}\";
1774 \$wgEnotifUserTalk = $enotifusertalk; # UPO
1775 \$wgEnotifWatchlist = $enotifwatchlist; # UPO
1776 \$wgEmailAuthentication = $eauthent;
1778 ## Database settings
1779 \$wgDBtype = \"{$slconf['DBtype']}\";
1780 \$wgDBserver = \"{$slconf['DBserver']}\";
1781 \$wgDBname = \"{$slconf['DBname']}\";
1782 \$wgDBuser = \"{$slconf['DBuser']}\";
1783 \$wgDBpassword = \"{$slconf['DBpassword']}\";
1787 ## Shared memory settings
1788 \$wgMainCacheType = $cacheType;
1789 \$wgMemCachedServers = $mcservers;
1791 ## To enable image uploads, make sure the 'images' directory
1792 ## is writable, then set this to true:
1793 \$wgEnableUploads = false;
1794 {$magic}\$wgUseImageMagick = true;
1795 {$magic}\$wgImageMagickConvertCommand = \"{$convert}\";
1797 ## If you use ImageMagick (or any other shell command) on a
1798 ## Linux server, this will need to be set to the name of an
1799 ## available UTF-8 locale
1800 {$locale}\$wgShellLocale = \"{$slconf['ShellLocale']}\";
1802 ## If you want to use image uploads under safe mode,
1803 ## create the directories images/archive, images/thumb and
1804 ## images/temp, and make them all writable. Then uncomment
1805 ## this, if it's not already uncommented:
1806 {$hashedUploads}\$wgHashedUploadDirectory = false;
1808 ## If you have the appropriate support software installed
1809 ## you can enable inline LaTeX equations:
1812 \$wgLocalInterwiki = strtolower( \$wgSitename );
1814 \$wgLanguageCode = \"{$slconf['LanguageCode']}\";
1816 \$wgSecretKey = \"$secretKey\";
1818 ## Default skin: you can change the default skin. Use the internal symbolic
1819 ## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook':
1820 \$wgDefaultSkin = 'monobook';
1822 ## For attaching licensing metadata to pages, and displaying an
1823 ## appropriate copyright notice / icon. GNU Free Documentation
1824 ## License and Creative Commons licenses are supported so far.
1825 {$rights}\$wgEnableCreativeCommonsRdf = true;
1826 \$wgRightsPage = \"\"; # Set to the title of a wiki page that describes your license/copyright
1827 \$wgRightsUrl = \"{$slconf['RightsUrl']}\";
1828 \$wgRightsText = \"{$slconf['RightsText']}\";
1829 \$wgRightsIcon = \"{$slconf['RightsIcon']}\";
1830 # \$wgRightsCode = \"{$slconf['RightsCode']}\"; # Not yet used
1832 \$wgDiff3 = \"{$slconf['diff3']}\";
1834 # When you make changes to this configuration file, this will make
1835 # sure that cached pages are cleared.
1836 \$wgCacheEpoch = max( \$wgCacheEpoch, gmdate( 'YmdHis', @filemtime( __FILE__ ) ) );
1837 "; ## End of setting the $localsettings string
1839 // Keep things in Unix line endings internally;
1840 // the system will write out as local text type.
1841 return str_replace( "\r\n", "\n", $localsettings );
1844 function dieout( $text ) {
1845 global $mainListOpened;
1846 if( $mainListOpened ) echo( "</ul>" );
1847 if( $text != '' && substr( $text, 0, 2 ) != '<p' && substr( $text, 0, 2 ) != '<h' ){
1848 echo "<p>$text</p>\n";
1852 die( "\n\n</div>\n</div>\n</div>\n</div>\n</body>\n</html>" );
1855 function importVar( &$var, $name, $default = "" ) {
1856 if( isset( $var[$name] ) ) {
1857 $retval = $var[$name];
1858 if ( get_magic_quotes_gpc() ) {
1859 $retval = stripslashes( $retval );
1868 function importPost( $name, $default = "" ) {
1869 return importVar( $_POST, $name, $default );
1872 function importCheck( $name ) {
1873 return isset( $_POST[$name] );
1876 function importRequest( $name, $default = "" ) {
1877 return importVar( $_REQUEST, $name, $default );
1880 function aField( &$conf, $field, $text, $type = "text", $value = "", $onclick = '' ) {
1881 static $radioCount = 0;
1883 $xtype = "type=\"$type\"";
1889 $nolabel = ($type == "radio") ||
($type == "hidden");
1891 if ($type == 'radio')
1892 $id .= $radioCount++
;
1895 echo "<label class='column' for=\"$id\">$text</label>";
1898 if( $type == "radio" && $value == $conf->$field ) {
1899 $checked = "checked='checked'";
1903 echo "<input $xtype name=\"$field\" id=\"$id\" class=\"iput-$type\" $checked ";
1905 echo " onclick='toggleDBarea(\"$value\",1)' " ;
1908 if( $type == "radio" ) {
1909 echo htmlspecialchars( $value );
1911 echo htmlspecialchars( $conf->$field );
1917 echo "<label for=\"$id\">$text</label>";
1921 if(isset($errs[$field])) {
1922 echo "<span class='error'>" . htmlspecialchars( $errs[$field] ) . "</span>\n";
1926 function getLanguageList() {
1927 global $wgLanguageNames, $IP;
1928 if( !isset( $wgLanguageNames ) ) {
1929 require_once( "$IP/languages/Names.php" );
1934 $d = opendir( "../languages/messages" );
1935 /* In case we are called from the root directory */
1937 $d = opendir( "languages/messages");
1938 while( false !== ($f = readdir( $d ) ) ) {
1940 if( preg_match( '/Messages([A-Z][a-z_]+)\.php$/', $f, $m ) ) {
1941 $code = str_replace( '_', '-', strtolower( $m[1] ) );
1942 if( isset( $wgLanguageNames[$code] ) ) {
1943 $name = $code . ' - ' . $wgLanguageNames[$code];
1947 $codes[$code] = $name;
1955 #Check for location of an executable
1956 # @param string $loc single location to check
1957 # @param array $names filenames to check for.
1958 # @param mixed $versioninfo array of details to use when checking version, use false for no version checking
1959 function locate_executable($loc, $names, $versioninfo = false) {
1960 if (!is_array($names))
1961 $names = array($names);
1963 foreach ($names as $name) {
1964 $command = "$loc".DIRECTORY_SEPARATOR
."$name";
1965 if (@file_exists
($command)) {
1969 $file = str_replace('$1', $command, $versioninfo[0]);
1970 if (strstr(`
$file`
, $versioninfo[1]) !== false)
1977 # Test a memcached server
1978 function testMemcachedServer( $server ) {
1979 $hostport = explode(":", $server);
1982 if ( !function_exists( 'fsockopen' ) ) {
1983 $errstr = "Can't connect to memcached, fsockopen() not present";
1985 if ( !$errstr && count( $hostport ) != 2 ) {
1986 $errstr = 'Please specify host and port';
1989 list( $host, $port ) = $hostport;
1993 $fp = @fsockopen
( $host, $port, $errno, $fsockerr, 1.0 );
1994 if ( $fp === false ) {
1995 $errstr = "Cannot connect to memcached on $host:$port : $fsockerr";
1999 $command = "version\r\n";
2000 $bytes = fwrite( $fp, $command );
2001 if ( $bytes != strlen( $command ) ) {
2002 $errstr = "Cannot write to memcached socket on $host:$port";
2006 $expected = "VERSION ";
2007 $response = fread( $fp, strlen( $expected ) );
2008 if ( $response != $expected ) {
2009 $errstr = "Didn't get correct memcached response from $host:$port";
2016 echo "<li>Connected to memcached on " . htmlspecialchars( "$host:$port" ) ." successfully</li>";
2021 function database_picker($conf) {
2024 foreach(array_keys($ourdb) as $db) {
2025 if ($ourdb[$db]['havedriver']) {
2027 aField( $conf, "DBtype", $ourdb[$db]['fullname'], 'radio', $db, 'onclick');
2034 function database_switcher($db) {
2036 $color = $ourdb[$db]['bgcolor'];
2037 $full = $ourdb[$db]['fullname'];
2038 print "<fieldset id='$db'><legend>$full specific options</legend>\n";
2041 function printListItem( $item ) {
2042 print "<li>$item</li>";
2045 # Determine a suitable value for $wgShellLocale
2046 function getShellLocale( $wikiLang ) {
2047 # Give up now if we're in safe mode or open_basedir
2048 # It's theoretically possible but tricky to work with
2049 if ( wfIniGetBool( "safe_mode" ) ||
ini_get( 'open_basedir' ) ) {
2053 $os = php_uname( 's' );
2054 $supported = array( 'Linux', 'SunOS', 'HP-UX' ); # Tested these
2055 if ( !in_array( $os, $supported ) ) {
2059 # Get a list of available locales
2060 $lines = $ret = false;
2061 exec( '/usr/bin/locale -a', $lines, $ret );
2066 $lines = wfArrayMap( 'trim', $lines );
2067 $candidatesByLocale = array();
2068 $candidatesByLang = array();
2069 foreach ( $lines as $line ) {
2070 if ( $line === '' ) {
2073 if ( !preg_match( '/^([a-zA-Z]+)(_[a-zA-Z]+|)\.(utf8|UTF-8)(@[a-zA-Z_]*|)$/i', $line, $m ) ) {
2076 list( $all, $lang, $territory, $charset, $modifier ) = $m;
2077 $candidatesByLocale[$m[0]] = $m;
2078 $candidatesByLang[$lang][] = $m;
2081 # Try the current value of LANG
2082 if ( isset( $candidatesByLocale[ getenv( 'LANG' ) ] ) ) {
2083 return getenv( 'LANG' );
2086 # Try the most common ones
2087 $commonLocales = array( 'en_US.UTF-8', 'en_US.utf8', 'de_DE.UTF-8', 'de_DE.utf8' );
2088 foreach ( $commonLocales as $commonLocale ) {
2089 if ( isset( $candidatesByLocale[$commonLocale] ) ) {
2090 return $commonLocale;
2094 # Is there an available locale in the Wiki's language?
2095 if ( isset( $candidatesByLang[$wikiLang] ) ) {
2096 $m = reset( $candidatesByLang[$wikiLang] );
2100 # Are there any at all?
2101 if ( count( $candidatesByLocale ) ) {
2102 $m = reset( $candidatesByLocale );
2110 function wfArrayMap( $function, $input ) {
2111 $ret = array_map( $function, $input );
2112 foreach ( $ret as $key => $value ) {
2113 $taint = istainted( $input[$key] );
2115 taint( $ret[$key], $taint );
2123 <div
class="license">
2125 <p
>This program is free software
; you can redistribute it
and/or modify
2126 it under the terms of the GNU General
Public License
as published by
2127 the Free Software Foundation
; either version
2 of the License
, or
2128 (at your option
) any later version
.</p
>
2130 <p
>This program is distributed in the hope that it will be useful
,
2131 but WITHOUT ANY WARRANTY
; without even the implied warranty of
2132 MERCHANTABILITY
or FITNESS
FOR A PARTICULAR PURPOSE
. See the
2133 GNU General
Public License
for more details
.</p
>
2135 <p
>You should have received
<a href
="../COPYING">a copy of the GNU General
Public License
</a
>
2136 along with this program
; if not
, write to the Free Software
2137 Foundation
, Inc
., 51 Franklin Street
, Fifth Floor
, Boston
, MA
02110-1301, USA
.
2138 or <a href
="http://www.gnu.org/copyleft/gpl.html">read it online
</a
></p
>
2144 <div id
="column-one">
2145 <div
class="portlet" id
="p-logo">
2146 <a style
="background-image: url(../skins/common/images/mediawiki.png);"
2148 title
="Main Page"></a
>
2150 <script type
="text/javascript"> if (window
.isMSIE55
) fixalpha(); </script
>
2151 <div
class='portlet'><div
class='pBody'>
2153 <li
><a href
="../README">Readme
</a
></li
>
2154 <li
><a href
="../RELEASE-NOTES">Release notes
</a
></li
>
2155 <li
><a href
="../docs/">Documentation
</a
></li
>
2156 <li
><a href
="http://www.mediawiki.org/wiki/Help:Contents">User
's Guide</a></li>
2157 <li><a href="http://www.mediawiki.org/wiki/Manual:Contents">Administrator's Guide
</a
></li
>
2158 <li
><a href
="http://www.mediawiki.org/wiki/Manual:FAQ">FAQ
</a
></li
>
2160 <p style
="font-size:90%;margin-top:1em">MediaWiki is Copyright ©
2001-2009 by Magnus Manske
, Brion Vibber
,
2161 Lee Daniel Crocker
, Tim Starling
, Erik Möller
, Gabriel Wicke
, Æ
var Arnfjörð Bjarmason
, Niklas Laxström
,
2162 Domas Mituzas
, Rob Church
, Yuri Astrakhan
, Aryeh Gregor
, Aaron Schulz
and others
.</p
>