2 # MediaWiki web-based config/installation
3 # Copyright (C) 2004 Brion Vibber <brion@pobox.com>
4 # http://www.mediawiki.org/
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with this program; if not, write to the Free Software Foundation, Inc.,
18 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 # http://www.gnu.org/copyleft/gpl.html
21 header( "Content-type: text/html; charset=utf-8" );
23 ?
><!DOCTYPE HTML
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
24 "http://www.w3.org/TR/html4/loose.dtd">
27 <meta http
-equiv
="Content-type" content
="text/html; charset=utf-8">
28 <meta name
="robots" content
="noindex,nofollow">
29 <title
>MediaWiki installation
</title
>
30 <style type
="text/css">
35 background
-color
: #eee;
37 border
: solid
1px
#444;
45 dl
.setup dd label
.column
{
57 /* margin-right: 200px; */
75 <a href
="http://www.mediawiki.org/"><img
76 src
="../images/wiki.png" width
="135" height
="135" alt
="" border
="0" /></a
>
79 <b
><a href
="http://www.mediawiki.org/">MediaWiki
</a
></b
> is
80 Copyright (C
) 2001-2004 by Magnus Manske
, Brion Vibber
, Lee Daniel Crocker
,
81 Tim Starling
, Erik M
ö
;ller
, and others
.</p
>
84 <li
><a href
="../README">Readme
</a
></li
>
85 <li
><a href
="../RELEASE-NOTES">Release notes
</a
></li
>
86 <li
><a href
="../docs/">doc
/</a
></li
>
87 <li
><a href
="http://meta.wikipedia.org/wiki/MediaWiki_User's_Guide">User
's Guide</a></li>
90 <p>This program is free software; you can redistribute it and/or modify
91 it under the terms of the GNU General Public License as published by
92 the Free Software Foundation; either version 2 of the License, or
93 (at your option) any later version.</p>
95 <p>This program is distributed in the hope that it will be useful,
96 but WITHOUT ANY WARRANTY; without even the implied warranty of
97 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
98 GNU General Public License for more details.</p>
100 <p>You should have received <a href="../COPYING">a copy of the GNU General Public License</a>
101 along with this program; if not, write to the Free Software
102 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
103 or <a href="http://www.gnu.org/copyleft/gpl.html">read it online</a></p>
108 $IP = ".."; # Just to suppress notices, not for anything useful
109 include( "../includes/DefaultSettings.php" );
112 <h1>MediaWiki <?php print $wgVersion ?> installation</h1>
117 /* Check for existing configurations and bug out! */
119 if( file_exists( "../LocalSettings.php" ) || file_exists( "../AdminSettings.php" ) ) {
120 dieout( "<h2>Wiki is configured.</h2>
122 <p>Already configured... <a href='../index
.php
'>return to the wiki</a>.</p>
124 <p>(You should probably remove this directory for added security.)</p>" );
127 if( file_exists( "./LocalSettings.php" ) || file_exists( "./AdminSettings.php" ) ) {
128 dieout( "<h2>You're configured
!</h2
>
130 <p
>Please move
<tt
>LocalSettings
.php
</tt
> to the parent directory
, then
131 <a href
='../index.php'>try out your wiki
</a
>.
132 (You should remove this config directory
for added security once you
're done.)</p>" );
135 if( !is_writable( "." ) ) {
136 dieout( "<h2>Can't write config file
, aborting
</h2
>
138 <p
>In order to configure the wiki you have to make the
<tt
>config
</tt
> subdirectory
139 writable by the web server
. Once configuration is done you
'll move the created
140 <tt>LocalSettings.php</tt> to the parent directory, and for added safety you can
141 then remove the <tt>config</tt> subdirectory entirely.</p>
143 <p>To make the directory writable on a Unix/Linux system:</p>
146 cd <i>/path/to/wiki</i>
152 include( "../install-utils.inc" );
153 include( "../maintenance/updaters.inc" );
155 function getEncoded( $data ) {
157 global $wgInputEncoding;
158 if( strcasecmp( $wgInputEncoding, "utf-8" ) == 0 ) {
161 return utf8_decode( $data ); /* to latin1 wikis */
164 function getSitename() { return $this->getEncoded( $this->Sitename ); }
165 function getSysopName() { return $this->getEncoded( $this->SysopName ); }
166 function getSysopPass() { return $this->getEncoded( $this->SysopPass ); }
171 <p><i>Please include all of the lines below when reporting installation problems.</i></p>
173 <h2>Checking environment...</h2>
178 $conf = new ConfigData;
180 install_version_checks();
181 print "<li>PHP " . phpversion() . " ok</li>\n";
183 $sapi = php_sapi_name();
184 $conf->prettyURLs = true;
185 print "<li>PHP server API is $sapi; ";
188 case "apache2handler":
189 print "ok, using pretty URLs (<tt>index.php/Page_Title</tt>)";
193 case "apache2filter":
194 print "using ugly URLs (<tt>index.php?title=Page_Title</tt>)";
195 $conf->prettyURLs = false;
198 print "unknown; using pretty URLs (<tt>index.php/Page_Title</tt>), if you have trouble change this in <tt>LocalSettings.php</tt>";
202 $conf->zlib = function_exists( "gzencode" );
204 print "<li>Have zlib support; enabling output compression.</li>\n";
206 print "<li>No zlib support.</li>\n";
209 $conf->ImageMagick = false;
211 $conf->HaveGD = function_exists( "imagejpeg" );
212 if( $conf->HaveGD ) {
213 print "<li>Found GD graphics library built-in, image thumbnailing will be enabled if you enable uploads.</li>\n";
215 $imcheck = array( "/usr/bin", "/usr/local/bin", "/sw/bin" );
216 foreach( $imcheck as $dir ) {
217 $im = "$dir/convert";
218 if( file_exists( $im ) ) {
219 print "<li>Found ImageMagick: <tt>$im</tt>; image thumbnailing will be enabled if you enable uploads.</li>\n";
220 $conf->ImageMagick = $im;
224 if( !$conf->ImageMagick ) {
225 print "<li>Couldn't find GD library
or ImageMagick
; image thumbnailing disabled
.</li
>\n";
229 $conf->UseImageResize = $conf->HaveGD || $conf->ImageMagick;
231 # $conf->IP = "/Users
/brion
/Sites
/inplace
";
233 $conf->IP = getcwd();
234 $conf->IP = preg_replace( "/\\\\/","\\\\\\\\
",$conf->IP ); // For Windows, \ -> \\
236 print "<li
>Installation directory
: <tt
>" . htmlspecialchars( $conf->IP ) . "</tt
></li
>\n";
238 # $conf->ScriptPath = "/~brion
/inplace
";
239 $conf->ScriptPath = preg_replace( '{^(.*)/config.*$}', '$1', $_SERVER["REQUEST_URI
"] );
240 print "<li
>Script URI path
: <tt
>" . htmlspecialchars( $conf->ScriptPath ) . "</tt
></li
>\n";
242 $conf->posted = ($_SERVER["REQUEST_METHOD
"] == "POST
");
244 $conf->Sitename = ucfirst( importPost( "Sitename
", "" ) );
245 $conf->EmergencyContact = importPost( "EmergencyContact
", $_SERVER["SERVER_ADMIN
"] );
246 $conf->DBserver = importPost( "DBserver
", "localhost
" );
247 $conf->DBname = importPost( "DBname
", "wikidb
" );
248 $conf->DBuser = importPost( "DBuser
", "wikiuser
" );
249 $conf->DBpassword = importPost( "DBpassword
" );
250 $conf->DBpassword2 = importPost( "DBpassword2
" );
251 $conf->RootPW = importPost( "RootPW
" );
252 $conf->LanguageCode = importPost( "LanguageCode
", "en
-utf8
" );
253 $conf->SysopName = importPost( "SysopName
", "WikiSysop
" );
254 $conf->SysopPass = importPost( "SysopPass
" );
255 $conf->SysopPass2 = importPost( "SysopPass2
" );
257 /* Check for validity */
260 if( $conf->Sitename == "" || $conf->Sitename == "MediaWiki
" || $conf->Sitename == "Mediawiki
" ) {
261 $errs["Sitename
"] = "Must not be blank
or \"MediaWiki\"
.";
263 if( $conf->DBpassword == "" ) {
264 $errs["DBpassword
"] = "Must not be blank
";
266 if( $conf->DBpassword != $conf->DBpassword2 ) {
267 $errs["DBpassword2
"] = "Passwords don
't match!";
270 if( $conf->SysopPass == "" ) {
271 $errs["SysopPass"] = "Must not be blank";
273 if( $conf->SysopPass != $conf->SysopPass2 ) {
274 $errs["SysopPass2"] = "Passwords don't match
!";
277 $conf->License = importPost( "License
", "none
" );
278 if( $conf->License == "gfdl
" ) {
279 $conf->RightsUrl = "http
://www.gnu.org/copyleft/fdl.html";
280 $conf->RightsText
= "GNU Free Documentation License 1.2";
281 $conf->RightsCode
= "gfdl";
282 $conf->RightsIcon
= "{$conf->ScriptPath}/images/gnu-fdl.png";
283 } elseif( $conf->License
== "none" ) {
284 $conf->RightsUrl
= $conf->RightsText
= $conf->RightsCode
= $conf->RightsIcon
= "";
286 $conf->RightsUrl
= importPost( "RightsUrl", "" );
287 $conf->RightsText
= importPost( "RightsText", "" );
288 $conf->RightsCode
= importPost( "RightsCode", "" );
289 $conf->RightsIcon
= importPost( "RightsIcon", "" );
292 if( $conf->posted
&& ( 0 == count( $errs ) ) ) {
293 do { /* So we can 'continue' to end prematurely */
294 $conf->Root
= ($conf->RootPW
!= "");
296 /* Load up the settings and get installin' */
297 $local = writeLocalSettings( $conf );
298 $wgCommandLineMode = false;
301 $wgDBadminuser = $wgDBuser;
302 $wgDBadminpassword = $wgDBpassword;
303 $wgCommandLineMode = true;
304 $wgUseDatabaseMessages = false; /* FIXME: For database failure */
305 include_once( "Setup.php" );
306 include_once( "../maintenance/InitialiseMessages.inc" );
308 $wgTitle = Title
::newFromText( "Installation script" );
309 $wgDatabase = Database
::newFromParams( $wgDBserver, "root", $conf->RootPW
, "", 1 );
310 $wgDatabase->mIgnoreErrors
= true;
312 @$myver = mysql_get_server_info( $wgDatabase->mConn
);
315 print "<li>Connected as root (automatic)</li>\n";
317 print "<li>MySQL error " . ($err = mysql_errno() ) .
318 ": " . htmlspecialchars( mysql_error() );
323 $errs["RootPW"] = "Check password";
325 print "<li>Trying regular user...\n";
326 /* Try the regular user... */
327 $wgDatabase = Database
::newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, "", 1 );
328 $wgDatabase->isOpen();
329 $wgDatabase->mIgnoreErrors
= true;
330 @$myver = mysql_get_server_info( $wgDatabase->mConn
);
332 $errs["DBuser"] = "Check name/pass";
333 $errs["DBpassword"] = "or enter root";
334 $errs["DBpassword2"] = "password below";
335 $errs["RootPW"] = "Got root?";
336 print " need password.</li>\n";
348 $errs["DBserver"] = "Connection failed";
351 $errs["DBserver"] = "Couldn't connect to database";
357 if ( !$wgDatabase->isOpen() ) {
358 $errs["DBserver"] = "Couldn't connect to database";
362 print "<li>Connected to database... $myver";
363 if( version_compare( $myver, "4.0.0" ) >= 0 ) {
364 print "; enabling MySQL 4 enhancements";
365 $conf->DBmysql4
= true;
366 $local = writeLocalSettings( $conf );
370 @$sel = mysql_select_db( $wgDBname, $wgDatabase->mConn
);
372 print "<li>Database <tt>" . htmlspecialchars( $wgDBname ) . "</tt> exists</li>\n";
374 $res = $wgDatabase->query( "CREATE DATABASE `$wgDBname`" );
376 print "<li>Couldn't create database <tt>" .
377 htmlspecialchars( $wgDBname ) .
378 "</tt>; try with root access or check your username/pass.</li>\n";
379 $errs["RootPW"] = "<- Enter";
382 print "<li>Created database <tt>" . htmlspecialchars( $wgDBname ) . "</tt></li>\n";
385 $wgDatabase->selectDB( $wgDBname );
387 if( $wgDatabase->tableExists( "cur" ) ) {
388 print "<li>There are already MediaWiki tables in this database. Checking if updates are needed...</li>\n<pre>";
392 do_ipblocks_update(); flush();
393 do_interwiki_update(); flush();
394 do_index_update(); flush();
395 do_linkscc_update(); flush();
396 do_hitcounter_update(); flush();
397 do_recentchanges_update(); flush();
398 initialiseMessages(); flush();
402 print "<li>Finished update checks.</li>\n";
404 # FIXME: Check for errors
405 print "<li>Creating tables...";
406 dbsource( "../maintenance/tables.sql", $wgDatabase );
407 dbsource( "../maintenance/interwiki.sql", $wgDatabase );
408 dbsource( "../maintenance/indexes.sql", $wgDatabase );
409 print " done.</li>\n";
411 print "<li>Initializing data...";
412 $wgDatabase->query( "INSERT INTO site_stats (ss_row_id,ss_total_views," .
413 "ss_total_edits,ss_good_articles) VALUES (1,0,0,0)" );
415 if( $conf->SysopName
) {
416 $u = User
::newFromName( $conf->getSysopName() );
417 if ( 0 == $u->idForName() ) {
419 $u->setPassword( $conf->getSysopPass() );
420 $u->addRight( "sysop" );
421 $u->addRight( "bureaucrat" );
423 print "<li>Created sysop account <tt>" .
424 htmlspecialchars( $conf->SysopName
) . "</tt>.</li>\n";
426 print "<li>Could not create user - already exists!</li>\n";
429 print "<li>Skipped sysop account creation, no name given.</li>\n";
432 print "<li>Initialising log pages...";
434 "uploadlogpage" => "uploadlogpagetext",
435 "dellogpage" => "dellogpagetext",
436 "protectlogpage" => "protectlogtext",
437 "blocklogpage" => "blocklogtext"
439 $metaNamespace = Namespace::getWikipedia();
440 $now = wfTimestampNow();
441 $won = wfInvertTimestamp( $now );
442 foreach( $logs as $page => $text ) {
443 $logTitle = wfStrencode( $wgLang->ucfirst( str_replace( " ", "_", wfMsgNoDB( $page ) ) ) );
444 $logText = wfStrencode( wfMsgNoDB( $text ) );
445 $wgDatabase->query( "INSERT INTO cur (cur_namespace,cur_title,cur_text," .
446 "cur_restrictions,cur_timestamp,inverse_timestamp,cur_touched) " .
447 "VALUES ($metaNamespace,'$logTitle','$logText','sysop','$now','$won','$now')" );
451 $titleobj = Title
::newFromText( wfMsgNoDB( "mainpage" ) );
452 $title = $titleobj->getDBkey();
453 $sql = "INSERT INTO cur (cur_namespace,cur_title,cur_text,cur_timestamp,inverse_timestamp,cur_touched) " .
454 "VALUES (0,'$title','" .
455 wfStrencode( wfMsg( "mainpagetext" ) . "\n\n" . wfMsg( "mainpagedocfooter" ) ) . "','$now','$won','$now')";
456 $wgDatabase->query( $sql, $fname );
459 initialiseMessages();
460 print "</pre></li>\n";
463 print "<li>Granting user permissions...</li>\n";
464 dbsource( "../maintenance/users.sql", $wgDatabase );
468 /* Write out the config file now that all is well */
469 print "<p>Creating LocalSettings.php...</p>\n\n";
470 $localSettings = "<" . "?php$endl$local$endl?" . ">";
472 if( version_compare( phpversion(), "4.3.2" ) >= 0 ) {
473 $xt = "xt"; # Refuse to overwrite an existing file
475 $xt = "wt"; # 'x' is not available prior to PHP 4.3.2. We did check above, but race conditions blah blah
477 $f = fopen( "LocalSettings.php", $xt );
480 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" .
481 "<p>Here's the file that would have been written, try to paste it into place manually:</p>\n" .
482 "<pre>\n" . htmlspecialchars( $localSettings ) . "</pre>\n" );
484 fwrite( $f, $localSettings );
487 print "<p>Success! Move the LocalSettings.php file into the parent directory, then follow
488 <a href='{$conf->ScriptPath}/index.php'>this link</a> to your wiki.</p>\n";
498 if( count( $errs ) ) {
499 /* Display options form */
501 if( $conf->posted
) {
502 echo "<p class='error'>Something's not quite right yet; make sure everything below is filled out correctly.</p>\n";
506 <form name
="config" method
="post">
514 aField( $conf, "Sitename", "Site name:" );
518 Your site name should be a relatively short word
. It
'll appear as the namespace
519 name for 'meta
' pages as well as throughout the user interface. Good site names
520 are things like "<a href="http://www.wikipedia.org/">Wikipedia</a>" and
521 "<a href="http://openfacts.berlios.de/">OpenFacts</a>"; avoid punctuation,
522 which may cause problems.
527 aField( $conf, "EmergencyContact", "Contact e-mail" );
531 This will be used as the return address for password reminders and
532 may be displayed in some error conditions so visitors can get in
537 <label class='column
' for="LanguageCode">Language</label>
538 <select id="LanguageCode" name="LanguageCode">
540 $list = getLanguageList();
541 foreach( $list as $code => $name ) {
542 $sel = ($code == $conf->LanguageCode) ? "selected" : "";
543 echo "\t\t<option value=\"$code\" $sel>$name</option>\n";
549 You may select the language for the user interface of the wiki...
550 Some localizations are less complete than others. This also controls
551 the character encoding; Unicode is more flexible, but Latin-1 may be
552 more compatible with older browsers for some languages. Unicode will
553 be used where not specified otherwise.
557 <label class='column
'>Copyright/license metadata</label>
558 <div>Select one:</div>
561 <li><?php aField( $conf, "License", "no license metadata", "radio", "none" ); ?></li>
562 <li><?php aField( $conf, "License", "GNU Free Documentation License 1.2 (Wikipedia-compatible)", "radio", "gfdl" ); ?></li>
564 aField( $conf, "License", "a Creative Commons license...", "radio", "cc" );
565 $partner = "MediaWiki";
566 $exit = urlencode( "$wgServer{$conf->ScriptPath}/config/index.php?License=cc&RightsUrl=[license_url]&RightsText=[license_name]&RightsCode=[license_code]&RightsIcon=[license_button]" );
567 $icon = urlencode( "$wgServer$wgUploadPath/wiki.png" );
568 $ccApp = htmlspecialchars( "http://creativecommons.org/license/?partner=$partner&exit_url=$exit&partner_icon_url=$icon" );
569 print "<a href=\"$ccApp\">choose</a>";
571 <li><?php aField( $conf, "RightsUrl", $conf->RightsUrl, "hidden" ); ?></li>
572 <li><?php aField( $conf, "RightsText", $conf->RightsText, "hidden" ); ?></li>
573 <li><?php aField( $conf, "RightsCode", $conf->RightsCode, "hidden" ); ?></li>
574 <li><?php aField( $conf, "RightsIcon", $conf->RightsIcon, "hidden" ); ?></li>
578 MediaWiki can include a basic license notice, icon, and machine-reable
579 copyright metadata if your wiki's content is to be licensed under
580 the GNU FDL
or a Creative Commons license
. If you
're not sure, leave
586 <?php aField( $conf, "SysopName", "Sysop account name:", "" ) ?>
589 <?php aField( $conf, "SysopPass", "password:", "password" ) ?>
592 <?php aField( $conf, "SysopPass2", "again:", "password" ) ?>
595 A sysop user account can lock or delete pages, block problematic IP
596 addresses from editing, and other maintenance tasks. If creating a new
597 wiki database, a sysop account will be created with the given name
602 <h2>Database config</h2>
606 aField( $conf, "DBserver", "MySQL server" );
609 If your database server isn't on your web server
, enter the name
614 aField( $conf, "DBname", "Database name" );
617 aField( $conf, "DBuser", "DB username" );
620 aField( $conf, "DBpassword", "DB password", "password" );
623 aField( $conf, "DBpassword2", "again", "password" );
626 If you only have a single user account
and database available
,
627 enter those here
. If you have database root
access (see below
)
628 you can specify
new accounts
/databases to be created
.
634 aField( $conf, "RootPW", "DB root password", "password" );
638 You will only need this
if the database
and/or user account
639 above don
't already exist.
640 Do <em>not</em> type in your machine's root password
! MySQL
641 has its own
"root" user with a separate password
. (It might
642 even be blank
, depending on your configuration
.)
646 <label
class='column'> 
;</label
>
647 <input type
="submit" value
="Install!" />
657 /* -------------------------------------------------------------------------------------- */
659 function writeAdminSettings( $conf ) {
661 \$wgDBadminuser = \"{$conf->DBadminuser}\";
662 \$wgDBadminpassword = \"{$conf->DBadminpassword}\";
666 function writeLocalSettings( $conf ) {
667 $conf->DBmysql4
= @$conf->DBmysql4 ?
'true' : 'false';
668 $conf->UseImageResize
= $conf->UseImageResize ?
'true' : 'false';
669 $conf->PasswordSender
= $conf->EmergencyContact
;
670 if( $conf->LanguageCode
== "en-utf8" ) {
671 $conf->LanguageCode
= "en";
672 $conf->Encoding
= "UTF-8";
674 $zlib = ($conf->zlib ?
"" : "# ");
675 $magic = ($conf->ImageMagick ?
"" : "# ");
676 $convert = ($conf->ImageMagick ?
$conf->ImageMagick
: "/usr/bin/convert" );
677 $pretty = ($conf->prettyURLs ?
"" : "# ");
678 $ugly = ($conf->prettyURLs ?
"# " : "");
679 $rights = ($conf->RightsUrl
) ?
"" : "# ";
681 # $proxyKey = Parser::getRandomString() . Parser::getRandomString();
683 $sep = (DIRECTORY_SEPARATOR
== "\\") ?
";" : ":";
685 # This file was automatically generated by the MediaWiki installer.
686 # If you make manual changes, please keep track in case you need to
687 # recreate them later.
689 \$IP = \"{$conf->IP}\";
690 ini_set( \"include_path\", \"\$IP/includes$sep\$IP/languages$sep\" . ini_get(\"include_path\") );
691 include_once( \"DefaultSettings.php\" );
693 if ( \$wgCommandLineMode ) {
694 if ( isset( \$_SERVER ) && array_key_exists( 'REQUEST_METHOD', \$_SERVER ) ) {
695 die( \"This script must be run from the command line\\n\" );
698 ## Compress output if the browser supports it
699 {$zlib}if( !ini_get( 'zlib.output_compression' ) ) ob_start( 'ob_gzhandler' );
702 \$wgSitename = \"{$conf->Sitename}\";
704 \$wgScriptPath = \"{$conf->ScriptPath}\";
705 \$wgScript = \"\$wgScriptPath/index.php\";
706 \$wgRedirectScript = \"\$wgScriptPath/redirect.php\";
708 ## If using PHP as a CGI module, use the ugly URLs
709 {$pretty}\$wgArticlePath = \"\$wgScript/\$1\";
710 {$ugly}\$wgArticlePath = \"\$wgScript?title=\$1\";
712 \$wgStylePath = \"\$wgScriptPath/stylesheets\";
713 \$wgStyleSheetDirectory = \"\$IP/stylesheets\";
715 \$wgUploadPath = \"\$wgScriptPath/images\";
716 \$wgUploadDirectory = \"\$IP/images\";
717 \$wgLogo = \"\$wgUploadPath/wiki.png\";
719 \$wgEmergencyContact = \"{$conf->EmergencyContact}\";
720 \$wgPasswordSender = \"{$conf->PasswordSender}\";
722 \$wgDBserver = \"{$conf->DBserver}\";
723 \$wgDBname = \"{$conf->DBname}\";
724 \$wgDBuser = \"{$conf->DBuser}\";
725 \$wgDBpassword = \"{$conf->DBpassword}\";
727 ## To allow SQL queries through the wiki's Special:Askaql page,
728 ## uncomment the next lines. THIS IS VERY INSECURE. If you want
729 ## to allow semipublic read-only SQL access for your sysops,
730 ## you should define a MySQL user with limited privileges.
731 ## See MySQL docs: http://www.mysql.com/doc/en/GRANT.html
733 # \$wgAllowSysopQueries = true;
734 # \$wgDBsqluser = \"sqluser\";
735 # \$wgDBsqlpassword = \"sqlpass\";
737 \$wgDBmysql4 = \$wgEnablePersistentLC = {$conf->DBmysql4};
739 ## To enable image uploads, make sure the 'images' directory
740 ## is writable, then uncomment this:
741 # \$wgDisableUploads = false;
742 \$wgUseImageResize = {$conf->UseImageResize};
743 {$magic}\$wgUseImageMagick = true;
744 {$magic}\$wgImageMagickConvertCommand = \"{$convert}\";
746 ## If you have the appropriate support software installed
747 ## you can enable inline LaTeX equations:
749 \$wgMathPath = \"{\$wgUploadPath}/math\";
750 \$wgMathDirectory = \"{\$wgUploadDirectory}/math\";
751 \$wgTmpDirectory = \"{\$wgUploadDirectory}/tmp\";
753 \$wgUsePHPTal = true;
754 if ( \$wgUsePHPTal ) {
755 ini_set( \"include_path\", \"\$IP/PHPTAL-NP-0.7.0/libs$sep\" . ini_get(\"include_path\") );
758 \$wgLocalInterwiki = \$wgSitename;
760 \$wgLanguageCode = \"{$conf->LanguageCode}\";
761 " . ($conf->Encoding ?
"\$wgInputEncoding = \$wgOutputEncoding = \"{$conf->Encoding}\";" : "" ) . "
763 #\$wgProxyKey = $proxyKey;
765 ## For attaching licensing metadata to pages, and displaying an
766 ## appropriate copyright notice / icon. GNU Free Documentation
767 ## License and Creative Commons licenses are supported so far.
768 {$rights}\$wgEnableCreativeCommonsRdf = true;
769 \$wgRightsPage = \"\"; # Set to the title of a wiki page that describes your license/copyright
770 \$wgRightsUrl = \"{$conf->RightsUrl}\";
771 \$wgRightsText = \"{$conf->RightsText}\";
772 \$wgRightsIcon = \"{$conf->RightsIcon}\";
773 # \$wgRightsCode = \"{$conf->RightsCode}\"; # Not yet used
777 function dieout( $text ) {
778 die( $text . "\n\n</body>\n</html>" );
781 function importPost( $name, $default = "" ) {
782 if( isset( $_REQUEST[$name] ) ) {
783 return $_REQUEST[$name];
789 function aField( &$conf, $field, $text, $type = "", $value = "" ) {
791 $xtype = "type=\"$type\"";
796 if(!(isset($id)) or ($id == "") ) $id = $field;
797 $nolabel = ($type == "radio") ||
($type == "hidden");
801 echo "\t\t<label class='column' for=\"$id\">$text</label>\n";
804 if( $type == "radio" && $value == $conf->$field ) {
805 $checked = "checked='checked'";
809 echo "\t\t<input $xtype name=\"$field\" id=\"$id\" $checked value=\"";
810 if( $type == "radio" ) {
811 echo htmlspecialchars( $value );
813 echo htmlspecialchars( $conf->$field );
817 echo " $text</label>\n";
821 if(isset($errs[$field])) echo "<span class='error'>" . $errs[$field] . "</span>\n";
824 function getLanguageList() {
825 global $wgLanguageNames;
826 if( !isset( $wgLanguageNames ) ) {
827 $wgLanguageCode = "xxx";
828 function wfLocalUrl( $x ) { return $x; }
829 function wfLocalUrlE( $x ) { return $x; }
830 include( "../languages/Language.php" );
834 $latin1 = array( "da", "de", "en", "es", "nl", "sv" );
836 $d = opendir( "../languages" );
837 while( false !== ($f = readdir( $d ) ) ) {
838 if( preg_match( '/Language([A-Z][a-z]+)\.php$/', $f, $m ) ) {
839 $code = strtolower( $m[1] );
840 $codes[$code] = "$code - " . $wgLanguageNames[$code];
841 if( in_array( $code, $latin1 ) ) {
842 $codes[$code] .= " - Latin-1";
846 $codes["en-utf8"] = "en - English - Unicode";