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 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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
); }
187 <h2
>Checking environment
...</h2
>
188 <p
><em
>Please
include all of the lines below when reporting installation problems
.</em
></p
>
189 <ul
class="env-check">
193 $wgNoOutputBuffer = true;
194 $conf = new ConfigData
;
196 install_version_checks();
198 print "<li>PHP " . phpversion() . " installed</li>\n";
200 if( ini_get( "register_globals" ) ) {
203 <div style
="font-size:110%">
204 <strong
class="error">Warning
:</strong
>
205 <strong
>PHP
's <tt><a href="http://php.net/register_globals">register_globals</a></tt> option is enabled. Disable it if you can.</strong>
207 MediaWiki will work, but your server is more exposed to PHP-based security vulnerabilities.
214 if( ini_get( "magic_quotes_runtime" ) ) {
216 ?><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>
217 This option corrupts data input unpredictably
; you cannot install
or use
218 MediaWiki unless this option is disabled
.
222 if( ini_get( "magic_quotes_sybase" ) ) {
224 ?
><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
>
225 This option corrupts data input unpredictably
; you cannot install
or use
226 MediaWiki unless this option is disabled
.
230 if( ini_get( "mbstring.func_overload" ) ) {
232 ?
><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
>
233 This option causes errors
and may corrupt data unpredictably
;
234 you cannot install
or use MediaWiki unless this option is disabled
.
239 dieout( "</ul><p>Cannot install MediaWiki.</p>" );
242 if( ini_get( "safe_mode" ) ) {
243 $conf->safeMode
= true;
245 <li
><b
class='error'>Warning
:</b
> <strong
>PHP
's
246 <a href='http
://www.php.net/features.safe-mode'>safe mode</a> is active.</strong>
247 You may have problems caused by this
, particularly
if using image uploads
.
251 $conf->safeMode
= false;
254 $sapi = php_sapi_name();
255 $conf->prettyURLs
= true;
256 print "<li>PHP server API is $sapi; ";
259 case "apache2handler":
260 print "ok, using pretty URLs (<tt>index.php/Page_Title</tt>)";
266 case "apache2filter":
268 print "using ugly URLs (<tt>index.php?title=Page_Title</tt>)";
269 $conf->prettyURLs
= false;
274 $conf->xml
= function_exists( "utf8_encode" );
276 print "<li>Have XML / Latin1-UTF-8 conversion support.</li>\n";
278 dieout( "PHP's XML module is missing; the wiki requires functions in
279 this module and won't work in this configuration.
280 If you're running Mandrake, install the php-xml package." );
283 # Crude check for session support
284 if( !function_exists( 'session_name' ) )
285 dieout( "PHP's session module is missing. MediaWiki requires session support in order to function." );
287 $memlimit = ini_get( "memory_limit" );
288 $conf->raiseMemory
= false;
289 if( empty( $memlimit ) ||
$memlimit == -1 ) {
290 print "<li>PHP is configured with no <tt>memory_limit</tt>.</li>\n";
292 print "<li>PHP's <tt>memory_limit</tt> is " . htmlspecialchars( $memlimit ) . ". <strong>If this is too low, installation may fail!</strong> ";
293 $n = intval( $memlimit );
294 if( preg_match( '/^([0-9]+)[Mm]$/', trim( $memlimit ), $m ) ) {
295 $n = intval( $m[1] * (1024*1024) );
297 if( $n < 20*1024*1024 ) {
298 print "Attempting to raise limit to 20M... ";
299 if( false === ini_set( "memory_limit", "20M" ) ) {
302 $conf->raiseMemory
= true;
309 $conf->zlib
= function_exists( "gzencode" );
311 print "<li>Have zlib support; enabling output compression.</li>\n";
313 print "<li>No zlib support.</li>\n";
316 $conf->turck
= function_exists( 'mmcache_get' );
317 if ( $conf->turck
) {
318 print "<li><a href=\"http://turck-mmcache.sourceforge.net/\">Turck MMCache</a> installed</li>\n";
320 $conf->eaccel
= function_exists( 'eaccelerator_get' );
321 if ( $conf->eaccel
) {
322 $conf->turck
= 'eaccelerator';
323 print "<li><a href=\"http://eaccelerator.sourceforge.net/\">eAccelerator</a> installed</li>\n";
325 if (!$conf->turck
&& !$conf->eaccel
) {
326 print "<li>Neither <a href=\"http://turck-mmcache.sourceforge.net/\">Turck MMCache</a> nor <a href=\"http://eaccelerator.sourceforge.net/\">eAccelerator</a> are installed, " .
327 "can't use object caching functions</li>\n";
330 $conf->diff3
= false;
331 $diff3locations = array("/usr/bin", "/opt/csw/bin", "/usr/gnu/bin", "/usr/sfw/bin") +
explode($sep, getenv("PATH"));
332 $diff3names = array("gdiff3", "diff3", "diff3.exe");
334 $diff3versioninfo = array('$1 --version 2>&1', 'diff3 (GNU diffutils)');
335 foreach ($diff3locations as $loc) {
336 $exe = locate_executable($loc, $diff3names, $diff3versioninfo);
337 if ($exe !== false) {
344 print "<li>Found GNU diff3: <tt>$conf->diff3</tt>.</li>";
346 print "<li>GNU diff3 not found.</li>";
348 $conf->ImageMagick
= false;
349 $imcheck = array( "/usr/bin", "/usr/local/bin", "/sw/bin", "/opt/local/bin" );
350 foreach( $imcheck as $dir ) {
351 $im = "$dir/convert";
352 if( file_exists( $im ) ) {
353 print "<li>Found ImageMagick: <tt>$im</tt>; image thumbnailing will be enabled if you enable uploads.</li>\n";
354 $conf->ImageMagick
= $im;
359 $conf->HaveGD
= function_exists( "imagejpeg" );
360 if( $conf->HaveGD
) {
361 print "<li>Found GD graphics library built-in";
362 if( !$conf->ImageMagick
) {
363 print ", image thumbnailing will be enabled if you enable uploads";
367 if( !$conf->ImageMagick
) {
368 print "<li>Couldn't find GD library or ImageMagick; image thumbnailing disabled.</li>\n";
372 $conf->UseImageResize
= $conf->HaveGD ||
$conf->ImageMagick
;
374 $conf->IP
= dirname( dirname( __FILE__
) );
375 print "<li>Installation directory: <tt>" . htmlspecialchars( $conf->IP
) . "</tt></li>\n";
377 $conf->ScriptPath
= preg_replace( '{^(.*)/config.*$}', '$1', $_SERVER["PHP_SELF"] ); # was SCRIPT_NAME
378 print "<li>Script URI path: <tt>" . htmlspecialchars( $conf->ScriptPath
) . "</tt></li>\n";
380 print "<li style='font-weight:bold;color:green;font-size:110%'>Environment checked. You can install MediaWiki.</li>\n";
381 $conf->posted
= ($_SERVER["REQUEST_METHOD"] == "POST");
383 $conf->Sitename
= ucfirst( importPost( "Sitename", "" ) );
384 $defaultEmail = empty( $_SERVER["SERVER_ADMIN"] )
386 : $_SERVER["SERVER_ADMIN"];
387 $conf->EmergencyContact
= importPost( "EmergencyContact", $defaultEmail );
388 $conf->DBtype
= importPost( "DBtype", "mysql" );
389 $conf->DBserver
= importPost( "DBserver", "localhost" );
390 $conf->DBname
= importPost( "DBname", "wikidb" );
391 $conf->DBuser
= importPost( "DBuser", "wikiuser" );
392 $conf->DBpassword
= importPost( "DBpassword" );
393 $conf->DBpassword2
= importPost( "DBpassword2" );
394 $conf->DBprefix
= importPost( "DBprefix" );
395 $conf->DBmysql5
= (importPost( "DBmysql5" ) == "true") ?
"true" : "false";
396 $conf->RootUser
= importPost( "RootUser", "root" );
397 $conf->RootPW
= importPost( "RootPW", "-" );
398 $conf->LanguageCode
= importPost( "LanguageCode", "en" );
399 $conf->SysopName
= importPost( "SysopName", "WikiSysop" );
400 $conf->SysopPass
= importPost( "SysopPass" );
401 $conf->SysopPass2
= importPost( "SysopPass2" );
403 /* Check for validity */
406 if( $conf->Sitename
== "" ||
$conf->Sitename
== "MediaWiki" ||
$conf->Sitename
== "Mediawiki" ) {
407 $errs["Sitename"] = "Must not be blank or \"MediaWiki\"";
409 if( $conf->DBuser
== "" ) {
410 $errs["DBuser"] = "Must not be blank";
412 if( $conf->DBpassword
== "" ) {
413 $errs["DBpassword"] = "Must not be blank";
415 if( $conf->DBpassword
!= $conf->DBpassword2
) {
416 $errs["DBpassword2"] = "Passwords don't match!";
418 if( !preg_match( '/^[A-Za-z_0-9]*$/', $conf->DBprefix
) ) {
419 $errs["DBprefix"] = "Invalid table prefix";
422 if( $conf->SysopPass
== "" ) {
423 $errs["SysopPass"] = "Must not be blank";
425 if( $conf->SysopPass
!= $conf->SysopPass2
) {
426 $errs["SysopPass2"] = "Passwords don't match!";
429 $conf->License
= importRequest( "License", "none" );
430 if( $conf->License
== "gfdl" ) {
431 $conf->RightsUrl
= "http://www.gnu.org/copyleft/fdl.html";
432 $conf->RightsText
= "GNU Free Documentation License 1.2";
433 $conf->RightsCode
= "gfdl";
434 $conf->RightsIcon
= '${wgStylePath}/common/images/gnu-fdl.png';
435 } elseif( $conf->License
== "none" ) {
436 $conf->RightsUrl
= $conf->RightsText
= $conf->RightsCode
= $conf->RightsIcon
= "";
438 $conf->RightsUrl
= importRequest( "RightsUrl", "" );
439 $conf->RightsText
= importRequest( "RightsText", "" );
440 $conf->RightsCode
= importRequest( "RightsCode", "" );
441 $conf->RightsIcon
= importRequest( "RightsIcon", "" );
444 $conf->Shm
= importRequest( "Shm", "none" );
445 $conf->MCServers
= importRequest( "MCServers" );
447 /* Test memcached servers */
449 if ( $conf->Shm
== 'memcached' && $conf->MCServers
) {
450 $conf->MCServerArray
= array_map( 'trim', explode( ',', $conf->MCServers
) );
451 foreach ( $conf->MCServerArray
as $server ) {
452 $error = testMemcachedServer( $server );
454 $errs["MCServers"] = $error;
458 } else if ( $conf->Shm
== 'memcached' ) {
459 $errs["MCServers"] = "Please specify at least one server if you wish to use memcached";
462 /* default values for installation */
463 $conf->Email
=importRequest("Email", "email_enabled");
464 $conf->Emailuser
=importRequest("Emailuser", "emailuser_enabled");
465 $conf->Enotif
=importRequest("Enotif", "enotif_allpages");
466 $conf->Eauthent
=importRequest("Eauthent", "eauthent_enabled");
468 if( $conf->posted
&& ( 0 == count( $errs ) ) ) {
469 do { /* So we can 'continue' to end prematurely */
470 $conf->Root
= ($conf->RootPW
!= "");
472 /* Load up the settings and get installin' */
473 $local = writeLocalSettings( $conf );
474 echo "<p><b>Generating configuration file...</b></p>\n";
475 echo "<pre>" . htmlspecialchars( $local ) . "</pre>\n";
477 $wgCommandLineMode = false;
480 if (!in_array($conf->DBtype
, array("mysql", "oracle"))) {
481 $errs["DBtype"] = "Unknown database type.";
484 print "<li>Database type: {$conf->DBtype}</li>\n";
485 $dbclass = 'Database'.ucfirst($conf->DBtype
);
486 require_once("$dbclass.php");
487 $wgDBtype = $conf->DBtype
;
488 $wgDBadminuser = "root";
489 $wgDBadminpassword = $conf->RootPW
;
490 $wgDBprefix = $conf->DBprefix
;
491 $wgCommandLineMode = true;
492 $wgUseDatabaseMessages = false; /* FIXME: For database failure */
493 require_once( "includes/Setup.php" );
496 require_once( "maintenance/InitialiseMessages.inc" );
498 $wgTitle = Title
::newFromText( "Installation script" );
499 $mysqlOldClient = version_compare( mysql_get_client_info(), "4.1.0", "lt" );
500 if( $mysqlOldClient ) {
501 print "<li><b>PHP is linked with old MySQL client libraries. If you are
502 using a MySQL 4.1 server and have problems connecting to the database,
503 see <a href='http://dev.mysql.com/doc/mysql/en/old-client.html'
504 >http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b></li>\n";
508 if( $conf->DBtype
== 'mysql' ) {
509 $ok = true; # Let's be optimistic
511 # Decide if we're going to use the superuser or the regular database user
512 if( $conf->RootPW
== '-' ) {
515 $db_user = $wgDBuser;
516 $db_pass = $wgDBpassword;
520 $db_user = $conf->RootUser
;
521 $db_pass = $conf->RootPW
;
525 echo( "<li>Attempting to connect to database server as $db_user..." );
526 $wgDatabase = Database
::newFromParams( $wgDBserver, $db_user, $db_pass, '', 1 );
528 # Check the connection and respond to errors
529 if( $wgDatabase->isOpen() ) {
532 $wgDBadminuser = $db_user;
533 $wgDBadminpassword = $db_pass;
534 echo( "success.</li>\n" );
535 $wgDatabase->ignoreErrors( true );
536 $myver = mysql_get_server_info( $wgDatabase->mConn
);
538 # There were errors, report them and back out
540 $errno = mysql_errno();
541 $errtx = htmlspecialchars( mysql_error() );
545 echo( "failed due to authentication errors. Check passwords.</li>" );
547 # The superuser details are wrong
548 $errs["RootUser"] = "Check username";
549 $errs["RootPW"] = "and password";
551 # The regular user details are wrong
552 $errs["DBuser"] = "Check username";
553 $errs["DBpassword"] = "and password";
559 # General connection problem
560 echo( "failed with error [$errno] $errtx.</li>\n" );
561 $errs["DBserver"] = "Connection failed";
566 if( !$ok ) { continue; }
568 } else /* not mysql */ {
569 print "<li>Connecting to SQL server...";
570 $wgDatabase = $dbc->newFromParams($wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1);
571 if (!$wgDatabase->isOpen()) {
572 print " error: " . $wgDatabase->lastError() . "</li>\n";
574 $wgDatabase->ignoreErrors(true);
575 $myver = get_db_version();
579 if ( !$wgDatabase->isOpen() ) {
580 $errs["DBserver"] = "Couldn't connect to database";
584 print "<li>Connected to $myver";
585 if( version_compare( $myver, "4.0.0" ) < 0 ) {
586 die( " -- mysql 4.0 or later required. Aborting." );
588 $mysqlNewAuth = version_compare( $myver, "4.1.0", "ge" );
589 if( $mysqlNewAuth && $mysqlOldClient ) {
590 print "; <b class='error'>You are using MySQL 4.1 server, but PHP is linked
591 to old client libraries; if you have trouble with authentication, see
592 <a href='http://dev.mysql.com/doc/mysql/en/old-client.html'
593 >http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b>";
596 if( $mysqlNewAuth ) {
597 print "; enabling MySQL 4.1/5.0 charset mode";
599 print "; <b class='error'>MySQL 4.1/5.0 charset mode enabled,
600 but older version detected; will likely fail.</b>";
605 if ($conf->DBtype
== 'mysql') {
606 @$sel = mysql_select_db( $wgDBname, $wgDatabase->mConn
);
608 print "<li>Database <tt>" . htmlspecialchars( $wgDBname ) . "</tt> exists</li>\n";
610 $err = mysql_errno();
611 if ( $err != 1049 ) {
612 print "<ul><li>Error selecting database $wgDBname: $err " .
613 htmlspecialchars( mysql_error() ) . "</li></ul>";
616 $res = $wgDatabase->query( "CREATE DATABASE `$wgDBname`" );
618 print "<li>Couldn't create database <tt>" .
619 htmlspecialchars( $wgDBname ) .
620 "</tt>; try with root access or check your username/pass.</li>\n";
621 $errs["RootPW"] = "<- Enter";
624 print "<li>Created database <tt>" . htmlspecialchars( $wgDBname ) . "</tt></li>\n";
626 $wgDatabase->selectDB( $wgDBname );
629 if( $wgDatabase->tableExists( "cur" ) ||
$wgDatabase->tableExists( "revision" ) ) {
630 print "<li>There are already MediaWiki tables in this database. Checking if updates are needed...</li>\n";
632 # Create user if required
634 $conn = Database
::newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1 );
635 if ( $conn->isOpen() ) {
636 print "<li>DB user account ok</li>\n";
639 print "<li>Granting user permissions...";
640 if( $mysqlOldClient && $mysqlNewAuth ) {
641 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>";
644 dbsource( "../maintenance/users.sql", $wgDatabase );
654 print "<li>Finished update checks.</li>\n";
656 # FIXME: Check for errors
657 print "<li>Creating tables...";
658 if ($conf->DBtype
== 'mysql') {
660 print " using MySQL 5 table defs...";
661 dbsource( "../maintenance/mysql5/tables.sql", $wgDatabase );
663 print " using MySQL 4 table defs...";
664 dbsource( "../maintenance/tables.sql", $wgDatabase );
666 dbsource( "../maintenance/interwiki.sql", $wgDatabase );
668 dbsource( "../maintenance/oracle/tables.sql", $wgDatabase );
669 dbsource( "../maintenance/oracle/interwiki.sql", $wgDatabase );
672 print " done.</li>\n";
674 print "<li>Initializing data...";
675 $wgDatabase->insert( 'site_stats',
676 array( 'ss_row_id' => 1,
677 'ss_total_views' => 0,
678 'ss_total_edits' => 0,
679 'ss_good_articles' => 0 ) );
681 # Set up the "regular user" account *if we can, and if we need to*
684 $wgDatabase2 = Database
::newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, '', 1 );
685 if( $wgDatabase2->isOpen() ) {
686 # Nope, just close the test connection and continue
687 $wgDatabase2->close();
688 echo( "<li>User $wgDBuser exists. Skipping grants.</li>" );
690 # Yes, so run the grants
691 echo( "<li>Granting user permissions to $wgDBuser on $wgDBname..." );
692 dbsource( "../maintenance/users.sql", $wgDatabase );
693 echo( "success.</li>" );
697 if( $conf->SysopName
) {
698 $u = User
::newFromName( $conf->getSysopName() );
699 if ( 0 == $u->idForName() ) {
701 $u->setPassword( $conf->getSysopPass() );
704 $u->addGroup( "sysop" );
705 $u->addGroup( "bureaucrat" );
707 print "<li>Created sysop account <tt>" .
708 htmlspecialchars( $conf->SysopName
) . "</tt>.</li>\n";
710 print "<li>Could not create user - already exists!</li>\n";
713 print "<li>Skipped sysop account creation, no name given.</li>\n";
716 $titleobj = Title
::newFromText( wfMsgNoDB( "mainpage" ) );
717 $article = new Article( $titleobj );
718 $newid = $article->insertOn( $wgDatabase );
719 $revision = new Revision( array(
721 'text' => wfMsg( 'mainpagetext' ) . "\n\n" . wfMsg( 'mainpagedocfooter' ),
724 'user_text' => 'MediaWiki default',
726 $revid = $revision->insertOn( $wgDatabase );
727 $article->updateRevisionOn( $wgDatabase, $revision );
730 initialiseMessages();
731 print "</pre></li>\n";
734 /* Write out the config file now that all is well */
735 print "<p>Creating LocalSettings.php...</p>\n\n";
736 $localSettings = "<" . "?php$endl$local$endl?" . ">";
737 // Fix up a common line-ending problem (due to CVS on Windows)
738 $localSettings = str_replace( "\r\n", "\n", $localSettings );
740 if( version_compare( phpversion(), "4.3.2" ) >= 0 ) {
741 $xt = "xt"; # Refuse to overwrite an existing file
743 $xt = "wt"; # 'x' is not available prior to PHP 4.3.2. We did check above, but race conditions blah blah
745 $f = fopen( "LocalSettings.php", $xt );
748 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" .
749 "<p>Here's the file that would have been written, try to paste it into place manually:</p>\n" .
750 "<pre>\n" . htmlspecialchars( $localSettings ) . "</pre>\n" );
752 if(fwrite( $f, $localSettings ) ) {
754 writeSuccessMessage();
757 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");
769 if( count( $errs ) ) {
770 /* Display options form */
772 if( $conf->posted
) {
773 echo "<p class='error-top'>Something's not quite right yet; make sure everything below is filled out correctly.</p>\n";
777 <form action
="index.php" name
="config" method
="post">
782 <div
class="config-section">
783 <div
class="config-input">
785 aField( $conf, "Sitename", "Wiki name:" );
788 <p
class="config-desc">
789 Preferably a short word without punctuation
, i
.e
. "Wikipedia".<br
>
790 Will appear
as the
namespace name
for "meta" pages
, and throughout the
interface.
793 <div
class="config-input">
795 aField( $conf, "EmergencyContact", "Contact e-mail:" );
798 <p
class="config-desc">
799 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
.
802 <div
class="config-input">
803 <label
class='column' for="LanguageCode">Language
:</label
>
804 <select id
="LanguageCode" name
="LanguageCode">
807 $list = getLanguageList();
808 foreach( $list as $code => $name ) {
809 $sel = ($code == $conf->LanguageCode
) ?
'selected="selected"' : '';
810 echo "\t\t<option value=\"$code\" $sel>$name</option>\n";
815 <p
class="config-desc">
816 Select the language
for your wiki
's interface. Some localizations aren't fully complete
. Unicode (UTF
-8) used
for all localizations
.
819 <div
class="config-input">
820 <label
class='column'>Copyright
/license
:</label
>
823 <li
><?php
aField( $conf, "License", "No license metadata", "radio", "none" ); ?
></li
>
824 <li
><?php
aField( $conf, "License", "GNU Free Documentation License 1.2 (Wikipedia-compatible)", "radio", "gfdl" ); ?
></li
>
826 aField( $conf, "License", "A Creative Commons license - ", "radio", "cc" );
827 $partner = "MediaWiki";
828 $exit = urlencode( "$wgServer{$conf->ScriptPath}/config/index.php?License=cc&RightsUrl=[license_url]&RightsText=[license_name]&RightsCode=[license_code]&RightsIcon=[license_button]" );
829 $icon = urlencode( "$wgServer$wgUploadPath/wiki.png" );
830 $ccApp = htmlspecialchars( "http://creativecommons.org/license/?partner=$partner&exit_url=$exit&partner_icon_url=$icon" );
831 print "<a href=\"$ccApp\" target='_blank'>choose</a>";
833 <?php
if( $conf->License
== "cc" ) { ?
>
835 <li
><?php
aField( $conf, "RightsIcon", "<img src=\"" . htmlspecialchars( $conf->RightsIcon
) . "\" alt='icon' />", "hidden" ); ?
></li
>
836 <li
><?php
aField( $conf, "RightsText", htmlspecialchars( $conf->RightsText
), "hidden" ); ?
></li
>
837 <li
><?php
aField( $conf, "RightsCode", "code: " . htmlspecialchars( $conf->RightsCode
), "hidden" ); ?
></li
>
838 <li
><?php
aField( $conf, "RightsUrl", "<a href=\"" . htmlspecialchars( $conf->RightsUrl
) . "\">" . htmlspecialchars( $conf->RightsUrl
) . "</a>", "hidden" ); ?
></li
>
844 <p
class="config-desc">
845 A notice
, icon
, and machine
-readable copyright metadata will be displayed
for the license you pick
.
849 <div
class="config-input">
850 <?php
aField( $conf, "SysopName", "Admin username:" ) ?
>
852 <div
class="config-input">
853 <?php
aField( $conf, "SysopPass", "Password:", "password" ) ?
>
855 <div
class="config-input">
856 <?php
aField( $conf, "SysopPass2", "Password confirm:", "password" ) ?
>
858 <p
class="config-desc">
859 An admin can lock
/delete pages
, block users from editing
, and other maintenance tasks
.<br
>
860 A
new account will be added only when creating a
new wiki database
.
863 <div
class="config-input">
864 <label
class='column'>Shared memory caching
:</label
>
867 <li
><?php
aField( $conf, "Shm", "No caching", "radio", "none" ); ?
></li
>
869 if ( $conf->turck
) {
871 aField( $conf, "Shm", "Turck MMCache", "radio", "turck" );
876 if ( $conf->eaccel
) {
878 aField( $conf, "Shm", "eAccelerator", "radio", "eaccel" );
882 <li
><?php
aField( $conf, "Shm", "Memcached", "radio", "memcached" ); ?
></li
>
884 <div style
="clear:left"><?php
aField( $conf, "MCServers", "Memcached servers:", "text" ) ?
></div
>
886 <p
class="config-desc">
887 Using a shared memory system such
as Turck MMCache
, eAccelerator
, or Memcached will speed
888 up MediaWiki significantly
. Memcached is the best solution but needs to be
889 installed
. Specify the server addresses
and ports in a comma
-separted
list. Only
890 use Turck shared memory
if the wiki will be running on a single Apache server
.
894 <h2
>E
-mail
, e
-mail notification
and authentication setup
</h2
>
896 <div
class="config-section">
897 <div
class="config-input">
898 <label
class='column'>E
-mail (general
):</label
>
900 <li
><?php
aField( $conf, "Email", "Enabled", "radio", "email_enabled" ); ?
></li
>
901 <li
><?php
aField( $conf, "Email", "Disabled", "radio", "email_disabled" ); ?
></li
>
904 <p
class="config-desc">
905 Use this to disable all e
-mail
functions (send a password reminder
, user
-to
-user e
-mail
and e
-mail notification
),
906 if sending e
-mails on your server doesn
't work.
908 <div class="config-input">
909 <label class='column
'>User-to-user e-mail:</label>
911 <li><?php aField( $conf, "Emailuser", "Enabled", "radio", "emailuser_enabled" ); ?></li>
912 <li><?php aField( $conf, "Emailuser", "Disabled", "radio", "emailuser_disabled" ); ?></li>
915 <p class="config-desc">
916 Use this to disable only the user-to-user e-mail function (EmailUser).
918 <div class="config-input">
919 <label class='column
'>E-mail notification:</label>
921 <li><?php aField( $conf, "Enotif", "Disabled", "radio", "enotif_disabled" ); ?></li>
922 <li><?php aField( $conf, "Enotif", "Enabled for user_talk changes only", "radio", "enotif_usertalk" ); ?></li>
923 <li><?php aField( $conf, "Enotif", "Enabled for user_talk and watch list changes (not recommended for large wikis)", "radio", "enotif_allpages" ); ?></li>
926 <div class="config-desc">
928 E-mail notification sends a notification e-mail to a user, when the user_talk page is changed
929 and/or when watch-listed pages are changed, depending on the above settings.
930 When testing this feature, be reminded, that obviously an e-mail address must be present in your preferences
931 and that your own changes never trigger notifications to be sent to yourself.</p>
933 <p>Users get corresponding options to select or deselect in their users' preferences
.
934 The user options are not shown on the preference page
, if e
-mail notification is disabled
.</p
>
936 <p
>There are additional options
for fine tuning in
/includes
/DefaultSettings
.php
.</p
>
939 <div
class="config-input">
940 <label
class='column'>E
-mail authentication
:</label
>
942 <li
><?php
aField( $conf, "Eauthent", "Disabled", "radio", "eauthent_disabled" ); ?
></li
>
943 <li
><?php
aField( $conf, "Eauthent", "Enabled", "radio", "eauthent_enabled" ); ?
></li
>
946 <div
class="config-desc">
947 <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
948 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
>
950 <p
>The e
-mail address stays authenticated
as long
as the user does not change it
; the time of authentication is indicated
951 on the user preference page
.</p
>
953 <p
>If the option is enabled
, only authenticated e
-mail addresses can receive EmailUser mails
and/or
954 e
-mail notification mails
.</p
>
959 <h2
>Database config
</h2
>
961 <div
class="config-section">
962 <div
class="config-input">
963 <label
class='column'>Database type
:</label
>
965 <li
><?php
aField( $conf, "DBtype", "MySQL", "radio", "mysql"); ?
></li
>
966 <li
><?php
aField( $conf, "DBtype", "Oracle (experimental)", "radio", "oracle" ); ?
></li
>
970 <div
class="config-input" style
="clear:left"><?php
971 aField( $conf, "DBserver", "SQL server host:" );
973 <p
class="config-desc">
974 If your database server isn
't on your web server, enter the name
975 or IP address here. MySQL only.
978 <div class="config-input"><?php
979 aField( $conf, "DBname", "Database name:" );
981 <div class="config-desc">
982 If using Oracle, set this to your connection identifier.
984 <div class="config-input"><?php
985 aField( $conf, "DBuser", "DB username:" );
987 <div class="config-input"><?php
988 aField( $conf, "DBpassword", "DB password:", "password" );
990 <div class="config-input"><?php
991 aField( $conf, "DBpassword2", "DB password confirm:", "password" );
993 <p class="config-desc">
994 If you only have a single user account and database available,
995 enter those here. If you have database root access (see below)
996 you can specify new accounts/databases to be created.
999 This account will not be created if it pre-exists. If this is the case, ensure that it
1000 has SELECT, INSERT, UPDATE and DELETE permissions on the MediaWiki database.
1003 <div class="config-input"><?php
1004 aField( $conf, "DBprefix", "Database table prefix:" );
1006 <div class="config-desc">
1007 <p>If you need to share one database between multiple wikis, or
1008 MediaWiki and another web application, you may choose to
1009 add a prefix to all the table names to avoid conflicts.</p>
1011 <p>Avoid exotic characters; something like <tt>mw_</tt> is good.</p>
1014 <div class="config-input"><label class="column">Database charset</label>
1015 <div>Select one:</div>
1017 <li><?php aField( $conf, "DBmysql5", "Backwards-compatible UTF-8", "radio", "false" ); ?></li>
1018 <li><?php aField( $conf, "DBmysql5", "Experimental MySQL 4.1/5.0 UTF-8", "radio", "true" ); ?></li>
1021 <p class="config-desc">
1022 <b>EXPERIMENTAL:</b> You can enable explicit Unicode charset support
1023 for MySQL 4.1 and 5.0 servers. This is not well tested and may
1024 cause things to break. <b>If upgrading an older installation, leave
1025 in backwards-compatible mode.</b>
1028 <div class="config-input">
1030 aField( $conf, "RootUser", "Superuser account:", "superuser" );
1033 <div class="config-input">
1035 aField( $conf, "RootPW", "Superuser password:", "password" );
1039 <p class="config-desc">
1040 If the database user specified above does not exist, or does not have access to create
1041 the database (if needed) or tables within it, please provide details of a superuser account,
1042 such as <strong>root</strong>, which does. Leave the password set to <strong>-</strong> if this is not needed.
1045 <div class="config-input" style="padding:2em 0 3em">
1046 <label class='column
'> </label>
1047 <input type="submit" value="Install MediaWiki!" class="btn-install" />
1057 /* -------------------------------------------------------------------------------------- */
1058 function writeSuccessMessage() {
1059 if ( ini_get( 'safe_mode
' ) && !ini_get( 'open_basedir
' ) ) {
1061 <p>Installation successful!</p>
1062 <p>To complete the installation, please do the following:
1064 <li>Download config/LocalSettings.php with your FTP client or file manager</li>
1065 <li>Upload it to the parent directory</li>
1066 <li>Delete config/LocalSettings.php</li>
1067 <li>Start using <a href='../index
.php
'>your wiki</a>!
1069 <p>If you are in a shared hosting environment, do <strong>not</strong> just move LocalSettings.php
1070 remotely. LocalSettings.php is currently owned by the user your webserver is running under,
1071 which means that anyone on the same server can read your database password! Downloading
1072 it and uploading it again will hopefully change the ownership to a user ID specific to you.</p>
1075 echo "<p>Installation successful! Move the config/LocalSettings.php file into the parent directory, then follow
1076 <a href='../index
.php
'>this link</a> to your wiki.</p>\n";
1081 function escapePhpString( $string ) {
1082 return strtr( $string,
1093 function writeLocalSettings( $conf ) {
1094 $conf->UseImageResize = $conf->UseImageResize ? 'true' : 'false';
1095 $conf->PasswordSender = $conf->EmergencyContact;
1096 $zlib = ($conf->zlib ? "" : "# ");
1097 $magic = ($conf->ImageMagick ? "" : "# ");
1098 $convert = ($conf->ImageMagick ? $conf->ImageMagick : "/usr/bin/convert" );
1099 $pretty = ($conf->prettyURLs ? "" : "# ");
1100 $ugly = ($conf->prettyURLs ? "# " : "");
1101 $rights = ($conf->RightsUrl) ? "" : "# ";
1102 $hashedUploads = $conf->safeMode ? '' : '# ';
1104 switch ( $conf->Shm
) {
1106 $cacheType = 'CACHE_MEMCACHED';
1107 $mcservers = var_export( $conf->MCServerArray
, true );
1111 $cacheType = 'CACHE_ACCEL';
1112 $mcservers = 'array()';
1115 $cacheType = 'CACHE_NONE';
1116 $mcservers = 'array()';
1119 if ( $conf->Email
== 'email_enabled' ) {
1120 $enableemail = 'true';
1121 $enableuseremail = ( $conf->Emailuser
== 'emailuser_enabled' ) ?
'true' : 'false' ;
1122 $eauthent = ( $conf->Eauthent
== 'eauthent_enabled' ) ?
'true' : 'false' ;
1123 switch ( $conf->Enotif
) {
1124 case 'enotif_usertalk':
1125 $enotifusertalk = 'true';
1126 $enotifwatchlist = 'false';
1128 case 'enotif_allpages':
1129 $enotifusertalk = 'true';
1130 $enotifwatchlist = 'true';
1133 $enotifusertalk = 'false';
1134 $enotifwatchlist = 'false';
1137 $enableuseremail = 'false';
1138 $enableemail = 'false';
1139 $eauthent = 'false';
1140 $enotifusertalk = 'false';
1141 $enotifwatchlist = 'false';
1144 $file = @fopen
( "/dev/urandom", "r" );
1146 $secretKey = bin2hex( fread( $file, 32 ) );
1150 for ( $i=0; $i<8; $i++
) {
1151 $secretKey .= dechex(mt_rand(0, 0x7fffffff));
1153 print "<li>Warning: \$wgSecretKey key is insecure, generated with mt_rand(). Consider changing it manually.</li>\n";
1156 # Add slashes to strings for double quoting
1157 $slconf = array_map( "escapePhpString", get_object_vars( $conf ) );
1158 if( $conf->License
== 'gfdl' ) {
1159 # Needs literal string interpolation for the current style path
1160 $slconf['RightsIcon'] = $conf->RightsIcon
;
1163 $sep = PATH_SEPARATOR
;
1165 # This file was automatically generated by the MediaWiki installer.
1166 # If you make manual changes, please keep track in case you need to
1167 # recreate them later.
1169 # See includes/DefaultSettings.php for all configurable settings
1170 # and their default values, but don't forget to make changes in _this_
1173 # If you customize your file layout, set \$IP to the directory that contains
1174 # the other MediaWiki files. It will be used as a base to locate files.
1175 if( defined( 'MW_INSTALL_PATH' ) ) {
1176 \$IP = MW_INSTALL_PATH;
1178 \$IP = dirname( __FILE__ );
1181 \$path = array( \$IP, \"\$IP/includes\", \"\$IP/languages\" );
1182 set_include_path( implode( PATH_SEPARATOR, \$path ) );
1184 require_once( \"includes/DefaultSettings.php\" );
1186 # If PHP's memory limit is very low, some operations may fail.
1187 " . ($conf->raiseMemory ?
'' : '# ' ) . "ini_set( 'memory_limit', '20M' );" . "
1189 if ( \$wgCommandLineMode ) {
1190 if ( isset( \$_SERVER ) && array_key_exists( 'REQUEST_METHOD', \$_SERVER ) ) {
1191 die( \"This script must be run from the command line\\n\" );
1193 } elseif ( empty( \$wgNoOutputBuffer ) ) {
1194 ## Compress output if the browser supports it
1195 {$zlib}if( !ini_get( 'zlib.output_compression' ) ) @ob_start( 'ob_gzhandler' );
1198 \$wgSitename = \"{$slconf['Sitename']}\";
1200 \$wgScriptPath = \"{$slconf['ScriptPath']}\";
1201 \$wgScript = \"\$wgScriptPath/index.php\";
1202 \$wgRedirectScript = \"\$wgScriptPath/redirect.php\";
1204 ## For more information on customizing the URLs please see:
1205 ## http://meta.wikimedia.org/wiki/Eliminating_index.php_from_the_url
1206 ## If using PHP as a CGI module, the ?title= style usually must be used.
1207 {$pretty}\$wgArticlePath = \"\$wgScript/\$1\";
1208 {$ugly}\$wgArticlePath = \"\$wgScript?title=\$1\";
1210 \$wgStylePath = \"\$wgScriptPath/skins\";
1211 \$wgStyleDirectory = \"\$IP/skins\";
1212 \$wgLogo = \"\$wgStylePath/common/images/wiki.png\";
1214 \$wgUploadPath = \"\$wgScriptPath/images\";
1215 \$wgUploadDirectory = \"\$IP/images\";
1217 \$wgEnableEmail = $enableemail;
1218 \$wgEnableUserEmail = $enableuseremail;
1220 \$wgEmergencyContact = \"{$slconf['EmergencyContact']}\";
1221 \$wgPasswordSender = \"{$slconf['PasswordSender']}\";
1223 ## For a detailed description of the following switches see
1224 ## http://meta.wikimedia.org/Enotif and http://meta.wikimedia.org/Eauthent
1225 ## There are many more options for fine tuning available see
1226 ## /includes/DefaultSettings.php
1227 ## UPO means: this is also a user preference option
1228 \$wgEnotifUserTalk = $enotifusertalk; # UPO
1229 \$wgEnotifWatchlist = $enotifwatchlist; # UPO
1230 \$wgEmailAuthentication = $eauthent;
1232 \$wgDBserver = \"{$slconf['DBserver']}\";
1233 \$wgDBname = \"{$slconf['DBname']}\";
1234 \$wgDBuser = \"{$slconf['DBuser']}\";
1235 \$wgDBpassword = \"{$slconf['DBpassword']}\";
1236 \$wgDBprefix = \"{$slconf['DBprefix']}\";
1237 \$wgDBtype = \"{$slconf['DBtype']}\";
1239 # Experimental charset support for MySQL 4.1/5.0.
1240 \$wgDBmysql5 = {$conf->DBmysql5};
1242 ## Shared memory settings
1243 \$wgMainCacheType = $cacheType;
1244 \$wgMemCachedServers = $mcservers;
1246 ## To enable image uploads, make sure the 'images' directory
1247 ## is writable, then set this to true:
1248 \$wgEnableUploads = false;
1249 \$wgUseImageResize = {$conf->UseImageResize};
1250 {$magic}\$wgUseImageMagick = true;
1251 {$magic}\$wgImageMagickConvertCommand = \"{$convert}\";
1253 ## If you want to use image uploads under safe mode,
1254 ## create the directories images/archive, images/thumb and
1255 ## images/temp, and make them all writable. Then uncomment
1256 ## this, if it's not already uncommented:
1257 {$hashedUploads}\$wgHashedUploadDirectory = false;
1259 ## If you have the appropriate support software installed
1260 ## you can enable inline LaTeX equations:
1262 \$wgMathPath = \"{\$wgUploadPath}/math\";
1263 \$wgMathDirectory = \"{\$wgUploadDirectory}/math\";
1264 \$wgTmpDirectory = \"{\$wgUploadDirectory}/tmp\";
1266 \$wgLocalInterwiki = \$wgSitename;
1268 \$wgLanguageCode = \"{$slconf['LanguageCode']}\";
1270 \$wgProxyKey = \"$secretKey\";
1272 ## Default skin: you can change the default skin. Use the internal symbolic
1273 ## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook':
1274 \$wgDefaultSkin = 'monobook';
1276 ## For attaching licensing metadata to pages, and displaying an
1277 ## appropriate copyright notice / icon. GNU Free Documentation
1278 ## License and Creative Commons licenses are supported so far.
1279 {$rights}\$wgEnableCreativeCommonsRdf = true;
1280 \$wgRightsPage = \"\"; # Set to the title of a wiki page that describes your license/copyright
1281 \$wgRightsUrl = \"{$slconf['RightsUrl']}\";
1282 \$wgRightsText = \"{$slconf['RightsText']}\";
1283 \$wgRightsIcon = \"{$slconf['RightsIcon']}\";
1284 # \$wgRightsCode = \"{$slconf['RightsCode']}\"; # Not yet used
1286 \$wgDiff3 = \"{$slconf['diff3']}\";
1288 # When you make changes to this configuration file, this will make
1289 # sure that cached pages are cleared.
1290 \$configdate = gmdate( 'YmdHis', @filemtime( __FILE__ ) );
1291 \$wgCacheEpoch = max( \$wgCacheEpoch, \$configdate );
1293 // Keep things in Unix line endings internally;
1294 // the system will write out as local text type.
1295 return str_replace( "\r\n", "\n", $localsettings );
1298 function dieout( $text ) {
1299 die( $text . "\n\n</body>\n</html>" );
1302 function importVar( &$var, $name, $default = "" ) {
1303 if( isset( $var[$name] ) ) {
1304 $retval = $var[$name];
1305 if ( get_magic_quotes_gpc() ) {
1306 $retval = stripslashes( $retval );
1314 function importPost( $name, $default = "" ) {
1315 return importVar( $_POST, $name, $default );
1318 function importRequest( $name, $default = "" ) {
1319 return importVar( $_REQUEST, $name, $default );
1324 function aField( &$conf, $field, $text, $type = "text", $value = "" ) {
1327 $xtype = "type=\"$type\"";
1332 if(!(isset($id)) or ($id == "") ) $id = $field;
1333 $nolabel = ($type == "radio") ||
($type == "hidden");
1335 if ($type == 'radio')
1336 $id .= $radioCount++
;
1341 echo "\t\t<label class='column' for=\"$id\">$text</label>\n";
1344 if( $type == "radio" && $value == $conf->$field ) {
1345 $checked = "checked='checked'";
1349 echo "\t\t<input $xtype name=\"$field\" id=\"$id\" class=\"iput-$type\" $checked value=\"";
1350 if( $type == "radio" ) {
1351 echo htmlspecialchars( $value );
1353 echo htmlspecialchars( $conf->$field );
1357 echo " $text</label>\n";
1361 if(isset($errs[$field])) echo "<span class='error'>" . $errs[$field] . "</span>\n";
1364 function getLanguageList() {
1365 global $wgLanguageNames;
1366 if( !isset( $wgLanguageNames ) ) {
1367 $wgContLanguageCode = "xxx";
1368 function wfLocalUrl( $x ) { return $x; }
1369 function wfLocalUrlE( $x ) { return $x; }
1370 require_once( "languages/Names.php" );
1375 $d = opendir( "../languages" );
1376 while( false !== ($f = readdir( $d ) ) ) {
1378 if( preg_match( '/Language([A-Z][a-z_]+)\.php$/', $f, $m ) ) {
1379 $code = str_replace( '_', '-', strtolower( $m[1] ) );
1380 if( isset( $wgLanguageNames[$code] ) ) {
1381 $name = $code . ' - ' . $wgLanguageNames[$code];
1385 $codes[$code] = $name;
1393 #Check for location of an executable
1394 # @param string $loc single location to check
1395 # @param array $names filenames to check for.
1396 # @param mixed $versioninfo array of details to use when checking version, use false for no version checking
1397 function locate_executable($loc, $names, $versioninfo = false) {
1398 if (!is_array($names))
1399 $names = array($names);
1401 foreach ($names as $name) {
1402 $command = "$loc".DIRECTORY_SEPARATOR
."$name";
1403 if (file_exists($command)) {
1407 $file = str_replace('$1', $command, $versioninfo[0]);
1408 if (strstr(`
$file`
, $versioninfo[1]) !== false)
1415 function get_db_version() {
1416 global $wgDatabase, $conf;
1417 if ($conf->DBtype
== 'mysql')
1418 return mysql_get_server_info( $wgDatabase->mConn
);
1419 else if ($conf->DBtype
== 'oracle')
1420 return oci_server_version($wgDatabase->mConn
);
1423 # Test a memcached server
1424 function testMemcachedServer( $server ) {
1425 $hostport = explode(":", $server);
1428 if ( !function_exists( 'fsockopen' ) ) {
1429 $errstr = "Can't connect to memcached, fsockopen() not present";
1431 if ( !$errstr && count( $hostport ) != 2 ) {
1432 $errstr = 'Please specify host and port';
1433 var_dump( $hostport );
1436 list( $host, $port ) = $hostport;
1440 $fp = @fsockopen
( $host, $port, $errno, $fsockerr, 1.0 );
1441 if ( $fp === false ) {
1442 $errstr = "Cannot connect to memcached on $host:$port : $fsockerr";
1446 $command = "version\r\n";
1447 $bytes = fwrite( $fp, $command );
1448 if ( $bytes != strlen( $command ) ) {
1449 $errstr = "Cannot write to memcached socket on $host:$port";
1453 $expected = "VERSION ";
1454 $response = fread( $fp, strlen( $expected ) );
1455 if ( $response != $expected ) {
1456 $errstr = "Didn't get correct memcached response from $host:$port";
1463 echo "<li>Connected to memcached on $host:$port successfully";
1469 <div
class="license">
1471 <p
>This program is free software
; you can redistribute it
and/or modify
1472 it under the terms of the GNU General
Public License
as published by
1473 the Free Software Foundation
; either version
2 of the License
, or
1474 (at your option
) any later version
.</p
>
1476 <p
>This program is distributed in the hope that it will be useful
,
1477 but WITHOUT ANY WARRANTY
; without even the implied warranty of
1478 MERCHANTABILITY
or FITNESS
FOR A PARTICULAR PURPOSE
. See the
1479 GNU General
Public License
for more details
.</p
>
1481 <p
>You should have received
<a href
="../COPYING">a copy of the GNU General
Public License
</a
>
1482 along with this program
; if not
, write to the Free Software
1483 Foundation
, Inc
., 59 Temple Place
- Suite
330, Boston
, MA
02111-1307, USA
.
1484 or <a href
="http://www.gnu.org/copyleft/gpl.html">read it online
</a
></p
>
1490 <div id
="column-one">
1491 <div
class="portlet" id
="p-logo">
1492 <a style
="background-image: url(../skins/common/images/mediawiki.png);"
1493 href
="http://www.mediawiki.org/"
1494 title
="Main Page"></a
>
1496 <script type
="text/javascript"> if (window
.isMSIE55
) fixalpha(); </script
>
1497 <div
class='portlet'><div
class='pBody'>
1499 <li
><strong
><a href
="http://www.mediawiki.org/">MediaWiki home
</a
></strong
></li
>
1500 <li
><a href
="../README">Readme
</a
></li
>
1501 <li
><a href
="../RELEASE-NOTES">Release notes
</a
></li
>
1502 <li
><a href
="../docs/">Documentation
</a
></li
>
1503 <li
><a href
="http://meta.wikipedia.org/wiki/MediaWiki_User's_Guide">User
's Guide</a></li>
1504 <li><a href="http://meta.wikimedia.org/wiki/MediaWiki_FAQ">FAQ</a></li>
1506 <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>