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();
29 # Attempt to set up the include path, to fix problems with relative includes
30 $IP = dirname( dirname( __FILE__
) );
31 define( 'MW_INSTALL_PATH', $IP );
32 $sep = PATH_SEPARATOR
;
33 if( !ini_set( "include_path", ".$sep$IP$sep$IP/includes$sep$IP/languages" ) ) {
34 set_include_path( ".$sep$IP$sep$IP/includes$sep$IP/languages" );
37 # Define an entry point and include some files
38 define( "MEDIAWIKI", true );
39 define( "MEDIAWIKI_INSTALL", true );
40 require_once( "includes/Defines.php" );
41 require_once( "includes/DefaultSettings.php" );
42 require_once( "includes/MagicWord.php" );
43 require_once( "includes/Namespace.php" );
46 <!DOCTYPE HTML
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
49 <meta http
-equiv
="Content-type" content
="text/html; charset=utf-8">
50 <title
>MediaWiki
<?php
echo( $wgVersion ); ?
> Installation
</title
>
51 <style type
="text/css">
53 @import
"../skins/monobook/main.css";
57 margin
: 1em
0 1em
2.5em
;
64 .config
-section label
.column
{
76 zoom
: 100%
; /* IE hack */
79 .config
-section
.config
-desc
{
86 .iput
-text
, .iput
-password
{
93 background
-color
: #fff;
101 background
-color
: #FFF0F0;
102 border
: 2px solid red
;
110 list-style
-type
: none
;
111 list-style
-image
: none
;
132 <div id
="globalWrapper">
133 <div id
="column-content">
135 <div id
="bodyContent">
137 <h1
>MediaWiki
<?php
print $wgVersion ?
> Installation
</h1
>
141 /* Check for existing configurations and bug out! */
143 if( file_exists( "../LocalSettings.php" ) ) {
144 dieout( " <p><strong>Setup has completed, <a href='../index.php'>your wiki</a> is configured.</strong></p>
146 <p>Please delete the /config directory for extra security.</p></div></div></div></div>" );
149 if( file_exists( "./LocalSettings.php" ) ) {
150 writeSuccessMessage();
155 if( !is_writable( "." ) ) {
156 dieout( "<h2>Can't write config file, aborting</h2>
158 <p>In order to configure the wiki you have to make the <tt>config</tt> subdirectory
159 writable by the web server. Once configuration is done you'll move the created
160 <tt>LocalSettings.php</tt> to the parent directory, and for added safety you can
161 then remove the <tt>config</tt> subdirectory entirely.</p>
163 <p>To make the directory writable on a Unix/Linux system:</p>
166 cd <i>/path/to/wiki</i>
172 require_once( "install-utils.inc" );
173 require_once( "maintenance/updaters.inc" );
176 function getEncoded( $data ) {
177 # removing latin1 support, no need...
180 function getSitename() { return $this->getEncoded( $this->Sitename
); }
181 function getSysopName() { return $this->getEncoded( $this->SysopName
); }
182 function getSysopPass() { return $this->getEncoded( $this->SysopPass
); }
189 <b
>Don
't forget security updates!</b> Keep an eye on the
190 <a href="http://mail.wikimedia.org/mailman/listinfo/mediawiki-announce">low-traffic
191 release announcements mailing list</a>.
196 <h2>Checking environment...</h2>
197 <p><em>Please include all of the lines below when reporting installation problems.</em></p>
198 <ul class="env-check">
202 $wgNoOutputBuffer = true;
203 $conf = new ConfigData;
205 install_version_checks();
207 print "<li>PHP " . phpversion() . " installed</li>\n";
209 if( ini_get( "register_globals" ) ) {
212 <div style="font-size:110%">
213 <strong class="error">Warning:</strong>
214 <strong>PHP's
<tt
><a href
="http://php.net/register_globals">register_globals
</a
></tt
> option is enabled
. Disable it
if you can
.</strong
>
216 MediaWiki will work
, but your server is more exposed to PHP
-based security vulnerabilities
.
223 if( ini_get( "magic_quotes_runtime" ) ) {
225 ?
><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
>
226 This option corrupts data input unpredictably
; you cannot install
or use
227 MediaWiki unless this option is disabled
.
231 if( ini_get( "magic_quotes_sybase" ) ) {
233 ?
><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
>
234 This option corrupts data input unpredictably
; you cannot install
or use
235 MediaWiki unless this option is disabled
.
239 if( ini_get( "mbstring.func_overload" ) ) {
241 ?
><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
>
242 This option causes errors
and may corrupt data unpredictably
;
243 you cannot install
or use MediaWiki unless this option is disabled
.
248 dieout( "</ul><p>Cannot install MediaWiki.</p>" );
251 if( ini_get( "safe_mode" ) ) {
252 $conf->safeMode
= true;
254 <li
><b
class='error'>Warning
:</b
> <strong
>PHP
's
255 <a href='http
://www.php.net/features.safe-mode'>safe mode</a> is active.</strong>
256 You may have problems caused by this
, particularly
if using image uploads
.
260 $conf->safeMode
= false;
263 $sapi = php_sapi_name();
264 $conf->prettyURLs
= true;
265 print "<li>PHP server API is $sapi; ";
268 case "apache2handler":
269 print "ok, using pretty URLs (<tt>index.php/Page_Title</tt>)";
275 case "apache2filter":
277 print "using ugly URLs (<tt>index.php?title=Page_Title</tt>)";
278 $conf->prettyURLs
= false;
283 $conf->xml
= function_exists( "utf8_encode" );
285 print "<li>Have XML / Latin1-UTF-8 conversion support.</li>\n";
287 dieout( "PHP's XML module is missing; the wiki requires functions in
288 this module and won't work in this configuration.
289 If you're running Mandrake, install the php-xml package." );
292 # Crude check for session support
293 if( !function_exists( 'session_name' ) )
294 dieout( "PHP's session module is missing. MediaWiki requires session support in order to function." );
296 $memlimit = ini_get( "memory_limit" );
297 $conf->raiseMemory
= false;
298 if( empty( $memlimit ) ||
$memlimit == -1 ) {
299 print "<li>PHP is configured with no <tt>memory_limit</tt>.</li>\n";
301 print "<li>PHP's <tt>memory_limit</tt> is " . htmlspecialchars( $memlimit ) . ". <strong>If this is too low, installation may fail!</strong> ";
302 $n = intval( $memlimit );
303 if( preg_match( '/^([0-9]+)[Mm]$/', trim( $memlimit ), $m ) ) {
304 $n = intval( $m[1] * (1024*1024) );
306 if( $n < 20*1024*1024 ) {
307 print "Attempting to raise limit to 20M... ";
308 if( false === ini_set( "memory_limit", "20M" ) ) {
311 $conf->raiseMemory
= true;
318 $conf->zlib
= function_exists( "gzencode" );
320 print "<li>Have zlib support; enabling output compression.</li>\n";
322 print "<li>No zlib support.</li>\n";
325 $conf->turck
= function_exists( 'mmcache_get' );
326 if ( $conf->turck
) {
327 print "<li><a href=\"http://turck-mmcache.sourceforge.net/\">Turck MMCache</a> installed</li>\n";
329 $conf->eaccel
= function_exists( 'eaccelerator_get' );
330 if ( $conf->eaccel
) {
331 $conf->turck
= 'eaccelerator';
332 print "<li><a href=\"http://eaccelerator.sourceforge.net/\">eAccelerator</a> installed</li>\n";
334 if (!$conf->turck
&& !$conf->eaccel
) {
335 print "<li>Neither <a href=\"http://turck-mmcache.sourceforge.net/\">Turck MMCache</a> nor <a href=\"http://eaccelerator.sourceforge.net/\">eAccelerator</a> are installed, " .
336 "can't use object caching functions</li>\n";
339 $conf->diff3
= false;
340 $diff3locations = array("/usr/bin", "/opt/csw/bin", "/usr/gnu/bin", "/usr/sfw/bin") +
explode($sep, getenv("PATH"));
341 $diff3names = array("gdiff3", "diff3", "diff3.exe");
343 $diff3versioninfo = array('$1 --version 2>&1', 'diff3 (GNU diffutils)');
344 foreach ($diff3locations as $loc) {
345 $exe = locate_executable($loc, $diff3names, $diff3versioninfo);
346 if ($exe !== false) {
353 print "<li>Found GNU diff3: <tt>$conf->diff3</tt>.</li>";
355 print "<li>GNU diff3 not found.</li>";
357 $conf->ImageMagick
= false;
358 $imcheck = array( "/usr/bin", "/usr/local/bin", "/sw/bin", "/opt/local/bin" );
359 foreach( $imcheck as $dir ) {
360 $im = "$dir/convert";
361 if( file_exists( $im ) ) {
362 print "<li>Found ImageMagick: <tt>$im</tt>; image thumbnailing will be enabled if you enable uploads.</li>\n";
363 $conf->ImageMagick
= $im;
368 $conf->HaveGD
= function_exists( "imagejpeg" );
369 if( $conf->HaveGD
) {
370 print "<li>Found GD graphics library built-in";
371 if( !$conf->ImageMagick
) {
372 print ", image thumbnailing will be enabled if you enable uploads";
376 if( !$conf->ImageMagick
) {
377 print "<li>Couldn't find GD library or ImageMagick; image thumbnailing disabled.</li>\n";
381 $conf->UseImageResize
= $conf->HaveGD ||
$conf->ImageMagick
;
383 $conf->IP
= dirname( dirname( __FILE__
) );
384 print "<li>Installation directory: <tt>" . htmlspecialchars( $conf->IP
) . "</tt></li>\n";
386 $conf->ScriptPath
= preg_replace( '{^(.*)/config.*$}', '$1', $_SERVER["PHP_SELF"] ); # was SCRIPT_NAME
387 print "<li>Script URI path: <tt>" . htmlspecialchars( $conf->ScriptPath
) . "</tt></li>\n";
389 print "<li style='font-weight:bold;color:green;font-size:110%'>Environment checked. You can install MediaWiki.</li>\n";
390 $conf->posted
= ($_SERVER["REQUEST_METHOD"] == "POST");
392 $conf->Sitename
= ucfirst( importPost( "Sitename", "" ) );
393 $defaultEmail = empty( $_SERVER["SERVER_ADMIN"] )
395 : $_SERVER["SERVER_ADMIN"];
396 $conf->EmergencyContact
= importPost( "EmergencyContact", $defaultEmail );
397 $conf->DBtype
= importPost( "DBtype", "mysql" );
398 $conf->DBserver
= importPost( "DBserver", "localhost" );
399 $conf->DBname
= importPost( "DBname", "wikidb" );
400 $conf->DBuser
= importPost( "DBuser", "wikiuser" );
401 $conf->DBpassword
= importPost( "DBpassword" );
402 $conf->DBpassword2
= importPost( "DBpassword2" );
403 $conf->DBprefix
= importPost( "DBprefix" );
404 $conf->DBmysql5
= (importPost( "DBmysql5" ) == "true") ?
"true" : "false";
405 $conf->RootUser
= importPost( "RootUser", "root" );
406 $conf->RootPW
= importPost( "RootPW", "-" );
407 $conf->LanguageCode
= importPost( "LanguageCode", "en" );
408 $conf->SysopName
= importPost( "SysopName", "WikiSysop" );
409 $conf->SysopPass
= importPost( "SysopPass" );
410 $conf->SysopPass2
= importPost( "SysopPass2" );
412 /* Check for validity */
415 if( $conf->Sitename
== "" ||
$conf->Sitename
== "MediaWiki" ||
$conf->Sitename
== "Mediawiki" ) {
416 $errs["Sitename"] = "Must not be blank or \"MediaWiki\"";
418 if( $conf->DBuser
== "" ) {
419 $errs["DBuser"] = "Must not be blank";
421 if( $conf->DBpassword
== "" ) {
422 $errs["DBpassword"] = "Must not be blank";
424 if( $conf->DBpassword
!= $conf->DBpassword2
) {
425 $errs["DBpassword2"] = "Passwords don't match!";
427 if( !preg_match( '/^[A-Za-z_0-9]*$/', $conf->DBprefix
) ) {
428 $errs["DBprefix"] = "Invalid table prefix";
431 if( $conf->SysopPass
== "" ) {
432 $errs["SysopPass"] = "Must not be blank";
434 if( $conf->SysopPass
!= $conf->SysopPass2
) {
435 $errs["SysopPass2"] = "Passwords don't match!";
438 $conf->License
= importRequest( "License", "none" );
439 if( $conf->License
== "gfdl" ) {
440 $conf->RightsUrl
= "http://www.gnu.org/copyleft/fdl.html";
441 $conf->RightsText
= "GNU Free Documentation License 1.2";
442 $conf->RightsCode
= "gfdl";
443 $conf->RightsIcon
= '${wgStylePath}/common/images/gnu-fdl.png';
444 } elseif( $conf->License
== "none" ) {
445 $conf->RightsUrl
= $conf->RightsText
= $conf->RightsCode
= $conf->RightsIcon
= "";
447 $conf->RightsUrl
= importRequest( "RightsUrl", "" );
448 $conf->RightsText
= importRequest( "RightsText", "" );
449 $conf->RightsCode
= importRequest( "RightsCode", "" );
450 $conf->RightsIcon
= importRequest( "RightsIcon", "" );
453 $conf->Shm
= importRequest( "Shm", "none" );
454 $conf->MCServers
= importRequest( "MCServers" );
456 /* Test memcached servers */
458 if ( $conf->Shm
== 'memcached' && $conf->MCServers
) {
459 $conf->MCServerArray
= array_map( 'trim', explode( ',', $conf->MCServers
) );
460 foreach ( $conf->MCServerArray
as $server ) {
461 $error = testMemcachedServer( $server );
463 $errs["MCServers"] = $error;
467 } else if ( $conf->Shm
== 'memcached' ) {
468 $errs["MCServers"] = "Please specify at least one server if you wish to use memcached";
471 /* default values for installation */
472 $conf->Email
=importRequest("Email", "email_enabled");
473 $conf->Emailuser
=importRequest("Emailuser", "emailuser_enabled");
474 $conf->Enotif
=importRequest("Enotif", "enotif_allpages");
475 $conf->Eauthent
=importRequest("Eauthent", "eauthent_enabled");
477 if( $conf->posted
&& ( 0 == count( $errs ) ) ) {
478 do { /* So we can 'continue' to end prematurely */
479 $conf->Root
= ($conf->RootPW
!= "");
481 /* Load up the settings and get installin' */
482 $local = writeLocalSettings( $conf );
483 echo "<p><b>Generating configuration file...</b></p>\n";
484 // for debugging: // echo "<pre>" . htmlspecialchars( $local ) . "</pre>\n";
486 $wgCommandLineMode = false;
489 if (!in_array($conf->DBtype
, array("mysql", "oracle"))) {
490 $errs["DBtype"] = "Unknown database type.";
493 print "<li>Database type: {$conf->DBtype}</li>\n";
494 $dbclass = 'Database'.ucfirst($conf->DBtype
);
495 require_once("$dbclass.php");
496 $wgDBtype = $conf->DBtype
;
497 $wgDBadminuser = "root";
498 $wgDBadminpassword = $conf->RootPW
;
499 $wgDBprefix = $conf->DBprefix
;
500 $wgCommandLineMode = true;
501 $wgUseDatabaseMessages = false; /* FIXME: For database failure */
502 require_once( "includes/Setup.php" );
505 require_once( "maintenance/InitialiseMessages.inc" );
507 $wgTitle = Title
::newFromText( "Installation script" );
508 $mysqlOldClient = version_compare( mysql_get_client_info(), "4.1.0", "lt" );
509 if( $mysqlOldClient ) {
510 print "<li><b>PHP is linked with old MySQL client libraries. If you are
511 using a MySQL 4.1 server and have problems connecting to the database,
512 see <a href='http://dev.mysql.com/doc/mysql/en/old-client.html'
513 >http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b></li>\n";
517 if( $conf->DBtype
== 'mysql' ) {
518 $ok = true; # Let's be optimistic
520 # Decide if we're going to use the superuser or the regular database user
521 if( $conf->RootPW
== '-' ) {
524 $db_user = $wgDBuser;
525 $db_pass = $wgDBpassword;
529 $db_user = $conf->RootUser
;
530 $db_pass = $conf->RootPW
;
534 echo( "<li>Attempting to connect to database server as $db_user..." );
535 $wgDatabase = Database
::newFromParams( $wgDBserver, $db_user, $db_pass, '', 1 );
537 # Check the connection and respond to errors
538 if( $wgDatabase->isOpen() ) {
541 $wgDBadminuser = $db_user;
542 $wgDBadminpassword = $db_pass;
543 echo( "success.</li>\n" );
544 $wgDatabase->ignoreErrors( true );
545 $myver = mysql_get_server_info( $wgDatabase->mConn
);
547 # There were errors, report them and back out
549 $errno = mysql_errno();
550 $errtx = htmlspecialchars( mysql_error() );
554 echo( "failed due to authentication errors. Check passwords.</li>" );
556 # The superuser details are wrong
557 $errs["RootUser"] = "Check username";
558 $errs["RootPW"] = "and password";
560 # The regular user details are wrong
561 $errs["DBuser"] = "Check username";
562 $errs["DBpassword"] = "and password";
568 # General connection problem
569 echo( "failed with error [$errno] $errtx.</li>\n" );
570 $errs["DBserver"] = "Connection failed";
575 if( !$ok ) { continue; }
577 } else /* not mysql */ {
578 print "<li>Connecting to SQL server...";
579 $wgDatabase = $dbc->newFromParams($wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1);
580 if (!$wgDatabase->isOpen()) {
581 print " error: " . $wgDatabase->lastError() . "</li>\n";
583 $wgDatabase->ignoreErrors(true);
584 $myver = get_db_version();
588 if ( !$wgDatabase->isOpen() ) {
589 $errs["DBserver"] = "Couldn't connect to database";
593 print "<li>Connected to $myver";
594 if( version_compare( $myver, "4.0.0" ) < 0 ) {
595 die( " -- mysql 4.0 or later required. Aborting." );
597 $mysqlNewAuth = version_compare( $myver, "4.1.0", "ge" );
598 if( $mysqlNewAuth && $mysqlOldClient ) {
599 print "; <b class='error'>You are using MySQL 4.1 server, but PHP is linked
600 to old client libraries; if you have trouble with authentication, see
601 <a href='http://dev.mysql.com/doc/mysql/en/old-client.html'
602 >http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b>";
605 if( $mysqlNewAuth ) {
606 print "; enabling MySQL 4.1/5.0 charset mode";
608 print "; <b class='error'>MySQL 4.1/5.0 charset mode enabled,
609 but older version detected; will likely fail.</b>";
614 if ($conf->DBtype
== 'mysql') {
615 @$sel = mysql_select_db( $wgDBname, $wgDatabase->mConn
);
617 print "<li>Database <tt>" . htmlspecialchars( $wgDBname ) . "</tt> exists</li>\n";
619 $err = mysql_errno();
620 if ( $err != 1049 ) {
621 print "<ul><li>Error selecting database $wgDBname: $err " .
622 htmlspecialchars( mysql_error() ) . "</li></ul>";
625 $res = $wgDatabase->query( "CREATE DATABASE `$wgDBname`" );
627 print "<li>Couldn't create database <tt>" .
628 htmlspecialchars( $wgDBname ) .
629 "</tt>; try with root access or check your username/pass.</li>\n";
630 $errs["RootPW"] = "<- Enter";
633 print "<li>Created database <tt>" . htmlspecialchars( $wgDBname ) . "</tt></li>\n";
635 $wgDatabase->selectDB( $wgDBname );
638 if( $wgDatabase->tableExists( "cur" ) ||
$wgDatabase->tableExists( "revision" ) ) {
639 print "<li>There are already MediaWiki tables in this database. Checking if updates are needed...</li>\n";
641 # Create user if required
643 $conn = Database
::newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1 );
644 if ( $conn->isOpen() ) {
645 print "<li>DB user account ok</li>\n";
648 print "<li>Granting user permissions...";
649 if( $mysqlOldClient && $mysqlNewAuth ) {
650 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>";
653 dbsource( "../maintenance/users.sql", $wgDatabase );
663 print "<li>Finished update checks.</li>\n";
665 # FIXME: Check for errors
666 print "<li>Creating tables...";
667 if ($conf->DBtype
== 'mysql') {
669 print " using MySQL 5 table defs...";
670 dbsource( "../maintenance/mysql5/tables.sql", $wgDatabase );
672 print " using MySQL 4 table defs...";
673 dbsource( "../maintenance/tables.sql", $wgDatabase );
675 dbsource( "../maintenance/interwiki.sql", $wgDatabase );
677 dbsource( "../maintenance/oracle/tables.sql", $wgDatabase );
678 dbsource( "../maintenance/oracle/interwiki.sql", $wgDatabase );
681 print " done.</li>\n";
683 print "<li>Initializing data...";
684 $wgDatabase->insert( 'site_stats',
685 array( 'ss_row_id' => 1,
686 'ss_total_views' => 0,
687 'ss_total_edits' => 0,
688 'ss_good_articles' => 0 ) );
690 # Set up the "regular user" account *if we can, and if we need to*
693 $wgDatabase2 = Database
::newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1 );
694 if( $wgDatabase2->isOpen() ) {
695 # Nope, just close the test connection and continue
696 $wgDatabase2->close();
697 echo( "<li>User $wgDBuser exists. Skipping grants.</li>" );
699 # Yes, so run the grants
700 echo( "<li>Granting user permissions to $wgDBuser on $wgDBname..." );
701 dbsource( "../maintenance/users.sql", $wgDatabase );
702 echo( "success.</li>" );
706 if( $conf->SysopName
) {
707 $u = User
::newFromName( $conf->getSysopName() );
708 if ( 0 == $u->idForName() ) {
710 $u->setPassword( $conf->getSysopPass() );
713 $u->addGroup( "sysop" );
714 $u->addGroup( "bureaucrat" );
716 print "<li>Created sysop account <tt>" .
717 htmlspecialchars( $conf->SysopName
) . "</tt>.</li>\n";
719 print "<li>Could not create user - already exists!</li>\n";
722 print "<li>Skipped sysop account creation, no name given.</li>\n";
725 $titleobj = Title
::newFromText( wfMsgNoDB( "mainpage" ) );
726 $article = new Article( $titleobj );
727 $newid = $article->insertOn( $wgDatabase );
728 $revision = new Revision( array(
730 'text' => wfMsg( 'mainpagetext' ) . "\n\n" . wfMsg( 'mainpagedocfooter' ),
733 'user_text' => 'MediaWiki default',
735 $revid = $revision->insertOn( $wgDatabase );
736 $article->updateRevisionOn( $wgDatabase, $revision );
739 initialiseMessages();
740 print "</pre></li>\n";
743 /* Write out the config file now that all is well */
744 print "<p>Creating LocalSettings.php...</p>\n\n";
745 $localSettings = "<" . "?php$endl$local$endl?" . ">";
746 // Fix up a common line-ending problem (due to CVS on Windows)
747 $localSettings = str_replace( "\r\n", "\n", $localSettings );
749 if( version_compare( phpversion(), "4.3.2" ) >= 0 ) {
750 $xt = "xt"; # Refuse to overwrite an existing file
752 $xt = "wt"; # 'x' is not available prior to PHP 4.3.2. We did check above, but race conditions blah blah
754 $f = fopen( "LocalSettings.php", $xt );
757 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" .
758 "<p>Here's the file that would have been written, try to paste it into place manually:</p>\n" .
759 "<pre>\n" . htmlspecialchars( $localSettings ) . "</pre>\n" );
761 if(fwrite( $f, $localSettings ) ) {
763 writeSuccessMessage();
766 die("<p class='error'>An error occured while writing the config/LocalSettings.php file. Check user rights and disk space then try again.</p>\n");
778 if( count( $errs ) ) {
779 /* Display options form */
781 if( $conf->posted
) {
782 echo "<p class='error-top'>Something's not quite right yet; make sure everything below is filled out correctly.</p>\n";
786 <form action
="index.php" name
="config" method
="post">
791 <div
class="config-section">
792 <div
class="config-input">
794 aField( $conf, "Sitename", "Wiki name:" );
797 <p
class="config-desc">
798 Preferably a short word without punctuation
, i
.e
. "Wikipedia".<br
>
799 Will appear
as the
namespace name
for "meta" pages
, and throughout the
interface.
802 <div
class="config-input">
804 aField( $conf, "EmergencyContact", "Contact e-mail:" );
807 <p
class="config-desc">
808 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
.
811 <div
class="config-input">
812 <label
class='column' for="LanguageCode">Language
:</label
>
813 <select id
="LanguageCode" name
="LanguageCode">
816 $list = getLanguageList();
817 foreach( $list as $code => $name ) {
818 $sel = ($code == $conf->LanguageCode
) ?
'selected="selected"' : '';
819 echo "\t\t<option value=\"$code\" $sel>$name</option>\n";
824 <p
class="config-desc">
825 Select the language
for your wiki
's interface. Some localizations aren't fully complete
. Unicode (UTF
-8) used
for all localizations
.
828 <div
class="config-input">
829 <label
class='column'>Copyright
/license
:</label
>
832 <li
><?php
aField( $conf, "License", "No license metadata", "radio", "none" ); ?
></li
>
833 <li
><?php
aField( $conf, "License", "GNU Free Documentation License 1.2 (Wikipedia-compatible)", "radio", "gfdl" ); ?
></li
>
835 aField( $conf, "License", "A Creative Commons license - ", "radio", "cc" );
836 $partner = "MediaWiki";
837 $exit = urlencode( "$wgServer{$conf->ScriptPath}/config/index.php?License=cc&RightsUrl=[license_url]&RightsText=[license_name]&RightsCode=[license_code]&RightsIcon=[license_button]" );
838 $icon = urlencode( "$wgServer$wgUploadPath/wiki.png" );
839 $ccApp = htmlspecialchars( "http://creativecommons.org/license/?partner=$partner&exit_url=$exit&partner_icon_url=$icon" );
840 print "<a href=\"$ccApp\" target='_blank'>choose</a>";
842 <?php
if( $conf->License
== "cc" ) { ?
>
844 <li
><?php
aField( $conf, "RightsIcon", "<img src=\"" . htmlspecialchars( $conf->RightsIcon
) . "\" alt='icon' />", "hidden" ); ?
></li
>
845 <li
><?php
aField( $conf, "RightsText", htmlspecialchars( $conf->RightsText
), "hidden" ); ?
></li
>
846 <li
><?php
aField( $conf, "RightsCode", "code: " . htmlspecialchars( $conf->RightsCode
), "hidden" ); ?
></li
>
847 <li
><?php
aField( $conf, "RightsUrl", "<a href=\"" . htmlspecialchars( $conf->RightsUrl
) . "\">" . htmlspecialchars( $conf->RightsUrl
) . "</a>", "hidden" ); ?
></li
>
853 <p
class="config-desc">
854 A notice
, icon
, and machine
-readable copyright metadata will be displayed
for the license you pick
.
858 <div
class="config-input">
859 <?php
aField( $conf, "SysopName", "Admin username:" ) ?
>
861 <div
class="config-input">
862 <?php
aField( $conf, "SysopPass", "Password:", "password" ) ?
>
864 <div
class="config-input">
865 <?php
aField( $conf, "SysopPass2", "Password confirm:", "password" ) ?
>
867 <p
class="config-desc">
868 An admin can lock
/delete pages
, block users from editing
, and other maintenance tasks
.<br
>
869 A
new account will be added only when creating a
new wiki database
.
872 <div
class="config-input">
873 <label
class='column'>Shared memory caching
:</label
>
876 <li
><?php
aField( $conf, "Shm", "No caching", "radio", "none" ); ?
></li
>
878 if ( $conf->turck
) {
880 aField( $conf, "Shm", "Turck MMCache", "radio", "turck" );
885 if ( $conf->eaccel
) {
887 aField( $conf, "Shm", "eAccelerator", "radio", "eaccel" );
891 <li
><?php
aField( $conf, "Shm", "Memcached", "radio", "memcached" ); ?
></li
>
893 <div style
="clear:left"><?php
aField( $conf, "MCServers", "Memcached servers:", "text" ) ?
></div
>
895 <p
class="config-desc">
896 Using a shared memory system such
as Turck MMCache
, eAccelerator
, or Memcached will speed
897 up MediaWiki significantly
. Memcached is the best solution but needs to be
898 installed
. Specify the server addresses
and ports in a comma
-separted
list. Only
899 use Turck shared memory
if the wiki will be running on a single Apache server
.
903 <h2
>E
-mail
, e
-mail notification
and authentication setup
</h2
>
905 <div
class="config-section">
906 <div
class="config-input">
907 <label
class='column'>E
-mail (general
):</label
>
909 <li
><?php
aField( $conf, "Email", "Enabled", "radio", "email_enabled" ); ?
></li
>
910 <li
><?php
aField( $conf, "Email", "Disabled", "radio", "email_disabled" ); ?
></li
>
913 <p
class="config-desc">
914 Use this to disable all e
-mail
functions (send a password reminder
, user
-to
-user e
-mail
and e
-mail notification
),
915 if sending e
-mails on your server doesn
't work.
917 <div class="config-input">
918 <label class='column
'>User-to-user e-mail:</label>
920 <li><?php aField( $conf, "Emailuser", "Enabled", "radio", "emailuser_enabled" ); ?></li>
921 <li><?php aField( $conf, "Emailuser", "Disabled", "radio", "emailuser_disabled" ); ?></li>
924 <p class="config-desc">
925 Use this to disable only the user-to-user e-mail function (EmailUser).
927 <div class="config-input">
928 <label class='column
'>E-mail notification:</label>
930 <li><?php aField( $conf, "Enotif", "Disabled", "radio", "enotif_disabled" ); ?></li>
931 <li><?php aField( $conf, "Enotif", "Enabled for user_talk changes only", "radio", "enotif_usertalk" ); ?></li>
932 <li><?php aField( $conf, "Enotif", "Enabled for user_talk and watch list changes (not recommended for large wikis)", "radio", "enotif_allpages" ); ?></li>
935 <div class="config-desc">
937 E-mail notification sends a notification e-mail to a user, when the user_talk page is changed
938 and/or when watch-listed pages are changed, depending on the above settings.
939 When testing this feature, be reminded, that obviously an e-mail address must be present in your preferences
940 and that your own changes never trigger notifications to be sent to yourself.</p>
942 <p>Users get corresponding options to select or deselect in their users' preferences
.
943 The user options are not shown on the preference page
, if e
-mail notification is disabled
.</p
>
945 <p
>There are additional options
for fine tuning in
/includes
/DefaultSettings
.php
.</p
>
948 <div
class="config-input">
949 <label
class='column'>E
-mail authentication
:</label
>
951 <li
><?php
aField( $conf, "Eauthent", "Disabled", "radio", "eauthent_disabled" ); ?
></li
>
952 <li
><?php
aField( $conf, "Eauthent", "Enabled", "radio", "eauthent_enabled" ); ?
></li
>
955 <div
class="config-desc">
956 <p
>E
-mail address authentication uses a scheme to authenticate e
-mail addresses of the users
. The user who initially enters
or changes his
/her stored e
-mail address
957 gets a link with a token mailed to that address
. The stored e
-mail address is authenticated at the moment the user comes back to the wiki via the link
.</p
>
959 <p
>The e
-mail address stays authenticated
as long
as the user does not change it
; the time of authentication is indicated
960 on the user preference page
.</p
>
962 <p
>If the option is enabled
, only authenticated e
-mail addresses can receive EmailUser mails
and/or
963 e
-mail notification mails
.</p
>
968 <h2
>Database config
</h2
>
970 <div
class="config-section">
971 <div
class="config-input">
972 <label
class='column'>Database type
:</label
>
974 <li
><?php
aField( $conf, "DBtype", "MySQL", "radio", "mysql"); ?
></li
>
975 <li
><?php
aField( $conf, "DBtype", "Oracle (experimental)", "radio", "oracle" ); ?
></li
>
979 <div
class="config-input" style
="clear:left"><?php
980 aField( $conf, "DBserver", "SQL server host:" );
982 <p
class="config-desc">
983 If your database server isn
't on your web server, enter the name
984 or IP address here. MySQL only.
987 <div class="config-input"><?php
988 aField( $conf, "DBname", "Database name:" );
990 <div class="config-desc">
991 If using Oracle, set this to your connection identifier.
993 <div class="config-input"><?php
994 aField( $conf, "DBuser", "DB username:" );
996 <div class="config-input"><?php
997 aField( $conf, "DBpassword", "DB password:", "password" );
999 <div class="config-input"><?php
1000 aField( $conf, "DBpassword2", "DB password confirm:", "password" );
1002 <p class="config-desc">
1003 If you only have a single user account and database available,
1004 enter those here. If you have database root access (see below)
1005 you can specify new accounts/databases to be created.
1008 This account will not be created if it pre-exists. If this is the case, ensure that it
1009 has SELECT, INSERT, UPDATE and DELETE permissions on the MediaWiki database.
1012 <div class="config-input"><?php
1013 aField( $conf, "DBprefix", "Database table prefix:" );
1015 <div class="config-desc">
1016 <p>If you need to share one database between multiple wikis, or
1017 MediaWiki and another web application, you may choose to
1018 add a prefix to all the table names to avoid conflicts.</p>
1020 <p>Avoid exotic characters; something like <tt>mw_</tt> is good.</p>
1023 <div class="config-input"><label class="column">Database charset</label>
1024 <div>Select one:</div>
1026 <li><?php aField( $conf, "DBmysql5", "Backwards-compatible UTF-8", "radio", "false" ); ?></li>
1027 <li><?php aField( $conf, "DBmysql5", "Experimental MySQL 4.1/5.0 UTF-8", "radio", "true" ); ?></li>
1030 <p class="config-desc">
1031 <b>EXPERIMENTAL:</b> You can enable explicit Unicode charset support
1032 for MySQL 4.1 and 5.0 servers. This is not well tested and may
1033 cause things to break. <b>If upgrading an older installation, leave
1034 in backwards-compatible mode.</b>
1037 <div class="config-input">
1039 aField( $conf, "RootUser", "Superuser account:", "superuser" );
1042 <div class="config-input">
1044 aField( $conf, "RootPW", "Superuser password:", "password" );
1048 <p class="config-desc">
1049 If the database user specified above does not exist, or does not have access to create
1050 the database (if needed) or tables within it, please provide details of a superuser account,
1051 such as <strong>root</strong>, which does. Leave the password set to <strong>-</strong> if this is not needed.
1054 <div class="config-input" style="padding:2em 0 3em">
1055 <label class='column
'> </label>
1056 <input type="submit" value="Install MediaWiki!" class="btn-install" />
1066 /* -------------------------------------------------------------------------------------- */
1067 function writeSuccessMessage() {
1068 if ( ini_get( 'safe_mode
' ) && !ini_get( 'open_basedir
' ) ) {
1070 <p>Installation successful!</p>
1071 <p>To complete the installation, please do the following:
1073 <li>Download config/LocalSettings.php with your FTP client or file manager</li>
1074 <li>Upload it to the parent directory</li>
1075 <li>Delete config/LocalSettings.php</li>
1076 <li>Start using <a href='../index
.php
'>your wiki</a>!
1078 <p>If you are in a shared hosting environment, do <strong>not</strong> just move LocalSettings.php
1079 remotely. LocalSettings.php is currently owned by the user your webserver is running under,
1080 which means that anyone on the same server can read your database password! Downloading
1081 it and uploading it again will hopefully change the ownership to a user ID specific to you.</p>
1084 echo "<p>Installation successful! Move the config/LocalSettings.php file into the parent directory, then follow
1085 <a href='../index
.php
'>this link</a> to your wiki.</p>\n";
1090 function escapePhpString( $string ) {
1091 return strtr( $string,
1102 function writeLocalSettings( $conf ) {
1103 $conf->UseImageResize = $conf->UseImageResize ? 'true' : 'false';
1104 $conf->PasswordSender = $conf->EmergencyContact;
1105 $zlib = ($conf->zlib ? "" : "# ");
1106 $magic = ($conf->ImageMagick ? "" : "# ");
1107 $convert = ($conf->ImageMagick ? $conf->ImageMagick : "/usr/bin/convert" );
1108 $pretty = ($conf->prettyURLs ? "" : "# ");
1109 $ugly = ($conf->prettyURLs ? "# " : "");
1110 $rights = ($conf->RightsUrl) ? "" : "# ";
1111 $hashedUploads = $conf->safeMode ? '' : '# ';
1113 switch ( $conf->Shm
) {
1115 $cacheType = 'CACHE_MEMCACHED';
1116 $mcservers = var_export( $conf->MCServerArray
, true );
1120 $cacheType = 'CACHE_ACCEL';
1121 $mcservers = 'array()';
1124 $cacheType = 'CACHE_NONE';
1125 $mcservers = 'array()';
1128 if ( $conf->Email
== 'email_enabled' ) {
1129 $enableemail = 'true';
1130 $enableuseremail = ( $conf->Emailuser
== 'emailuser_enabled' ) ?
'true' : 'false' ;
1131 $eauthent = ( $conf->Eauthent
== 'eauthent_enabled' ) ?
'true' : 'false' ;
1132 switch ( $conf->Enotif
) {
1133 case 'enotif_usertalk':
1134 $enotifusertalk = 'true';
1135 $enotifwatchlist = 'false';
1137 case 'enotif_allpages':
1138 $enotifusertalk = 'true';
1139 $enotifwatchlist = 'true';
1142 $enotifusertalk = 'false';
1143 $enotifwatchlist = 'false';
1146 $enableuseremail = 'false';
1147 $enableemail = 'false';
1148 $eauthent = 'false';
1149 $enotifusertalk = 'false';
1150 $enotifwatchlist = 'false';
1153 $file = @fopen
( "/dev/urandom", "r" );
1155 $secretKey = bin2hex( fread( $file, 32 ) );
1159 for ( $i=0; $i<8; $i++
) {
1160 $secretKey .= dechex(mt_rand(0, 0x7fffffff));
1162 print "<li>Warning: \$wgSecretKey key is insecure, generated with mt_rand(). Consider changing it manually.</li>\n";
1165 # Add slashes to strings for double quoting
1166 $slconf = array_map( "escapePhpString", get_object_vars( $conf ) );
1167 if( $conf->License
== 'gfdl' ) {
1168 # Needs literal string interpolation for the current style path
1169 $slconf['RightsIcon'] = $conf->RightsIcon
;
1172 $sep = PATH_SEPARATOR
;
1174 # This file was automatically generated by the MediaWiki installer.
1175 # If you make manual changes, please keep track in case you need to
1176 # recreate them later.
1178 # See includes/DefaultSettings.php for all configurable settings
1179 # and their default values, but don't forget to make changes in _this_
1182 # If you customize your file layout, set \$IP to the directory that contains
1183 # the other MediaWiki files. It will be used as a base to locate files.
1184 if( defined( 'MW_INSTALL_PATH' ) ) {
1185 \$IP = MW_INSTALL_PATH;
1187 \$IP = dirname( __FILE__ );
1190 \$path = array( \$IP, \"\$IP/includes\", \"\$IP/languages\" );
1191 set_include_path( implode( PATH_SEPARATOR, \$path ) );
1193 require_once( \"includes/DefaultSettings.php\" );
1195 # If PHP's memory limit is very low, some operations may fail.
1196 " . ($conf->raiseMemory ?
'' : '# ' ) . "ini_set( 'memory_limit', '20M' );" . "
1198 if ( \$wgCommandLineMode ) {
1199 if ( isset( \$_SERVER ) && array_key_exists( 'REQUEST_METHOD', \$_SERVER ) ) {
1200 die( \"This script must be run from the command line\\n\" );
1202 } elseif ( empty( \$wgNoOutputBuffer ) ) {
1203 ## Compress output if the browser supports it
1204 {$zlib}if( !ini_get( 'zlib.output_compression' ) ) @ob_start( 'ob_gzhandler' );
1207 \$wgSitename = \"{$slconf['Sitename']}\";
1209 \$wgScriptPath = \"{$slconf['ScriptPath']}\";
1210 \$wgScript = \"\$wgScriptPath/index.php\";
1211 \$wgRedirectScript = \"\$wgScriptPath/redirect.php\";
1213 ## For more information on customizing the URLs please see:
1214 ## http://meta.wikimedia.org/wiki/Eliminating_index.php_from_the_url
1215 ## If using PHP as a CGI module, the ?title= style usually must be used.
1216 {$pretty}\$wgArticlePath = \"\$wgScript/\$1\";
1217 {$ugly}\$wgArticlePath = \"\$wgScript?title=\$1\";
1219 \$wgStylePath = \"\$wgScriptPath/skins\";
1220 \$wgStyleDirectory = \"\$IP/skins\";
1221 \$wgLogo = \"\$wgStylePath/common/images/wiki.png\";
1223 \$wgUploadPath = \"\$wgScriptPath/images\";
1224 \$wgUploadDirectory = \"\$IP/images\";
1226 \$wgEnableEmail = $enableemail;
1227 \$wgEnableUserEmail = $enableuseremail;
1229 \$wgEmergencyContact = \"{$slconf['EmergencyContact']}\";
1230 \$wgPasswordSender = \"{$slconf['PasswordSender']}\";
1232 ## For a detailed description of the following switches see
1233 ## http://meta.wikimedia.org/Enotif and http://meta.wikimedia.org/Eauthent
1234 ## There are many more options for fine tuning available see
1235 ## /includes/DefaultSettings.php
1236 ## UPO means: this is also a user preference option
1237 \$wgEnotifUserTalk = $enotifusertalk; # UPO
1238 \$wgEnotifWatchlist = $enotifwatchlist; # UPO
1239 \$wgEmailAuthentication = $eauthent;
1241 \$wgDBserver = \"{$slconf['DBserver']}\";
1242 \$wgDBname = \"{$slconf['DBname']}\";
1243 \$wgDBuser = \"{$slconf['DBuser']}\";
1244 \$wgDBpassword = \"{$slconf['DBpassword']}\";
1245 \$wgDBprefix = \"{$slconf['DBprefix']}\";
1246 \$wgDBtype = \"{$slconf['DBtype']}\";
1248 # Experimental charset support for MySQL 4.1/5.0.
1249 \$wgDBmysql5 = {$conf->DBmysql5};
1251 ## Shared memory settings
1252 \$wgMainCacheType = $cacheType;
1253 \$wgMemCachedServers = $mcservers;
1255 ## To enable image uploads, make sure the 'images' directory
1256 ## is writable, then set this to true:
1257 \$wgEnableUploads = false;
1258 \$wgUseImageResize = {$conf->UseImageResize};
1259 {$magic}\$wgUseImageMagick = true;
1260 {$magic}\$wgImageMagickConvertCommand = \"{$convert}\";
1262 ## If you want to use image uploads under safe mode,
1263 ## create the directories images/archive, images/thumb and
1264 ## images/temp, and make them all writable. Then uncomment
1265 ## this, if it's not already uncommented:
1266 {$hashedUploads}\$wgHashedUploadDirectory = false;
1268 ## If you have the appropriate support software installed
1269 ## you can enable inline LaTeX equations:
1271 \$wgMathPath = \"{\$wgUploadPath}/math\";
1272 \$wgMathDirectory = \"{\$wgUploadDirectory}/math\";
1273 \$wgTmpDirectory = \"{\$wgUploadDirectory}/tmp\";
1275 \$wgLocalInterwiki = \$wgSitename;
1277 \$wgLanguageCode = \"{$slconf['LanguageCode']}\";
1279 \$wgProxyKey = \"$secretKey\";
1281 ## Default skin: you can change the default skin. Use the internal symbolic
1282 ## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook':
1283 \$wgDefaultSkin = 'monobook';
1285 ## For attaching licensing metadata to pages, and displaying an
1286 ## appropriate copyright notice / icon. GNU Free Documentation
1287 ## License and Creative Commons licenses are supported so far.
1288 {$rights}\$wgEnableCreativeCommonsRdf = true;
1289 \$wgRightsPage = \"\"; # Set to the title of a wiki page that describes your license/copyright
1290 \$wgRightsUrl = \"{$slconf['RightsUrl']}\";
1291 \$wgRightsText = \"{$slconf['RightsText']}\";
1292 \$wgRightsIcon = \"{$slconf['RightsIcon']}\";
1293 # \$wgRightsCode = \"{$slconf['RightsCode']}\"; # Not yet used
1295 \$wgDiff3 = \"{$slconf['diff3']}\";
1297 # When you make changes to this configuration file, this will make
1298 # sure that cached pages are cleared.
1299 \$configdate = gmdate( 'YmdHis', @filemtime( __FILE__ ) );
1300 \$wgCacheEpoch = max( \$wgCacheEpoch, \$configdate );
1302 // Keep things in Unix line endings internally;
1303 // the system will write out as local text type.
1304 return str_replace( "\r\n", "\n", $localsettings );
1307 function dieout( $text ) {
1308 die( $text . "\n\n</body>\n</html>" );
1311 function importVar( &$var, $name, $default = "" ) {
1312 if( isset( $var[$name] ) ) {
1313 $retval = $var[$name];
1314 if ( get_magic_quotes_gpc() ) {
1315 $retval = stripslashes( $retval );
1323 function importPost( $name, $default = "" ) {
1324 return importVar( $_POST, $name, $default );
1327 function importRequest( $name, $default = "" ) {
1328 return importVar( $_REQUEST, $name, $default );
1333 function aField( &$conf, $field, $text, $type = "text", $value = "" ) {
1336 $xtype = "type=\"$type\"";
1341 if(!(isset($id)) or ($id == "") ) $id = $field;
1342 $nolabel = ($type == "radio") ||
($type == "hidden");
1344 if ($type == 'radio')
1345 $id .= $radioCount++
;
1350 echo "\t\t<label class='column' for=\"$id\">$text</label>\n";
1353 if( $type == "radio" && $value == $conf->$field ) {
1354 $checked = "checked='checked'";
1358 echo "\t\t<input $xtype name=\"$field\" id=\"$id\" class=\"iput-$type\" $checked value=\"";
1359 if( $type == "radio" ) {
1360 echo htmlspecialchars( $value );
1362 echo htmlspecialchars( $conf->$field );
1366 echo " $text</label>\n";
1370 if(isset($errs[$field])) echo "<span class='error'>" . $errs[$field] . "</span>\n";
1373 function getLanguageList() {
1374 global $wgLanguageNames;
1375 if( !isset( $wgLanguageNames ) ) {
1376 $wgContLanguageCode = "xxx";
1377 function wfLocalUrl( $x ) { return $x; }
1378 function wfLocalUrlE( $x ) { return $x; }
1379 require_once( "languages/Names.php" );
1384 $d = opendir( "../languages" );
1385 while( false !== ($f = readdir( $d ) ) ) {
1387 if( preg_match( '/Language([A-Z][a-z_]+)\.php$/', $f, $m ) ) {
1388 $code = str_replace( '_', '-', strtolower( $m[1] ) );
1389 if( isset( $wgLanguageNames[$code] ) ) {
1390 $name = $code . ' - ' . $wgLanguageNames[$code];
1394 $codes[$code] = $name;
1402 #Check for location of an executable
1403 # @param string $loc single location to check
1404 # @param array $names filenames to check for.
1405 # @param mixed $versioninfo array of details to use when checking version, use false for no version checking
1406 function locate_executable($loc, $names, $versioninfo = false) {
1407 if (!is_array($names))
1408 $names = array($names);
1410 foreach ($names as $name) {
1411 $command = "$loc".DIRECTORY_SEPARATOR
."$name";
1412 if (file_exists($command)) {
1416 $file = str_replace('$1', $command, $versioninfo[0]);
1417 if (strstr(`
$file`
, $versioninfo[1]) !== false)
1424 function get_db_version() {
1425 global $wgDatabase, $conf;
1426 if ($conf->DBtype
== 'mysql')
1427 return mysql_get_server_info( $wgDatabase->mConn
);
1428 else if ($conf->DBtype
== 'oracle')
1429 return oci_server_version($wgDatabase->mConn
);
1432 # Test a memcached server
1433 function testMemcachedServer( $server ) {
1434 $hostport = explode(":", $server);
1437 if ( !function_exists( 'fsockopen' ) ) {
1438 $errstr = "Can't connect to memcached, fsockopen() not present";
1440 if ( !$errstr && count( $hostport ) != 2 ) {
1441 $errstr = 'Please specify host and port';
1442 var_dump( $hostport );
1445 list( $host, $port ) = $hostport;
1449 $fp = @fsockopen
( $host, $port, $errno, $fsockerr, 1.0 );
1450 if ( $fp === false ) {
1451 $errstr = "Cannot connect to memcached on $host:$port : $fsockerr";
1455 $command = "version\r\n";
1456 $bytes = fwrite( $fp, $command );
1457 if ( $bytes != strlen( $command ) ) {
1458 $errstr = "Cannot write to memcached socket on $host:$port";
1462 $expected = "VERSION ";
1463 $response = fread( $fp, strlen( $expected ) );
1464 if ( $response != $expected ) {
1465 $errstr = "Didn't get correct memcached response from $host:$port";
1472 echo "<li>Connected to memcached on $host:$port successfully";
1478 <div
class="license">
1480 <p
>This program is free software
; you can redistribute it
and/or modify
1481 it under the terms of the GNU General
Public License
as published by
1482 the Free Software Foundation
; either version
2 of the License
, or
1483 (at your option
) any later version
.</p
>
1485 <p
>This program is distributed in the hope that it will be useful
,
1486 but WITHOUT ANY WARRANTY
; without even the implied warranty of
1487 MERCHANTABILITY
or FITNESS
FOR A PARTICULAR PURPOSE
. See the
1488 GNU General
Public License
for more details
.</p
>
1490 <p
>You should have received
<a href
="../COPYING">a copy of the GNU General
Public License
</a
>
1491 along with this program
; if not
, write to the Free Software
1492 Foundation
, Inc
., 51 Franklin Street
, Fifth Floor
, Boston
, MA
02110-1301, USA
.
1493 or <a href
="http://www.gnu.org/copyleft/gpl.html">read it online
</a
></p
>
1499 <div id
="column-one">
1500 <div
class="portlet" id
="p-logo">
1501 <a style
="background-image: url(../skins/common/images/mediawiki.png);"
1502 href
="http://www.mediawiki.org/"
1503 title
="Main Page"></a
>
1505 <script type
="text/javascript"> if (window
.isMSIE55
) fixalpha(); </script
>
1506 <div
class='portlet'><div
class='pBody'>
1508 <li
><strong
><a href
="http://www.mediawiki.org/">MediaWiki home
</a
></strong
></li
>
1509 <li
><a href
="../README">Readme
</a
></li
>
1510 <li
><a href
="../RELEASE-NOTES">Release notes
</a
></li
>
1511 <li
><a href
="../docs/">Documentation
</a
></li
>
1512 <li
><a href
="http://meta.wikipedia.org/wiki/MediaWiki_User's_Guide">User
's Guide</a></li>
1513 <li><a href="http://meta.wikimedia.org/wiki/MediaWiki_FAQ">FAQ</a></li>
1515 <p style="font-size:90%;margin-top:1em">MediaWiki is Copyright © 2001-2006 by Magnus Manske, Brion Vibber, Lee Daniel Crocker, Tim Starling, Erik Möller, Gabriel Wicke and others.</p>