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" );
51 # If we get an exception, the user needs to know
53 $wgShowExceptionDetails = true;
55 ## Databases we support:
58 $ourdb['mysql']['fullname'] = 'MySQL';
59 $ourdb['mysql']['havedriver'] = 0;
60 $ourdb['mysql']['compile'] = 'mysql';
61 $ourdb['mysql']['bgcolor'] = '#ffe5a7';
62 $ourdb['mysql']['rootuser'] = 'root';
64 $ourdb['postgres']['fullname'] = 'PostgreSQL';
65 $ourdb['postgres']['havedriver'] = 0;
66 $ourdb['postgres']['compile'] = 'pgsql';
67 $ourdb['postgres']['bgcolor'] = '#aaccff';
68 $ourdb['postgres']['rootuser'] = 'postgres';
70 $ourdb['sqlite']['fullname'] = 'SQLite';
71 $ourdb['sqlite']['havedriver'] = 0;
72 $ourdb['sqlite']['compile'] = 'pdo_sqlite';
73 $ourdb['sqlite']['bgcolor'] = '#b1ebb1';
74 $ourdb['sqlite']['rootuser'] = '';
76 $ourdb['mssql']['fullname'] = 'MSSQL';
77 $ourdb['mssql']['havedriver'] = 0;
78 $ourdb['mssql']['compile'] = 'mssql not ready'; # Change to 'mssql' after includes/DatabaseMssql.php added;
79 $ourdb['mssql']['bgcolor'] = '#ffc0cb';
80 $ourdb['mssql']['rootuser'] = 'administrator';
82 $ourdb['ibm_db2']['fullname'] = 'DB2';
83 $ourdb['ibm_db2']['havedriver'] = 0;
84 $ourdb['ibm_db2']['compile'] = 'ibm_db2';
85 $ourdb['ibm_db2']['bgcolor'] = '#ffeba1';
86 $ourdb['ibm_db2']['rootuser'] = 'db2admin';
89 <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
90 <html xmlns
="http://www.w3.org/1999/xhtml" xml
:lang
="en" lang
="en" dir
="ltr">
92 <meta http
-equiv
="Content-type" content
="text/html; charset=utf-8" />
93 <title
>MediaWiki
<?php
echo( $wgVersion ); ?
> Installation
</title
>
94 <style type
="text/css">
96 @import
"../skins/monobook/main.css";
100 margin
: 1em
0 1em
2.5em
;
107 .config
-section label
.column
{
119 zoom
: 100%
; /* IE hack */
122 .config
-section
.config
-desc
{
124 margin
: 0 0 2em
18em
;
129 .iput
-text
, .iput
-password
{
136 background
-color
: #fff;
144 background
-color
: #FFF0F0;
145 border
: 2px solid red
;
153 list-style
-type
: none
;
154 list-style
-image
: none
;
171 span
.success
-message
{
181 <script type
="text/javascript">
184 <?php
foreach (array_keys($ourdb) as $db) {
185 echo "\n var i = document.getElementById('$db'); if (i) i.style.display='none';";
190 function toggleDBarea(id
,defaultroot
) {
192 var dbarea
= document
.getElementById(id
);
193 if (dbarea
) dbarea
.style
.display
= (dbarea
.style
.display
== 'none') ?
'block' : 'none';
194 var db
= document
.getElementById('RootUser');
196 <?php
foreach (array_keys($ourdb) as $db) {
197 echo " if (id == '$db') { db.value = '".$ourdb[$db]['rootuser']."';}\n";
206 <div id
="globalWrapper">
207 <div id
="column-content">
209 <div id
="bodyContent">
211 <h1
>MediaWiki
<?php
print $wgVersion ?
> Installation
</h1
>
214 $mainListOpened = false; # Is the main list (environement checking) opend ? Used by dieout
216 /* Check for existing configurations and bug out! */
218 if( file_exists( "../LocalSettings.php" ) ) {
219 $script = defined('MW_INSTALL_PHP5_EXT') ?
'index.php5' : 'index.php';
220 dieout( "<p><strong>Setup has completed, <a href='../$script'>your wiki</a> is configured.</strong></p>
221 <p>Please delete the /config directory for extra security.</p>" );
224 if( file_exists( "./LocalSettings.php" ) ) {
225 writeSuccessMessage();
229 if( !is_writable( "." ) ) {
230 dieout( "<h2>Can't write config file, aborting</h2>
232 <p>In order to configure the wiki you have to make the <tt>config</tt> subdirectory
233 writable by the web server. Once configuration is done you'll move the created
234 <tt>LocalSettings.php</tt> to the parent directory, and for added safety you can
235 then remove the <tt>config</tt> subdirectory entirely.</p>
237 <p>To make the directory writable on a Unix/Linux system:</p>
240 cd <i>/path/to/wiki</i>
244 <p>Afterwards retry to start the <a href=\"\">setup</a>.</p>" );
248 require_once( "$IP/install-utils.inc" );
249 require_once( "$IP/maintenance/updaters.inc" );
252 function getEncoded( $data ) {
253 # removing latin1 support, no need...
256 function getSitename() { return $this->getEncoded( $this->Sitename
); }
257 function getSysopName() { return $this->getEncoded( $this->SysopName
); }
258 function getSysopPass() { return $this->getEncoded( $this->SysopPass
); }
260 function setSchema( $schema, $engine ) {
261 $this->DBschema
= $schema;
262 if ( !preg_match( '/^\w*$/', $engine ) ){
265 switch ( $this->DBschema
) {
267 $this->DBTableOptions
= "ENGINE=$engine, DEFAULT CHARSET=utf8";
268 $this->DBmysql5
= 'true';
270 case 'mysql5-binary':
271 $this->DBTableOptions
= "ENGINE=$engine, DEFAULT CHARSET=binary";
272 $this->DBmysql5
= 'true';
275 $this->DBTableOptions
= "TYPE=$engine";
276 $this->DBmysql5
= 'false';
278 $this->DBengine
= $engine;
280 # Set the global for use during install
281 global $wgDBTableOptions;
282 $wgDBTableOptions = $this->DBTableOptions
;
290 <b
>Don
't forget security updates!</b> Keep an eye on the
291 <a href="http://lists.wikimedia.org/mailman/listinfo/mediawiki-announce">low-traffic
292 release announcements mailing list</a>.
297 <h2>Checking environment...</h2>
298 <p><em>Please include all of the lines below when reporting installation problems.</em></p>
299 <ul class="env-check">
301 $mainListOpened = true;
305 define( 'MW_NO_OUTPUT_BUFFER
', 1 );
306 $conf = new ConfigData;
308 install_version_checks();
309 $self = 'Installer
'; # Maintenance script name, to please Setup.php
311 print "<li>PHP " . phpversion() . " installed</li>\n";
313 error_reporting( 0 );
314 $phpdatabases = array();
315 foreach (array_keys($ourdb) as $db) {
316 $compname = $ourdb[$db]['compile
'];
317 if( extension_loaded( $compname ) || ( mw_have_dl() && dl( "{$compname}." . PHP_SHLIB_SUFFIX ) ) ) {
318 array_push($phpdatabases, $db);
319 $ourdb[$db]['havedriver
'] = 1;
322 error_reporting( E_ALL );
324 if (!$phpdatabases) {
325 print "Could not find a suitable database driver!<ul>";
326 foreach (array_keys($ourdb) AS $db) {
327 $comp = $ourdb[$db]['compile
'];
328 $full = $ourdb[$db]['fullname
'];
329 print "<li>For <b>$full</b>, compile PHP using <b>--with-$comp</b>, "
330 ."or install the $comp.so module</li>\n";
336 print "<li>Found database drivers for:";
338 foreach (array_keys($ourdb) AS $db) {
339 if ($ourdb[$db]['havedriver
']) {
340 if ( $DefaultDBtype == '' ) {
341 $DefaultDBtype = $db;
343 print " ".$ourdb[$db]['fullname
'];
348 if( wfIniGetBool( "register_globals" ) ) {
351 <div style="font-size:110%">
352 <strong class="error">Warning:</strong>
353 <strong>PHP's
<tt
><a href
="http://php.net/register_globals">register_globals
</a
></tt
> option is enabled
. Disable it
if you can
.</strong
>
355 MediaWiki will work
, but your server is more exposed to PHP
-based security vulnerabilities
.
362 if( wfIniGetBool( "magic_quotes_runtime" ) ) {
364 ?
><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
>
365 This option corrupts data input unpredictably
; you cannot install
or use
366 MediaWiki unless this option is disabled
.</li
>
370 if( wfIniGetBool( "magic_quotes_sybase" ) ) {
372 ?
><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
>
373 This option corrupts data input unpredictably
; you cannot install
or use
374 MediaWiki unless this option is disabled
.</li
>
378 if( wfIniGetBool( "mbstring.func_overload" ) ) {
380 ?
><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
>
381 This option causes errors
and may corrupt data unpredictably
;
382 you cannot install
or use MediaWiki unless this option is disabled
.</li
>
386 if( wfIniGetBool( "zend.ze1_compatibility_mode" ) ) {
388 ?
><li
class="error"><strong
>Fatal
: <a href
="http://www.php.net/manual/en/ini.core.php">zend
.ze1_compatibility_mode
</a
> is active
!</strong
>
389 This option causes horrible bugs with MediaWiki
; you cannot install
or use
390 MediaWiki unless this option is disabled
.</li
>
396 dieout( "Cannot install MediaWiki." );
399 if( wfIniGetBool( "safe_mode" ) ) {
400 $conf->safeMode
= true;
402 <li
><b
class='error'>Warning
:</b
> <strong
>PHP
's
403 <a href='http
://www.php.net/features.safe-mode'>safe mode</a> is active.</strong>
404 You may have problems caused by this
, particularly
if using image uploads
.
408 $conf->safeMode
= false;
411 $sapi = php_sapi_name();
412 print "<li>PHP server API is $sapi; ";
413 $script = defined('MW_INSTALL_PHP5_EXT') ?
'index.php5' : 'index.php';
414 if( $wgUsePathInfo ) {
415 print "ok, using pretty URLs (<tt>$script/Page_Title</tt>)";
417 print "using ugly URLs (<tt>$script?title=Page_Title</tt>)";
421 $conf->xml
= function_exists( "utf8_encode" );
423 print "<li>Have XML / Latin1-UTF-8 conversion support.</li>\n";
425 dieout( "PHP's XML module is missing; the wiki requires functions in
426 this module and won't work in this configuration.
427 If you're running Mandrake, install the php-xml package." );
430 # Check for session support
431 if( !function_exists( 'session_name' ) )
432 dieout( "PHP's session module is missing. MediaWiki requires session support in order to function." );
434 # session.save_path doesn't *have* to be set, but if it is, and it's
435 # not valid/writable/etc. then it can cause problems
436 $sessionSavePath = mw_get_session_save_path();
437 $ssp = htmlspecialchars( $sessionSavePath );
438 # Warn the user if it's not set, but let them proceed
439 if( !$sessionSavePath ) {
440 print "<li><strong>Warning:</strong> A value for <tt>session.save_path</tt>
441 has not been set in PHP.ini. If the default value causes problems with
442 saving session data, set it to a valid path which is read/write/execute
443 for the user your web server is running under.</li>";
444 } elseif ( is_dir( $sessionSavePath ) && is_writable( $sessionSavePath ) ) {
445 # All good? Let the user know
446 print "<li>Session save path (<tt>{$ssp}</tt>) appears to be valid.</li>";
448 # Something not right? Warn the user, but let them proceed
449 print "<li><strong>Warning:</strong> Your <tt>session.save_path</tt> value (<tt>{$ssp}</tt>)
450 appears to be invalid or is not writable. PHP needs to be able to save data to
451 this location for correct session operation.</li>";
454 # Check for PCRE support
455 if( !function_exists( 'preg_match' ) )
456 dieout( "The PCRE support module appears to be missing. MediaWiki requires the
457 Perl-compatible regular expression functions." );
459 $memlimit = ini_get( "memory_limit" );
460 $conf->raiseMemory
= false;
461 if( empty( $memlimit ) ||
$memlimit == -1 ) {
462 print "<li>PHP is configured with no <tt>memory_limit</tt>.</li>\n";
464 print "<li>PHP's <tt>memory_limit</tt> is " . htmlspecialchars( $memlimit ) . ". ";
465 $n = intval( $memlimit );
466 if( preg_match( '/^([0-9]+)[Mm]$/', trim( $memlimit ), $m ) ) {
467 $n = intval( $m[1] * (1024*1024) );
469 if( $n < 20*1024*1024 ) {
470 print "Attempting to raise limit to 20M... ";
471 if( false === ini_set( "memory_limit", "20M" ) ) {
472 print "failed.<br /><b>" . htmlspecialchars( $memlimit ) . " seems too low, installation may fail!</b>";
474 $conf->raiseMemory
= true;
481 $conf->turck
= function_exists( 'mmcache_get' );
482 if ( $conf->turck
) {
483 print "<li><a href=\"http://turck-mmcache.sourceforge.net/\">Turck MMCache</a> installed</li>\n";
486 $conf->xcache
= function_exists( 'xcache_get' );
488 print "<li><a href=\"http://trac.lighttpd.net/xcache/\">XCache</a> installed</li>\n";
490 $conf->apc
= function_exists('apc_fetch');
492 print "<li><a href=\"http://www.php.net/apc\">APC</a> installed</li>\n";
495 $conf->eaccel
= function_exists( 'eaccelerator_get' );
496 if ( $conf->eaccel
) {
497 $conf->turck
= 'eaccelerator';
498 print "<li><a href=\"http://eaccelerator.sourceforge.net/\">eAccelerator</a> installed</li>\n";
501 $conf->dba
= function_exists( 'dba_open' );
503 if( !( $conf->turck ||
$conf->eaccel ||
$conf->apc ||
$conf->xcache
) ) {
504 echo( '<li>Couldn\'t find <a href="http://turck-mmcache.sourceforge.net">Turck MMCache</a>,
505 <a href="http://eaccelerator.sourceforge.net">eAccelerator</a>,
506 <a href="http://www.php.net/apc">APC</a> or <a href="http://trac.lighttpd.net/xcache/">XCache</a>;
507 cannot use these for object caching.</li>' );
510 $conf->diff3
= false;
511 $diff3locations = array_merge(
518 explode( PATH_SEPARATOR
, getenv( "PATH" ) ) );
519 $diff3names = array( "gdiff3", "diff3", "diff3.exe" );
521 $diff3versioninfo = array( '$1 --version 2>&1', 'diff3 (GNU diffutils)' );
522 foreach ($diff3locations as $loc) {
523 $exe = locate_executable($loc, $diff3names, $diff3versioninfo);
524 if ($exe !== false) {
531 print "<li>Found GNU diff3: <tt>$conf->diff3</tt>.</li>";
533 print "<li>GNU diff3 not found.</li>";
535 $conf->ImageMagick
= false;
536 $imcheck = array( "/usr/bin", "/opt/csw/bin", "/usr/local/bin", "/sw/bin", "/opt/local/bin" );
537 foreach( $imcheck as $dir ) {
538 $im = "$dir/convert";
539 if( @file_exists
( $im ) ) {
540 print "<li>Found ImageMagick: <tt>$im</tt>; image thumbnailing will be enabled if you enable uploads.</li>\n";
541 $conf->ImageMagick
= $im;
546 $conf->HaveGD
= function_exists( "imagejpeg" );
547 if( $conf->HaveGD
) {
548 print "<li>Found GD graphics library built-in";
549 if( !$conf->ImageMagick
) {
550 print ", image thumbnailing will be enabled if you enable uploads";
554 if( !$conf->ImageMagick
) {
555 print "<li>Couldn't find GD library or ImageMagick; image thumbnailing disabled.</li>\n";
559 $conf->IP
= dirname( dirname( __FILE__
) );
560 print "<li>Installation directory: <tt>" . htmlspecialchars( $conf->IP
) . "</tt></li>\n";
563 // PHP_SELF isn't available sometimes, such as when PHP is CGI but
564 // cgi.fix_pathinfo is disabled. In that case, fall back to SCRIPT_NAME
565 // to get the path to the current script... hopefully it's reliable. SIGH
566 $path = ($_SERVER["PHP_SELF"] === '')
567 ?
$_SERVER["SCRIPT_NAME"]
568 : $_SERVER["PHP_SELF"];
570 $conf->ScriptPath
= preg_replace( '{^(.*)/config.*$}', '$1', $path );
571 print "<li>Script URI path: <tt>" . htmlspecialchars( $conf->ScriptPath
) . "</tt></li>\n";
575 // We may be installing from *.php5 extension file, if so, print message
576 $conf->ScriptExtension
= '.php';
577 if (defined('MW_INSTALL_PHP5_EXT')) {
578 $conf->ScriptExtension
= '.php5';
579 print "<li>Installing MediaWiki with <tt>php5</tt> file extensions</li>\n";
581 print "<li>Installing MediaWiki with <tt>php</tt> file extensions</li>\n";
585 print "<li style='font-weight:bold;color:green;font-size:110%'>Environment checked. You can install MediaWiki.</li>\n";
586 $conf->posted
= ($_SERVER["REQUEST_METHOD"] == "POST");
588 $conf->Sitename
= ucfirst( importPost( "Sitename", "" ) );
589 $defaultEmail = empty( $_SERVER["SERVER_ADMIN"] )
591 : $_SERVER["SERVER_ADMIN"];
592 $conf->EmergencyContact
= importPost( "EmergencyContact", $defaultEmail );
593 $conf->DBtype
= importPost( "DBtype", $DefaultDBtype );
595 $conf->DBserver
= importPost( "DBserver", "localhost" );
596 $conf->DBname
= importPost( "DBname", "wikidb" );
597 $conf->DBuser
= importPost( "DBuser", "wikiuser" );
598 $conf->DBpassword
= importPost( "DBpassword" );
599 $conf->DBpassword2
= importPost( "DBpassword2" );
600 $conf->SysopName
= importPost( "SysopName", "WikiSysop" );
601 $conf->SysopPass
= importPost( "SysopPass" );
602 $conf->SysopPass2
= importPost( "SysopPass2" );
603 $conf->RootUser
= importPost( "RootUser", "root" );
604 $conf->RootPW
= importPost( "RootPW", "" );
605 $useRoot = importCheck( 'useroot', false );
606 $conf->LanguageCode
= importPost( "LanguageCode", "en" );
608 $conf->DBprefix
= importPost( "DBprefix" );
610 importPost( "DBschema", "mysql5-binary" ),
611 importPost( "DBengine", "InnoDB" ) );
613 ## Postgres specific:
614 $conf->DBport
= importPost( "DBport", "5432" );
615 $conf->DBmwschema
= importPost( "DBmwschema", "mediawiki" );
616 $conf->DBts2schema
= importPost( "DBts2schema", "public" );
619 $conf->SQLiteDataDir
= importPost( "SQLiteDataDir", "" );
622 // We need a second field so it doesn't overwrite the MySQL one
623 $conf->DBprefix2
= importPost( "DBprefix2" );
626 // New variable in order to have a different default port number
627 $conf->DBport_db2
= importPost( "DBport_db2", "50000" );
628 $conf->DBmwschema
= importPost( "DBmwschema", "mediawiki" );
629 $conf->DBcataloged
= importPost( "DBcataloged", "cataloged" );
631 $conf->ShellLocale
= getShellLocale( $conf->LanguageCode
);
633 /* Check for validity */
636 if( preg_match( '/^$|^mediawiki$|#/i', $conf->Sitename
) ) {
637 $errs["Sitename"] = "Must not be blank or \"MediaWiki\" and may not contain \"#\"";
639 if( $conf->DBuser
== "" ) {
640 $errs["DBuser"] = "Must not be blank";
642 if( ($conf->DBtype
== 'mysql') && (strlen($conf->DBuser
) > 16) ) {
643 $errs["DBuser"] = "Username too long";
645 if( $conf->DBpassword
== "" && $conf->DBtype
!= "postgres" ) {
646 $errs["DBpassword"] = "Must not be blank";
648 if( $conf->DBpassword
!= $conf->DBpassword2
) {
649 $errs["DBpassword2"] = "Passwords don't match!";
651 if( !preg_match( '/^[A-Za-z_0-9]*$/', $conf->DBprefix
) ) {
652 $errs["DBprefix"] = "Invalid table prefix";
655 error_reporting( E_ALL
);
658 * Initialise $wgLang and $wgContLang to something so we can
659 * call case-folding methods. Per Brion, this is English for
660 * now, although we could be clever and initialise to the
661 * user-selected language.
663 $wgContLang = Language
::factory( 'en' );
664 $wgLang = $wgContLang;
667 * We're messing about with users, so we need a stub
668 * authentication plugin...
670 $wgAuth = new AuthPlugin();
673 * Validate the initial administrator account; username,
674 * password checks, etc.
676 if( $conf->SysopName
) {
677 # Check that the user can be created
678 $u = User
::newFromName( $conf->SysopName
);
679 if( is_a($u, 'User') ) { // please do not use instanceof, it breaks PHP4
680 # Various password checks
681 if( $conf->SysopPass
!= '' ) {
682 if( $conf->SysopPass
== $conf->SysopPass2
) {
683 if( !$u->isValidPassword( $conf->SysopPass
) ) {
684 $errs['SysopPass'] = "Bad password";
687 $errs['SysopPass2'] = "Passwords don't match";
690 $errs['SysopPass'] = "Cannot be blank";
694 $errs['SysopName'] = "Bad username";
698 $conf->License
= importRequest( "License", "none" );
699 if( $conf->License
== "gfdl1_2" ) {
700 $conf->RightsUrl
= "http://www.gnu.org/licenses/old-licenses/fdl-1.2.txt";
701 $conf->RightsText
= "GNU Free Documentation License 1.2";
702 $conf->RightsCode
= "gfdl1_2";
703 $conf->RightsIcon
= '${wgScriptPath}/skins/common/images/gnu-fdl.png';
704 } elseif( $conf->License
== "gfdl1_3" ) {
705 $conf->RightsUrl
= "http://www.gnu.org/copyleft/fdl.html";
706 $conf->RightsText
= "GNU Free Documentation License 1.3";
707 $conf->RightsCode
= "gfdl1_3";
708 $conf->RightsIcon
= '${wgScriptPath}/skins/common/images/gnu-fdl.png';
709 } elseif( $conf->License
== "none" ) {
710 $conf->RightsUrl
= $conf->RightsText
= $conf->RightsCode
= $conf->RightsIcon
= "";
711 } elseif( $conf->License
== "pd" ) {
712 $conf->RightsUrl
= "http://creativecommons.org/licenses/publicdomain/";
713 $conf->RightsText
= "Public Domain";
714 $conf->RightsCode
= "pd";
715 $conf->RightsIcon
= '${wgScriptPath}/skins/common/images/public-domain.png';
717 $conf->RightsUrl
= importRequest( "RightsUrl", "" );
718 $conf->RightsText
= importRequest( "RightsText", "" );
719 $conf->RightsCode
= importRequest( "RightsCode", "" );
720 $conf->RightsIcon
= importRequest( "RightsIcon", "" );
723 $conf->Shm
= importRequest( "Shm", "none" );
724 $conf->MCServers
= importRequest( "MCServers" );
726 /* Test memcached servers */
728 if ( $conf->Shm
== 'memcached' && $conf->MCServers
) {
729 $conf->MCServerArray
= array_map( 'trim', explode( ',', $conf->MCServers
) );
730 foreach ( $conf->MCServerArray
as $server ) {
731 $error = testMemcachedServer( $server );
733 $errs["MCServers"] = $error;
737 } else if ( $conf->Shm
== 'memcached' ) {
738 $errs["MCServers"] = "Please specify at least one server if you wish to use memcached";
741 /* default values for installation */
742 $conf->Email
= importRequest("Email", "email_enabled");
743 $conf->Emailuser
= importRequest("Emailuser", "emailuser_enabled");
744 $conf->Enotif
= importRequest("Enotif", "enotif_allpages");
745 $conf->Eauthent
= importRequest("Eauthent", "eauthent_enabled");
747 if( $conf->posted
&& ( 0 == count( $errs ) ) ) {
748 do { /* So we can 'continue' to end prematurely */
749 $conf->Root
= ($conf->RootPW
!= "");
751 /* Load up the settings and get installin' */
752 $local = writeLocalSettings( $conf );
753 echo "<li style=\"list-style: none\">\n";
754 echo "<p><b>Generating configuration file...</b></p>\n";
757 $wgCommandLineMode = false;
759 $ok = eval( $local );
760 if( $ok === false ) {
761 dieout( "<p>Errors in generated configuration; " .
762 "most likely due to a bug in the installer... " .
763 "Config file was: </p>" .
765 htmlspecialchars( $local ) .
768 $conf->DBtypename
= '';
769 foreach (array_keys($ourdb) as $db) {
770 if ($conf->DBtype
=== $db)
771 $conf->DBtypename
= $ourdb[$db]['fullname'];
773 if ( ! strlen($conf->DBtype
)) {
774 $errs["DBpicktype"] = "Please choose a database type";
778 if (! $conf->DBtypename
) {
779 $errs["DBtype"] = "Unknown database type '$conf->DBtype'";
782 print "<li>Database type: {$conf->DBtypename}</li>\n";
783 $dbclass = 'Database'.ucfirst($conf->DBtype
);
784 $wgDBtype = $conf->DBtype
;
785 $wgDBadminuser = "root";
786 $wgDBadminpassword = $conf->RootPW
;
789 $wgDBprefix = $conf->DBprefix
;
791 ## Postgres specific:
792 $wgDBport = $conf->DBport
;
793 $wgDBmwschema = $conf->DBmwschema
;
794 $wgDBts2schema = $conf->DBts2schema
;
796 if( $conf->DBprefix2
!= '' ) {
798 $wgDBprefix = $conf->DBprefix2
;
802 $wgDBcataloged = $conf->DBcataloged
;
804 $wgCommandLineMode = true;
805 if (! defined ( 'STDERR' ) )
806 define( 'STDERR', fopen("php://stderr", "wb"));
807 $wgUseDatabaseMessages = false; /* FIXME: For database failure */
808 require_once( "$IP/includes/Setup.php" );
811 $wgTitle = Title
::newFromText( "Installation script" );
812 error_reporting( E_ALL
);
813 print "<li>Loading class: $dbclass</li>\n";
816 if( $conf->DBtype
== 'mysql' ) {
817 $mysqlOldClient = version_compare( mysql_get_client_info(), "4.1.0", "lt" );
818 if( $mysqlOldClient ) {
819 print "<li><b>PHP is linked with old MySQL client libraries. If you are
820 using a MySQL 4.1 server and have problems connecting to the database,
821 see <a href='http://dev.mysql.com/doc/mysql/en/old-client.html'
822 >http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b></li>\n";
824 $ok = true; # Let's be optimistic
826 # Decide if we're going to use the superuser or the regular database user
827 $conf->Root
= $useRoot;
829 $db_user = $conf->RootUser
;
830 $db_pass = $conf->RootPW
;
832 $db_user = $wgDBuser;
833 $db_pass = $wgDBpassword;
837 echo( "<li>Attempting to connect to database server as $db_user..." );
838 $wgDatabase = Database
::newFromParams( $wgDBserver, $db_user, $db_pass, '', 1 );
840 # Check the connection and respond to errors
841 if( $wgDatabase->isOpen() ) {
844 $wgDBadminuser = $db_user;
845 $wgDBadminpassword = $db_pass;
846 echo( "success.</li>\n" );
847 $wgDatabase->ignoreErrors( true );
848 $myver = $wgDatabase->getServerVersion();
850 # There were errors, report them and back out
852 $errno = mysql_errno();
853 $errtx = htmlspecialchars( mysql_error() );
857 echo( "failed due to authentication errors. Check passwords.</li>" );
859 # The superuser details are wrong
860 $errs["RootUser"] = "Check username";
861 $errs["RootPW"] = "and password";
863 # The regular user details are wrong
864 $errs["DBuser"] = "Check username";
865 $errs["DBpassword"] = "and password";
871 # General connection problem
872 echo( "failed with error [$errno] $errtx.</li>\n" );
873 $errs["DBserver"] = "Connection failed";
878 if( !$ok ) { continue; }
880 else if( $conf->DBtype
== 'ibm_db2' ) {
882 $db_user = $conf->RootUser
;
883 $db_pass = $conf->RootPW
;
885 $db_user = $wgDBuser;
886 $db_pass = $wgDBpassword;
889 echo( "<li>Attempting to connect to database \"$wgDBname\" as \"$db_user\"..." );
890 $wgDatabase = $dbc->newFromParams($wgDBserver, $db_user, $db_pass, $wgDBname, 1);
891 if (!$wgDatabase->isOpen()) {
892 print " error: " . $wgDatabase->lastError() . "</li>\n";
894 $myver = $wgDatabase->getServerVersion();
896 if (is_callable(array($wgDatabase, 'initial_setup'))) $wgDatabase->initial_setup('', $wgDBname);
899 error_reporting( E_ALL
);
901 ## Possible connect as a superuser
902 // Changed !mysql to postgres check since it seems to only apply to postgres
903 if( $useRoot && $conf->DBtype
== 'postgres' ) {
904 $wgDBsuperuser = $conf->RootUser
;
905 echo( "<li>Attempting to connect to database \"postgres\" as superuser \"$wgDBsuperuser\"..." );
906 $wgDatabase = $dbc->newFromParams($wgDBserver, $wgDBsuperuser, $conf->RootPW
, "postgres", 1);
907 if (!$wgDatabase->isOpen()) {
908 print " error: " . $wgDatabase->lastError() . "</li>\n";
909 $errs["DBserver"] = "Could not connect to database as superuser";
910 $errs["RootUser"] = "Check username";
911 $errs["RootPW"] = "and password";
914 $wgDatabase->initial_setup($conf->RootPW
, 'postgres');
916 echo( "<li>Attempting to connect to database \"$wgDBname\" as \"$wgDBuser\"..." );
917 $wgDatabase = $dbc->newFromParams($wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1);
918 if (!$wgDatabase->isOpen()) {
919 print " error: " . $wgDatabase->lastError() . "</li>\n";
921 $myver = $wgDatabase->getServerVersion();
923 if (is_callable(array($wgDatabase, 'initial_setup'))) $wgDatabase->initial_setup('', $wgDBname);
926 if ( !$wgDatabase->isOpen() ) {
927 $errs["DBserver"] = "Couldn't connect to database";
931 print "<li>Connected to {$conf->DBtype} $myver";
932 if ($conf->DBtype
== 'mysql') {
933 if( version_compare( $myver, "4.0.14" ) < 0 ) {
935 dieout( "-- mysql 4.0.14 or later required. Aborting." );
937 $mysqlNewAuth = version_compare( $myver, "4.1.0", "ge" );
938 if( $mysqlNewAuth && $mysqlOldClient ) {
939 print "; <b class='error'>You are using MySQL 4.1 server, but PHP is linked
940 to old client libraries; if you have trouble with authentication, see
941 <a href='http://dev.mysql.com/doc/mysql/en/old-client.html'
942 >http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b>";
945 if( $mysqlNewAuth ) {
946 print "; enabling MySQL 4.1/5.0 charset mode";
948 print "; <b class='error'>MySQL 4.1/5.0 charset mode enabled,
949 but older version detected; will likely fail.</b>";
954 @$sel = $wgDatabase->selectDB( $wgDBname );
956 print "<li>Database <tt>" . htmlspecialchars( $wgDBname ) . "</tt> exists</li>\n";
958 $err = mysql_errno();
959 $databaseSafe = htmlspecialchars( $wgDBname );
960 if( $err == 1102 /* Invalid database name */ ) {
961 print "<ul><li><strong>{$databaseSafe}</strong> is not a valid database name.</li></ul>";
963 } elseif( $err != 1049 /* Database doesn't exist */ ) {
964 print "<ul><li>Error selecting database <strong>{$databaseSafe}</strong>: {$err} ";
965 print htmlspecialchars( mysql_error() ) . "</li></ul>";
968 print "<li>Attempting to create database...</li>";
969 $res = $wgDatabase->query( "CREATE DATABASE `$wgDBname`" );
971 print "<li>Couldn't create database <tt>" .
972 htmlspecialchars( $wgDBname ) .
973 "</tt>; try with root access or check your username/pass.</li>\n";
974 $errs["RootPW"] = "<- Enter";
977 print "<li>Created database <tt>" . htmlspecialchars( $wgDBname ) . "</tt></li>\n";
979 $wgDatabase->selectDB( $wgDBname );
981 else if ($conf->DBtype
== 'postgres') {
982 if( version_compare( $myver, "8.0" ) < 0 ) {
983 dieout( "<b>Postgres 8.0 or later is required</b>. Aborting." );
987 if( $wgDatabase->tableExists( "cur" ) ||
$wgDatabase->tableExists( "revision" ) ) {
988 print "<li>There are already MediaWiki tables in this database. Checking if updates are needed...</li>\n";
990 if ( $conf->DBtype
== 'mysql') {
991 # Determine existing default character set
992 if ( $wgDatabase->tableExists( "revision" ) ) {
993 $revision = $wgDatabase->escapeLike( $conf->DBprefix
. 'revision' );
994 $res = $wgDatabase->query( "SHOW TABLE STATUS LIKE '$revision'" );
995 $row = $wgDatabase->fetchObject( $res );
997 echo "<li>SHOW TABLE STATUS query failed!</li>\n";
998 $existingSchema = false;
999 $existingEngine = false;
1001 if ( preg_match( '/^latin1/', $row->Collation
) ) {
1002 $existingSchema = 'mysql4';
1003 } elseif ( preg_match( '/^utf8/', $row->Collation
) ) {
1004 $existingSchema = 'mysql5';
1005 } elseif ( preg_match( '/^binary/', $row->Collation
) ) {
1006 $existingSchema = 'mysql5-binary';
1008 $existingSchema = false;
1009 echo "<li><strong>Warning:</strong> Unrecognised existing collation</li>\n";
1011 if ( isset( $row->Engine
) ) {
1012 $existingEngine = $row->Engine
;
1014 $existingEngine = $row->Type
;
1017 if ( $existingSchema && $existingSchema != $conf->DBschema
) {
1018 print "<li><strong>Warning:</strong> you requested the {$conf->DBschema} schema, " .
1019 "but the existing database has the $existingSchema schema. This upgrade script ".
1020 "can't convert it, so it will remain $existingSchema.</li>\n";
1021 $conf->setSchema( $existingSchema, $conf->DBengine
);
1023 if ( $existingEngine && $existingEngine != $conf->DBengine
) {
1024 print "<li><strong>Warning:</strong> you requested the {$conf->DBengine} storage " .
1025 "engine, but the existing database uses the $existingEngine engine. This upgrade " .
1026 "script can't convert it, so it will remain $existingEngine.</li>\n";
1027 $conf->setSchema( $conf->DBschema
, $existingEngine );
1031 # Create user if required
1032 if ( $conf->Root
) {
1033 $conn = $dbc->newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1 );
1034 if ( $conn->isOpen() ) {
1035 print "<li>DB user account ok</li>\n";
1038 print "<li>Granting user permissions...";
1039 if( $mysqlOldClient && $mysqlNewAuth ) {
1040 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>";
1043 dbsource( "../maintenance/users.sql", $wgDatabase );
1047 print "</ul><pre>\n";
1053 print "<ul><li>Finished update checks.</li>\n";
1055 # Determine available storage engines if possible
1056 if ( $conf->DBtype
== 'mysql' && version_compare( $myver, "4.1.2", "ge" ) ) {
1057 $res = $wgDatabase->query( 'SHOW ENGINES' );
1059 while ( $row = $wgDatabase->fetchObject( $res ) ) {
1060 if ( $row->Engine
== $conf->DBengine
) {
1065 $wgDatabase->freeResult( $res );
1066 if ( !$found && $conf->DBengine
!= 'MyISAM' ) {
1067 echo "<li><strong>Warning:</strong> {$conf->DBengine} storage engine not available, " .
1068 "using MyISAM instead</li>\n";
1069 $conf->setSchema( $conf->DBschema
, 'MyISAM' );
1073 # FIXME: Check for errors
1074 print "<li>Creating tables...";
1075 if ($conf->DBtype
== 'mysql') {
1076 dbsource( "../maintenance/tables.sql", $wgDatabase );
1077 dbsource( "../maintenance/interwiki.sql", $wgDatabase );
1078 } elseif (is_callable(array($wgDatabase, 'setup_database'))) {
1079 $wgDatabase->setup_database();
1082 $errs["DBtype"] = "Do not know how to handle database type '$conf->DBtype'";
1086 print " done.</li>\n";
1088 print "<li>Initializing statistics...</li>\n";
1089 $wgDatabase->insert( 'site_stats',
1090 array ( 'ss_row_id' => 1,
1091 'ss_total_views' => 0,
1092 'ss_total_edits' => 1, # Main page first edit
1093 'ss_good_articles' => 0, # Main page is not a good article - no internal link
1094 'ss_total_pages' => 1, # Main page
1095 'ss_users' => $conf->SysopName ?
1 : 0, # Sysop account, if created
1096 'ss_admins' => $conf->SysopName ?
1 : 0, # Sysop account, if created
1097 'ss_images' => 0 ) );
1099 # Set up the "regular user" account *if we can, and if we need to*
1100 if( $conf->Root
and $conf->DBtype
== 'mysql') {
1102 $wgDatabase2 = $dbc->newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1 );
1103 if( $wgDatabase2->isOpen() ) {
1104 # Nope, just close the test connection and continue
1105 $wgDatabase2->close();
1106 echo( "<li>User $wgDBuser exists. Skipping grants.</li>\n" );
1108 # Yes, so run the grants
1109 echo( "<li>Granting user permissions to $wgDBuser on $wgDBname..." );
1110 dbsource( "../maintenance/users.sql", $wgDatabase );
1111 echo( "success.</li>\n" );
1115 if( $conf->SysopName
) {
1116 $u = User
::newFromName( $conf->getSysopName() );
1118 print "<li><strong class=\"error\">Warning:</strong> Skipped sysop account creation - invalid username!</li>\n";
1120 else if ( 0 == $u->idForName() ) {
1121 $u->addToDatabase();
1122 $u->setPassword( $conf->getSysopPass() );
1125 $u->addGroup( "sysop" );
1126 $u->addGroup( "bureaucrat" );
1128 print "<li>Created sysop account <tt>" .
1129 htmlspecialchars( $conf->SysopName
) . "</tt>.</li>\n";
1131 print "<li>Could not create user - already exists!</li>\n";
1134 print "<li>Skipped sysop account creation, no name given.</li>\n";
1137 $titleobj = Title
::newFromText( wfMsgNoDB( "mainpage" ) );
1138 $article = new Article( $titleobj );
1139 $newid = $article->insertOn( $wgDatabase );
1140 $revision = new Revision( array(
1142 'text' => wfMsg( 'mainpagetext' ) . "\n\n" . wfMsgNoTrans( 'mainpagedocfooter' ),
1145 'user_text' => 'MediaWiki default',
1147 $revid = $revision->insertOn( $wgDatabase );
1148 $article->updateRevisionOn( $wgDatabase, $revision );
1150 // Now that all database work is done, make sure everything is committed
1151 $wgDatabase->commit();
1153 /* Write out the config file now that all is well */
1154 print "<li style=\"list-style: none\">\n";
1155 print "<p>Creating LocalSettings.php...</p>\n\n";
1156 $localSettings = "<" . "?php$endl$local";
1157 // Fix up a common line-ending problem (due to CVS on Windows)
1158 $localSettings = str_replace( "\r\n", "\n", $localSettings );
1159 $f = fopen( "LocalSettings.php", 'xt' );
1163 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" .
1164 "<p>Here's the file that would have been written, try to paste it into place manually:</p>\n" .
1165 "<pre>\n" . htmlspecialchars( $localSettings ) . "</pre>\n" );
1167 if(fwrite( $f, $localSettings ) ) {
1170 writeSuccessMessage();
1174 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" );
1181 $mainListOpened = false;
1183 if( count( $errs ) ) {
1184 /* Display options form */
1186 if( $conf->posted
) {
1187 echo "<p class='error-top'>Something's not quite right yet; make sure everything below is filled out correctly.</p>\n";
1191 <form action
="<?php echo defined('MW_INSTALL_PHP5_EXT') ? 'index.php5' : 'index.php'; ?>" name
="config" method
="post">
1193 <h2
>Site config
</h2
>
1195 <div
class="config-section">
1196 <div
class="config-input">
1197 <?php
aField( $conf, "Sitename", "Wiki name:" ); ?
>
1199 <p
class="config-desc">
1200 Preferably a short word without punctuation
, i
.e
. "Wikipedia".<br
/>
1201 Will appear
as the
namespace name
for "meta" pages
, and throughout the
interface.
1203 <div
class="config-input"><?php
aField( $conf, "EmergencyContact", "Contact e-mail:" ); ?
></div
>
1204 <p
class="config-desc">
1205 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
.
1208 <div
class="config-input">
1209 <label
class='column' for="LanguageCode">Language
:</label
>
1210 <select id
="LanguageCode" name
="LanguageCode"><?php
1211 $list = getLanguageList();
1212 foreach( $list as $code => $name ) {
1213 $sel = ($code == $conf->LanguageCode
) ?
'selected="selected"' : '';
1214 echo "\n\t\t<option value=\"$code\" $sel>$name</option>";
1220 <p
class="config-desc">
1221 Select the language
for your wiki
's interface. Some localizations aren't fully complete
. Unicode (UTF
-8) is used
for all localizations
.
1224 <div
class="config-input">
1225 <label
class='column'>Copyright
/license
:</label
>
1228 <li
><?php
aField( $conf, "License", "No license metadata", "radio", "none" ); ?
></li
>
1229 <li
><?php
aField( $conf, "License", "Public Domain", "radio", "pd" ); ?
></li
>
1230 <li
><?php
aField( $conf, "License", "GNU Free Documentation License 1.2 (Wikipedia-compatible)", "radio", "gfdl1_2" ); ?
></li
>
1231 <li
><?php
aField( $conf, "License", "GNU Free Documentation License 1.3", "radio", "gfdl1_3" ); ?
></li
>
1233 aField( $conf, "License", "A Creative Commons license - ", "radio", "cc" );
1234 $partner = "MediaWiki";
1235 $script = defined('MW_INSTALL_PHP5_EXT') ?
'index.php5' : 'index.php';
1236 $exit = urlencode( "$wgServer{$conf->ScriptPath}/config/$script?License=cc&RightsUrl=[license_url]&RightsText=[license_name]&RightsCode=[license_code]&RightsIcon=[license_button]" );
1237 $icon = urlencode( "$wgServer$wgUploadPath/wiki.png" );
1238 $ccApp = htmlspecialchars( "http://creativecommons.org/license/?partner=$partner&exit_url=$exit&partner_icon_url=$icon" );
1239 print "<a href=\"$ccApp\" target='_blank'>choose</a>";
1240 if( $conf->License
== "cc" ) { ?
>
1242 <li
><?php
aField( $conf, "RightsIcon", "<img src=\"" . htmlspecialchars( $conf->RightsIcon
) . "\" alt='(Creative Commons icon)' />", "hidden" ); ?
></li
>
1243 <li
><?php
aField( $conf, "RightsText", htmlspecialchars( $conf->RightsText
), "hidden" ); ?
></li
>
1244 <li
><?php
aField( $conf, "RightsCode", "code: " . htmlspecialchars( $conf->RightsCode
), "hidden" ); ?
></li
>
1245 <li
><?php
aField( $conf, "RightsUrl", "<a href=\"" . htmlspecialchars( $conf->RightsUrl
) . "\">" . htmlspecialchars( $conf->RightsUrl
) . "</a>", "hidden" ); ?
></li
>
1251 <p
class="config-desc">
1252 A notice
, icon
, and machine
-readable copyright metadata will be displayed
for the license you pick
.
1256 <div
class="config-input">
1257 <?php
aField( $conf, "SysopName", "Admin username:" ) ?
>
1259 <div
class="config-input">
1260 <?php
aField( $conf, "SysopPass", "Password:", "password" ) ?
>
1262 <div
class="config-input">
1263 <?php
aField( $conf, "SysopPass2", "Password confirm:", "password" ) ?
>
1265 <p
class="config-desc">
1266 An admin can lock
/delete pages
, block users from editing
, and do other maintenance tasks
.<br
/>
1267 A
new account will be added only when creating a
new wiki database
.
1269 The password cannot be the same
as the username
.
1272 <div
class="config-input">
1273 <label
class='column'>Object caching
:</label
>
1276 <li
><?php
aField( $conf, "Shm", "No caching", "radio", "none" ); ?
></li
>
1278 if ( $conf->turck
) {
1280 aField( $conf, "Shm", "Turck MMCache", "radio", "turck" );
1283 if( $conf->xcache
) {
1285 aField( $conf, 'Shm', 'XCache', 'radio', 'xcache' );
1290 aField( $conf, "Shm", "APC", "radio", "apc" );
1293 if ( $conf->eaccel
) {
1295 aField( $conf, "Shm", "eAccelerator", "radio", "eaccel" );
1300 aField( $conf, "Shm", "DBA (not recommended)", "radio", "dba" );
1304 <li
><?php
aField( $conf, "Shm", "Memcached", "radio", "memcached" ); ?
></li
>
1306 <div style
="clear:left"><?php
aField( $conf, "MCServers", "Memcached servers:", "text" ) ?
></div
>
1308 <p
class="config-desc">
1309 An
object caching system such
as memcached will provide a significant performance boost
,
1310 but needs to be installed
. Provide the server addresses
and ports in a comma
-separated
list.
1312 MediaWiki can also detect
and support eAccelerator
, Turck MMCache
, APC
, and XCache
, but
1313 these should not be used
if the wiki will be running on multiple application servers
.
1315 DBA (Berkeley
-style DB
) is generally slower than using no cache at all
, and is only
1316 recommended
for testing
.
1320 <h2
>E
-mail
, e
-mail notification
and authentication setup
</h2
>
1322 <div
class="config-section">
1323 <div
class="config-input">
1324 <label
class='column'>E
-mail
features (global):</label
>
1326 <li
><?php
aField( $conf, "Email", "Enabled", "radio", "email_enabled" ); ?
></li
>
1327 <li
><?php
aField( $conf, "Email", "Disabled", "radio", "email_disabled" ); ?
></li
>
1330 <p
class="config-desc">
1331 Use this to disable all e
-mail
functions (password reminders
, user
-to
-user e
-mail
, and e
-mail notifications
)
1332 if sending mail doesn
't work on your server.
1335 <div class="config-input">
1336 <label class='column
'>User-to-user e-mail:</label>
1338 <li><?php aField( $conf, "Emailuser", "Enabled", "radio", "emailuser_enabled" ); ?></li>
1339 <li><?php aField( $conf, "Emailuser", "Disabled", "radio", "emailuser_disabled" ); ?></li>
1342 <p class="config-desc">
1343 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.
1345 <div class="config-input">
1346 <label class='column
'>E-mail notification about changes:</label>
1348 <li><?php aField( $conf, "Enotif", "Disabled", "radio", "enotif_disabled" ); ?></li>
1349 <li><?php aField( $conf, "Enotif", "Enabled for changes to user discussion pages only", "radio", "enotif_usertalk" ); ?></li>
1350 <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>
1353 <div class="config-desc">
1355 For this feature to work, an e-mail address must be present for the user account, and the notification
1356 options in the user's preferences must be enabled
. Also note the
1357 authentication option below
. When testing the feature
, keep in mind that your own changes will never trigger notifications to be sent to yourself
.</p
>
1359 <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
>
1362 <div
class="config-input">
1363 <label
class='column'>E
-mail address authentication
:</label
>
1365 <li
><?php
aField( $conf, "Eauthent", "Disabled", "radio", "eauthent_disabled" ); ?
></li
>
1366 <li
><?php
aField( $conf, "Eauthent", "Enabled", "radio", "eauthent_enabled" ); ?
></li
>
1369 <div
class="config-desc">
1370 <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
1371 change notification mails
. Setting this option is
<b
>recommended
</b
> for public wikis because of potential abuse of the e
-mail features above
.</p
>
1376 <h2
>Database config
</h2
>
1378 <div
class="config-section">
1379 <div
class="config-input">
1380 <label
class='column'>Database type
:</label
>
1381 <?php
if (isset($errs['DBpicktype'])) print "\t<span class='error'>$errs[DBpicktype]</span>\n"; ?
>
1382 <ul
class='plain'><?php
1383 database_picker($conf);
1387 <div
class="config-input" style
="clear:left">
1388 <?php
aField( $conf, "DBserver", "Database host:" ); ?
>
1390 <p
class="config-desc">
1391 If your database server isn
't on your web server, enter the name or IP address here.
1394 <div class="config-input"><?php aField( $conf, "DBname", "Database name:" ); ?></div>
1395 <div class="config-input"><?php aField( $conf, "DBuser", "DB username:" ); ?></div>
1396 <div class="config-input"><?php aField( $conf, "DBpassword", "DB password:", "password" ); ?></div>
1397 <div class="config-input"><?php aField( $conf, "DBpassword2", "DB password confirm:", "password" ); ?></div>
1398 <p class="config-desc">
1399 If you only have a single user account and database available,
1400 enter those here. If you have database root access (see below)
1401 you can specify new accounts/databases to be created. This account
1402 will not be created if it pre-exists. If this is the case, ensure that it
1403 has SELECT, INSERT, UPDATE, and DELETE permissions on the MediaWiki database.
1406 <div class="config-input">
1407 <label class="column">Superuser account:</label>
1408 <input type="checkbox" name="useroot" id="useroot" <?php if( $useRoot ) { ?>checked="checked" <?php } ?> />
1409 <label for="useroot">Use superuser account</label>
1411 <div class="config-input"><?php aField( $conf, "RootUser", "Superuser name:", "text" ); ?></div>
1412 <div class="config-input"><?php aField( $conf, "RootPW", "Superuser password:", "password" ); ?></div>
1414 <p class="config-desc">
1415 If the database user specified above does not exist, or does not have access to create
1416 the database (if needed) or tables within it, please check the box and provide details
1417 of a superuser account, such as <strong>root</strong>, which does.
1420 <?php database_switcher('mysql
'); ?>
1421 <div class="config-input"><?php aField( $conf, "DBprefix", "Database table prefix:" ); ?></div>
1422 <div class="config-desc">
1423 <p>If you need to share one database between multiple wikis, or
1424 between MediaWiki and another web application, you may choose to
1425 add a prefix to all the table names to avoid conflicts.</p>
1427 <p>Avoid exotic characters; something like <tt>mw_</tt> is good.</p>
1430 <div class="config-input"><label class="column">Storage Engine</label>
1431 <div>Select one:</div>
1433 <li><?php aField( $conf, "DBengine", "InnoDB", "radio", "InnoDB" ); ?></li>
1434 <li><?php aField( $conf, "DBengine", "MyISAM", "radio", "MyISAM" ); ?></li>
1437 <p class="config-desc">
1438 InnoDB is best for public web installations, since it has good concurrency
1439 support. MyISAM may be faster in single-user installations. MyISAM databases
1440 tend to get corrupted more often than InnoDB databases.
1442 <div class="config-input"><label class="column">Database character set</label>
1443 <div>Select one:</div>
1445 <li><?php aField( $conf, "DBschema", "MySQL 4.1/5.0 binary", "radio", "mysql5-binary" ); ?></li>
1446 <li><?php aField( $conf, "DBschema", "MySQL 4.1/5.0 UTF-8", "radio", "mysql5" ); ?></li>
1447 <li><?php aField( $conf, "DBschema", "MySQL 4.0 backwards-compatible UTF-8", "radio", "mysql4" ); ?></li>
1450 <p class="config-desc">
1451 This option is ignored on upgrade, the same character set will be kept.
1453 <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!.
1455 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>.
1459 <?php database_switcher('postgres
'); ?>
1460 <div class="config-input"><?php aField( $conf, "DBport", "Database port:" ); ?></div>
1461 <div class="config-input"><?php aField( $conf, "DBmwschema", "Schema for mediawiki:" ); ?></div>
1462 <div class="config-input"><?php aField( $conf, "DBts2schema", "Schema for tsearch2:" ); ?></div>
1463 <div class="config-desc">
1464 <p>The username specified above (at "DB username") will have its search path set to the above schemas,
1465 so it is recommended that you create a new user. The above schemas are generally correct:
1466 only change them if you are sure you need to.</p>
1470 <?php database_switcher('sqlite
'); ?>
1471 <div class="config-desc">
1472 <b>NOTE:</b> SQLite only uses the <i>Database name</i> setting above, the user, password and root settings are ignored.
1474 <div class="config-input"><?php
1475 aField( $conf, "SQLiteDataDir", "SQLite data directory:" );
1477 <div class="config-desc">
1478 <p>SQLite stores table data into files in the filesystem.
1479 If you do not provide an explicit path, a "data" directory in
1480 the parent of your document root will be used.</p>
1482 <p>This directory must exist and be writable by the web server.</p>
1486 <?php database_switcher('mssql
'); ?>
1487 <div class="config-input"><?php
1488 aField( $conf, "DBprefix2", "Database table prefix:" );
1490 <div class="config-desc">
1491 <p>If you need to share one database between multiple wikis, or
1492 between MediaWiki and another web application, you may choose to
1493 add a prefix to all the table names to avoid conflicts.</p>
1495 <p>Avoid exotic characters; something like <tt>mw_</tt> is good.</p>
1499 <?php database_switcher('ibm_db2
'); ?>
1500 <div class="config-input"><?php
1501 aField( $conf, "DBport_db2", "Database port:" );
1503 <div class="config-input"><?php
1504 aField( $conf, "DBmwschema", "Schema for mediawiki:" );
1506 <div>Select one:</div>
1508 <li><?php aField( $conf, "DBcataloged", "Cataloged (DB2 installed locally)", "radio", "cataloged" ); ?></li>
1509 <li><?php aField( $conf, "DBcataloged", "Uncataloged (remote DB2 through ODBC)", "radio", "uncataloged" ); ?></li>
1511 <div class="config-desc">
1512 <p>If you need to share one database between multiple wikis, or
1513 between MediaWiki and another web application, you may specify
1514 a different schema to avoid conflicts.</p>
1518 <div class="config-input" style="padding:2em 0 3em">
1519 <label class='column
'> </label>
1520 <input type="submit" value="Install MediaWiki!" class="btn-install" />
1524 <script type="text/javascript">
1525 window.onload = toggleDBarea('<?php
echo $conf->DBtype
; ?
>',
1527 ## If they passed in a root user name, don't populate it on page load
1528 echo strlen(importPost('RootUser', '')) ?
0 : 1;
1534 /* -------------------------------------------------------------------------------------- */
1535 function writeSuccessMessage() {
1536 $script = defined('MW_INSTALL_PHP5_EXT') ?
'index.php5' : 'index.php';
1537 if ( wfIniGetBool( 'safe_mode' ) && !ini_get( 'open_basedir' ) ) {
1539 <div class="success-box">
1540 <p>Installation successful!</p>
1541 <p>To complete the installation, please do the following:
1543 <li>Download config/LocalSettings.php with your FTP client or file manager</li>
1544 <li>Upload it to the parent directory</li>
1545 <li>Delete config/LocalSettings.php</li>
1546 <li>Start using <a href='../$script'>your wiki</a>!
1548 <p>If you are in a shared hosting environment, do <strong>not</strong> just move LocalSettings.php
1549 remotely. LocalSettings.php is currently owned by the user your webserver is running under,
1550 which means that anyone on the same server can read your database password! Downloading
1551 it and uploading it again will hopefully change the ownership to a user ID specific to you.</p>
1556 <div class="success-box">
1558 <span class="success-message">Installation successful!</span>
1559 Move the <tt>config/LocalSettings.php</tt> file to the parent directory, then follow
1560 <a href="../$script"> this link</a> to your wiki.</p>
1561 <p>You should change file permissions for <tt>LocalSettings.php</tt> as required to
1562 prevent other users on the server reading passwords and altering configuration data.</p>
1569 function escapePhpString( $string ) {
1570 if ( is_array( $string ) ||
is_object( $string ) ) {
1573 return strtr( $string,
1584 function writeLocalSettings( $conf ) {
1585 $conf->PasswordSender
= $conf->EmergencyContact
;
1586 $magic = ($conf->ImageMagick ?
"" : "# ");
1587 $convert = ($conf->ImageMagick ?
$conf->ImageMagick
: "/usr/bin/convert" );
1588 $rights = ($conf->RightsUrl
) ?
"" : "# ";
1589 $hashedUploads = $conf->safeMode ?
'' : '# ';
1591 if ( $conf->ShellLocale
) {
1595 $conf->ShellLocale
= 'en_US.UTF-8';
1598 switch ( $conf->Shm
) {
1600 $cacheType = 'CACHE_MEMCACHED';
1601 $mcservers = var_export( $conf->MCServerArray
, true );
1607 $cacheType = 'CACHE_ACCEL';
1608 $mcservers = 'array()';
1611 $cacheType = 'CACHE_DBA';
1612 $mcservers = 'array()';
1615 $cacheType = 'CACHE_NONE';
1616 $mcservers = 'array()';
1619 if ( $conf->Email
== 'email_enabled' ) {
1620 $enableemail = 'true';
1621 $enableuseremail = ( $conf->Emailuser
== 'emailuser_enabled' ) ?
'true' : 'false' ;
1622 $eauthent = ( $conf->Eauthent
== 'eauthent_enabled' ) ?
'true' : 'false' ;
1623 switch ( $conf->Enotif
) {
1624 case 'enotif_usertalk':
1625 $enotifusertalk = 'true';
1626 $enotifwatchlist = 'false';
1628 case 'enotif_allpages':
1629 $enotifusertalk = 'true';
1630 $enotifwatchlist = 'true';
1633 $enotifusertalk = 'false';
1634 $enotifwatchlist = 'false';
1637 $enableuseremail = 'false';
1638 $enableemail = 'false';
1639 $eauthent = 'false';
1640 $enotifusertalk = 'false';
1641 $enotifwatchlist = 'false';
1644 $file = @fopen
( "/dev/urandom", "r" );
1646 $secretKey = bin2hex( fread( $file, 32 ) );
1650 for ( $i=0; $i<8; $i++
) {
1651 $secretKey .= dechex(mt_rand(0, 0x7fffffff));
1653 print "<li>Warning: \$wgSecretKey key is insecure, generated with mt_rand(). Consider changing it manually.</li>\n";
1656 # Add slashes to strings for double quoting
1657 $slconf = array_map( "escapePhpString", get_object_vars( $conf ) );
1658 if( $conf->License
== 'gfdl1_2' ||
$conf->License
== 'pd' ||
$conf->License
== 'gfdl1_3' ) {
1659 # Needs literal string interpolation for the current style path
1660 $slconf['RightsIcon'] = $conf->RightsIcon
;
1663 if( $conf->DBtype
== 'mysql' ) {
1665 "# MySQL specific settings
1666 \$wgDBprefix = \"{$slconf['DBprefix']}\";
1668 # MySQL table options to use during installation or update
1669 \$wgDBTableOptions = \"{$slconf['DBTableOptions']}\";
1671 # Experimental charset support for MySQL 4.1/5.0.
1672 \$wgDBmysql5 = {$conf->DBmysql5};";
1673 } elseif( $conf->DBtype
== 'postgres' ) {
1675 "# Postgres specific settings
1676 \$wgDBport = \"{$slconf['DBport']}\";
1677 \$wgDBmwschema = \"{$slconf['DBmwschema']}\";
1678 \$wgDBts2schema = \"{$slconf['DBts2schema']}\";";
1679 } elseif( $conf->DBtype
== 'sqlite' ) {
1681 "# SQLite-specific settings
1682 \$wgSQLiteDataDir = \"{$slconf['SQLiteDataDir']}\";";
1683 } elseif( $conf->DBtype
== 'mssql' ) {
1685 "# MSSQL specific settings
1686 \$wgDBprefix = \"{$slconf['DBprefix2']}\";";
1687 } elseif( $conf->DBtype
== 'ibm_db2' ) {
1689 "# DB2 specific settings
1690 \$wgDBport_db2 = \"{$slconf['DBport_db2']}\";
1691 \$wgDBmwschema = \"{$slconf['DBmwschema']}\";
1692 \$wgDBcataloged = \"{$slconf['DBcataloged']}\";";
1700 # This file was automatically generated by the MediaWiki installer.
1701 # If you make manual changes, please keep track in case you need to
1702 # recreate them later.
1704 # See includes/DefaultSettings.php for all configurable settings
1705 # and their default values, but don't forget to make changes in _this_
1708 # Further documentation for configuration settings may be found at:
1709 # http://www.mediawiki.org/wiki/Manual:Configuration_settings
1711 # If you customize your file layout, set \$IP to the directory that contains
1712 # the other MediaWiki files. It will be used as a base to locate files.
1713 if( defined( 'MW_INSTALL_PATH' ) ) {
1714 \$IP = MW_INSTALL_PATH;
1716 \$IP = dirname( __FILE__ );
1719 \$path = array( \$IP, \"\$IP/includes\", \"\$IP/languages\" );
1720 set_include_path( implode( PATH_SEPARATOR, \$path ) . PATH_SEPARATOR . get_include_path() );
1722 require_once( \"\$IP/includes/DefaultSettings.php\" );
1724 # If PHP's memory limit is very low, some operations may fail.
1725 " . ($conf->raiseMemory ?
'' : '# ' ) . "ini_set( 'memory_limit', '20M' );" . "
1727 if ( \$wgCommandLineMode ) {
1728 if ( isset( \$_SERVER ) && array_key_exists( 'REQUEST_METHOD', \$_SERVER ) ) {
1729 die( \"This script must be run from the command line\\n\" );
1732 ## Uncomment this to disable output compression
1733 # \$wgDisableOutputCompression = true;
1735 \$wgSitename = \"{$slconf['Sitename']}\";
1737 ## The URL base path to the directory containing the wiki;
1738 ## defaults for all runtime URL paths are based off of this.
1739 ## For more information on customizing the URLs please see:
1740 ## http://www.mediawiki.org/wiki/Manual:Short_URL
1741 \$wgScriptPath = \"{$slconf['ScriptPath']}\";
1742 \$wgScriptExtension = \"{$slconf['ScriptExtension']}\";
1744 ## UPO means: this is also a user preference option
1746 \$wgEnableEmail = $enableemail;
1747 \$wgEnableUserEmail = $enableuseremail; # UPO
1749 \$wgEmergencyContact = \"{$slconf['EmergencyContact']}\";
1750 \$wgPasswordSender = \"{$slconf['PasswordSender']}\";
1752 \$wgEnotifUserTalk = $enotifusertalk; # UPO
1753 \$wgEnotifWatchlist = $enotifwatchlist; # UPO
1754 \$wgEmailAuthentication = $eauthent;
1756 ## Database settings
1757 \$wgDBtype = \"{$slconf['DBtype']}\";
1758 \$wgDBserver = \"{$slconf['DBserver']}\";
1759 \$wgDBname = \"{$slconf['DBname']}\";
1760 \$wgDBuser = \"{$slconf['DBuser']}\";
1761 \$wgDBpassword = \"{$slconf['DBpassword']}\";
1765 ## Shared memory settings
1766 \$wgMainCacheType = $cacheType;
1767 \$wgMemCachedServers = $mcservers;
1769 ## To enable image uploads, make sure the 'images' directory
1770 ## is writable, then set this to true:
1771 \$wgEnableUploads = false;
1772 {$magic}\$wgUseImageMagick = true;
1773 {$magic}\$wgImageMagickConvertCommand = \"{$convert}\";
1775 ## If you use ImageMagick (or any other shell command) on a
1776 ## Linux server, this will need to be set to the name of an
1777 ## available UTF-8 locale
1778 {$locale}\$wgShellLocale = \"{$slconf['ShellLocale']}\";
1780 ## If you want to use image uploads under safe mode,
1781 ## create the directories images/archive, images/thumb and
1782 ## images/temp, and make them all writable. Then uncomment
1783 ## this, if it's not already uncommented:
1784 {$hashedUploads}\$wgHashedUploadDirectory = false;
1786 ## If you have the appropriate support software installed
1787 ## you can enable inline LaTeX equations:
1790 \$wgLocalInterwiki = strtolower( \$wgSitename );
1792 \$wgLanguageCode = \"{$slconf['LanguageCode']}\";
1794 \$wgSecretKey = \"$secretKey\";
1796 ## Default skin: you can change the default skin. Use the internal symbolic
1797 ## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook':
1798 \$wgDefaultSkin = 'monobook';
1800 ## For attaching licensing metadata to pages, and displaying an
1801 ## appropriate copyright notice / icon. GNU Free Documentation
1802 ## License and Creative Commons licenses are supported so far.
1803 {$rights}\$wgEnableCreativeCommonsRdf = true;
1804 \$wgRightsPage = \"\"; # Set to the title of a wiki page that describes your license/copyright
1805 \$wgRightsUrl = \"{$slconf['RightsUrl']}\";
1806 \$wgRightsText = \"{$slconf['RightsText']}\";
1807 \$wgRightsIcon = \"{$slconf['RightsIcon']}\";
1808 # \$wgRightsCode = \"{$slconf['RightsCode']}\"; # Not yet used
1810 \$wgDiff3 = \"{$slconf['diff3']}\";
1812 # When you make changes to this configuration file, this will make
1813 # sure that cached pages are cleared.
1814 \$wgCacheEpoch = max( \$wgCacheEpoch, gmdate( 'YmdHis', @filemtime( __FILE__ ) ) );
1815 "; ## End of setting the $localsettings string
1817 // Keep things in Unix line endings internally;
1818 // the system will write out as local text type.
1819 return str_replace( "\r\n", "\n", $localsettings );
1822 function dieout( $text ) {
1823 global $mainListOpened;
1824 if( $mainListOpened ) echo( "</ul>" );
1825 if( $text != '' && substr( $text, 0, 2 ) != '<p' && substr( $text, 0, 2 ) != '<h' ){
1826 echo "<p>$text</p>\n";
1830 die( "\n\n</div>\n</div>\n</div>\n</div>\n</body>\n</html>" );
1833 function importVar( &$var, $name, $default = "" ) {
1834 if( isset( $var[$name] ) ) {
1835 $retval = $var[$name];
1836 if ( get_magic_quotes_gpc() ) {
1837 $retval = stripslashes( $retval );
1845 function importPost( $name, $default = "" ) {
1846 return importVar( $_POST, $name, $default );
1849 function importCheck( $name ) {
1850 return isset( $_POST[$name] );
1853 function importRequest( $name, $default = "" ) {
1854 return importVar( $_REQUEST, $name, $default );
1859 function aField( &$conf, $field, $text, $type = "text", $value = "", $onclick = '' ) {
1862 $xtype = "type=\"$type\"";
1868 $nolabel = ($type == "radio") ||
($type == "hidden");
1870 if ($type == 'radio')
1871 $id .= $radioCount++
;
1874 echo "<label class='column' for=\"$id\">$text</label>";
1877 if( $type == "radio" && $value == $conf->$field ) {
1878 $checked = "checked='checked'";
1882 echo "<input $xtype name=\"$field\" id=\"$id\" class=\"iput-$type\" $checked ";
1884 echo " onclick='toggleDBarea(\"$value\",1)' " ;
1887 if( $type == "radio" ) {
1888 echo htmlspecialchars( $value );
1890 echo htmlspecialchars( $conf->$field );
1896 echo "<label for=\"$id\">$text</label>";
1900 if(isset($errs[$field])) echo "<span class='error'>" . $errs[$field] . "</span>\n";
1903 function getLanguageList() {
1904 global $wgLanguageNames, $IP;
1905 if( !isset( $wgLanguageNames ) ) {
1906 require_once( "$IP/languages/Names.php" );
1911 $d = opendir( "../languages/messages" );
1912 /* In case we are called from the root directory */
1914 $d = opendir( "languages/messages");
1915 while( false !== ($f = readdir( $d ) ) ) {
1917 if( preg_match( '/Messages([A-Z][a-z_]+)\.php$/', $f, $m ) ) {
1918 $code = str_replace( '_', '-', strtolower( $m[1] ) );
1919 if( isset( $wgLanguageNames[$code] ) ) {
1920 $name = $code . ' - ' . $wgLanguageNames[$code];
1924 $codes[$code] = $name;
1932 #Check for location of an executable
1933 # @param string $loc single location to check
1934 # @param array $names filenames to check for.
1935 # @param mixed $versioninfo array of details to use when checking version, use false for no version checking
1936 function locate_executable($loc, $names, $versioninfo = false) {
1937 if (!is_array($names))
1938 $names = array($names);
1940 foreach ($names as $name) {
1941 $command = "$loc".DIRECTORY_SEPARATOR
."$name";
1942 if (@file_exists
($command)) {
1946 $file = str_replace('$1', $command, $versioninfo[0]);
1947 if (strstr(`
$file`
, $versioninfo[1]) !== false)
1954 # Test a memcached server
1955 function testMemcachedServer( $server ) {
1956 $hostport = explode(":", $server);
1959 if ( !function_exists( 'fsockopen' ) ) {
1960 $errstr = "Can't connect to memcached, fsockopen() not present";
1962 if ( !$errstr && count( $hostport ) != 2 ) {
1963 $errstr = 'Please specify host and port';
1966 list( $host, $port ) = $hostport;
1970 $fp = @fsockopen
( $host, $port, $errno, $fsockerr, 1.0 );
1971 if ( $fp === false ) {
1972 $errstr = "Cannot connect to memcached on $host:$port : $fsockerr";
1976 $command = "version\r\n";
1977 $bytes = fwrite( $fp, $command );
1978 if ( $bytes != strlen( $command ) ) {
1979 $errstr = "Cannot write to memcached socket on $host:$port";
1983 $expected = "VERSION ";
1984 $response = fread( $fp, strlen( $expected ) );
1985 if ( $response != $expected ) {
1986 $errstr = "Didn't get correct memcached response from $host:$port";
1993 echo "<li>Connected to memcached on $host:$port successfully";
1998 function database_picker($conf) {
2001 foreach(array_keys($ourdb) as $db) {
2002 if ($ourdb[$db]['havedriver']) {
2004 aField( $conf, "DBtype", $ourdb[$db]['fullname'], 'radio', $db, 'onclick');
2011 function database_switcher($db) {
2013 $color = $ourdb[$db]['bgcolor'];
2014 $full = $ourdb[$db]['fullname'];
2015 print "<fieldset id='$db'><legend>$full specific options</legend>\n";
2018 function printListItem( $item ) {
2019 print "<li>$item</li>";
2022 # Determine a suitable value for $wgShellLocale
2023 function getShellLocale( $wikiLang ) {
2024 # Give up now if we're in safe mode or open_basedir
2025 # It's theoretically possible but tricky to work with
2026 if ( wfIniGetBool( "safe_mode" ) ||
ini_get( 'open_basedir' ) ) {
2030 $os = php_uname( 's' );
2031 $supported = array( 'Linux', 'SunOS', 'HP-UX' ); # Tested these
2032 if ( !in_array( $os, $supported ) ) {
2036 # Get a list of available locales
2037 $lines = $ret = false;
2038 exec( '/usr/bin/locale -a', $lines, $ret );
2043 $lines = array_map( 'trim', $lines );
2044 $candidatesByLocale = array();
2045 $candidatesByLang = array();
2046 foreach ( $lines as $line ) {
2047 if ( $line === '' ) {
2050 if ( !preg_match( '/^([a-zA-Z]+)(_[a-zA-Z]+|)\.(utf8|UTF-8)(@[a-zA-Z_]*|)$/i', $line, $m ) ) {
2053 list( $all, $lang, $territory, $charset, $modifier ) = $m;
2054 $candidatesByLocale[$m[0]] = $m;
2055 $candidatesByLang[$lang][] = $m;
2058 # Try the current value of LANG
2059 if ( isset( $candidatesByLocale[ getenv( 'LANG' ) ] ) ) {
2060 return getenv( 'LANG' );
2063 # Try the most common ones
2064 $commonLocales = array( 'en_US.UTF-8', 'en_US.utf8', 'de_DE.UTF-8', 'de_DE.utf8' );
2065 foreach ( $commonLocales as $commonLocale ) {
2066 if ( isset( $candidatesByLocale[$commonLocale] ) ) {
2067 return $commonLocale;
2071 # Is there an available locale in the Wiki's language?
2072 if ( isset( $candidatesByLang[$wikiLang] ) ) {
2073 $m = reset( $candidatesByLang[$wikiLang] );
2077 # Are there any at all?
2078 if ( count( $candidatesByLocale ) ) {
2079 $m = reset( $candidatesByLocale );
2089 <div
class="license">
2091 <p
>This program is free software
; you can redistribute it
and/or modify
2092 it under the terms of the GNU General
Public License
as published by
2093 the Free Software Foundation
; either version
2 of the License
, or
2094 (at your option
) any later version
.</p
>
2096 <p
>This program is distributed in the hope that it will be useful
,
2097 but WITHOUT ANY WARRANTY
; without even the implied warranty of
2098 MERCHANTABILITY
or FITNESS
FOR A PARTICULAR PURPOSE
. See the
2099 GNU General
Public License
for more details
.</p
>
2101 <p
>You should have received
<a href
="../COPYING">a copy of the GNU General
Public License
</a
>
2102 along with this program
; if not
, write to the Free Software
2103 Foundation
, Inc
., 51 Franklin Street
, Fifth Floor
, Boston
, MA
02110-1301, USA
.
2104 or <a href
="http://www.gnu.org/copyleft/gpl.html">read it online
</a
></p
>
2110 <div id
="column-one">
2111 <div
class="portlet" id
="p-logo">
2112 <a style
="background-image: url(../skins/common/images/mediawiki.png);"
2113 href
="http://www.mediawiki.org/"
2114 title
="Main Page"></a
>
2116 <script type
="text/javascript"> if (window
.isMSIE55
) fixalpha(); </script
>
2117 <div
class='portlet'><div
class='pBody'>
2119 <li
><strong
><a href
="http://www.mediawiki.org/">MediaWiki home
</a
></strong
></li
>
2120 <li
><a href
="../README">Readme
</a
></li
>
2121 <li
><a href
="../RELEASE-NOTES">Release notes
</a
></li
>
2122 <li
><a href
="../docs/">Documentation
</a
></li
>
2123 <li
><a href
="http://www.mediawiki.org/wiki/Help:Contents">User
's Guide</a></li>
2124 <li><a href="http://www.mediawiki.org/wiki/Manual:Contents">Administrator's Guide
</a
></li
>
2125 <li
><a href
="http://www.mediawiki.org/wiki/Manual:FAQ">FAQ
</a
></li
>
2127 <p style
="font-size:90%;margin-top:1em">MediaWiki is Copyright ©
2001-2009 by Magnus Manske
, Brion Vibber
,
2128 Lee Daniel Crocker
, Tim Starling
, Erik Möller
, Gabriel Wicke
, Æ
var Arnfjörð Bjarmason
, Niklas Laxström
,
2129 Domas Mituzas
, Rob Church
, Yuri Astrakhan
, Aryeh Gregor
, Aaron Schulz
and others
.</p
>