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 ); }
172 <h2>Checking environment...</h2>
177 $conf = new ConfigData;
179 install_version_checks();
180 print "<li>PHP " . phpversion() . " ok</li>\n";
182 $sapi = php_sapi_name();
183 $conf->prettyURLs = true;
184 print "<li>PHP server API is $sapi; ";
187 print "ok, using pretty URLs (<tt>index.php/Page_Title</tt>)";
191 print "using ugly URLs (<tt>index.php?title=Page_Title</tt>)";
192 $conf->prettyURLs = false;
195 print "unknown; using pretty URLs (<tt>index.php/Page_Title</tt>), if you have trouble change this in <tt>LocalSettings.php</tt>";
199 $conf->zlib = function_exists( "gzencode" );
201 print "<li>Have zlib support; enabling output compression.</li>\n";
203 print "<li>No zlib support.</li>\n";
206 $conf->ImageMagick = false;
208 $conf->HaveGD = function_exists( "imagejpeg" );
209 if( $conf->HaveGD ) {
210 print "<li>Found GD graphics library built-in, image thumbnailing will be enabled if you enable uploads.</li>\n";
212 $imcheck = array( "/usr/bin", "/usr/local/bin", "/sw/bin" );
213 foreach( $imcheck as $dir ) {
214 $im = "$dir/convert";
215 if( file_exists( $im ) ) {
216 print "<li>Found ImageMagick: <tt>$im</tt>; image thumbnailing will be enabled if you enable uploads.</li>\n";
217 $conf->ImageMagick = $im;
221 if( !$conf->ImageMagick ) {
222 print "<li>Couldn't find GD library
or ImageMagick
; image thumbnailing disabled
.</li
>\n";
226 $conf->UseImageResize = $conf->HaveGD || $conf->ImageMagick;
228 # $conf->IP = "/Users
/brion
/Sites
/inplace
";
230 $conf->IP = getcwd();
231 $conf->IP = preg_replace( "/\\\\/","\\\\\\\\
",$conf->IP ); // For Windows, \ -> \\
233 print "<li
>Installation directory
: <tt
>" . htmlspecialchars( $conf->IP ) . "</tt
></li
>\n";
235 # $conf->ScriptPath = "/~brion
/inplace
";
236 $conf->ScriptPath = preg_replace( '{^(.*)/config.*$}', '$1', $_SERVER["REQUEST_URI
"] );
237 print "<li
>Script URI path
: <tt
>" . htmlspecialchars( $conf->ScriptPath ) . "</tt
></li
>\n";
239 $conf->posted = ($_SERVER["REQUEST_METHOD
"] == "POST
");
241 $conf->Sitename = ucfirst( importPost( "Sitename
", "" ) );
242 $conf->EmergencyContact = importPost( "EmergencyContact
", $_SERVER["SERVER_ADMIN
"] );
243 $conf->DBserver = importPost( "DBserver
", "localhost
" );
244 $conf->DBname = importPost( "DBname
", "wikidb
" );
245 $conf->DBuser = importPost( "DBuser
", "wikiuser
" );
246 $conf->DBpassword = importPost( "DBpassword
" );
247 $conf->DBpassword2 = importPost( "DBpassword2
" );
248 $conf->RootPW = importPost( "RootPW
" );
249 $conf->LanguageCode = importPost( "LanguageCode
", "en
-utf8
" );
250 $conf->SysopName = importPost( "SysopName
", "WikiSysop
" );
251 $conf->SysopPass = importPost( "SysopPass
" );
252 $conf->SysopPass2 = importPost( "SysopPass2
" );
254 /* Check for validity */
257 if( $conf->Sitename == "" || $conf->Sitename == "MediaWiki
" || $conf->Sitename == "Mediawiki
" ) {
258 $errs["Sitename
"] = "Must not be blank
or \"MediaWiki\"
.";
260 if( $conf->DBpassword == "" ) {
261 $errs["DBpassword
"] = "Must not be blank
";
263 if( $conf->DBpassword != $conf->DBpassword2 ) {
264 $errs["DBpassword2
"] = "Passwords don
't match!";
267 if( $conf->SysopPass == "" ) {
268 $errs["SysopPass"] = "Must not be blank";
270 if( $conf->SysopPass != $conf->SysopPass2 ) {
271 $errs["SysopPass2"] = "Passwords don't match
!";
274 $conf->License = importPost( "License
", "none
" );
275 if( $conf->License == "gfdl
" ) {
276 $conf->RightsUrl = "http
://www.gnu.org/copyleft/fdl.html";
277 $conf->RightsText
= "GNU Free Documentation License 1.2";
278 $conf->RightsCode
= "gfdl";
279 $conf->RightsIcon
= "{$conf->ScriptPath}/images/gnu-fdl.png";
280 } elseif( $conf->License
== "none" ) {
281 $conf->RightsUrl
= $conf->RightsText
= $conf->RightsCode
= $conf->RightsIcon
= "";
283 $conf->RightsUrl
= importPost( "RightsUrl", "" );
284 $conf->RightsText
= importPost( "RightsText", "" );
285 $conf->RightsCode
= importPost( "RightsCode", "" );
286 $conf->RightsIcon
= importPost( "RightsIcon", "" );
289 if( $conf->posted
&& ( 0 == count( $errs ) ) ) {
290 do { /* So we can 'continue' to end prematurely */
291 $conf->Root
= ($conf->RootPW
!= "");
293 /* Load up the settings and get installin' */
294 $local = writeLocalSettings( $conf );
295 $wgCommandLineMode = false;
298 $wgDBadminuser = $wgDBuser;
299 $wgDBadminpassword = $wgDBpassword;
300 $wgCommandLineMode = true;
301 $wgUseDatabaseMessages = false; /* FIXME: For database failure */
302 include_once( "Setup.php" );
303 include_once( "../maintenance/InitialiseMessages.inc" );
305 $wgTitle = Title
::newFromText( "Installation script" );
306 $wgDatabase = Database
::newFromParams( $wgDBserver, "root", $conf->RootPW
, "", 1 );
307 $wgDatabase->mIgnoreErrors
= true;
309 @$myver = mysql_get_server_info( $wgDatabase->mConn
);
311 print "<li>MySQL error " . ($err = mysql_errno() ) .
312 ": " . htmlspecialchars( mysql_error() );
317 $errs["RootPW"] = "Check password";
319 print "<li>Trying regular user...\n";
320 /* Try the regular user... */
321 $wgDatabase = Database
::newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, "", 1 );
322 $wgDatabase->isOpen();
323 $wgDatabase->mIgnoreErrors
= true;
324 @$myver = mysql_get_server_info( $wgDatabase->mConn
);
326 $errs["DBuser"] = "Check name/pass";
327 $errs["DBpassword"] = "or enter root";
328 $errs["DBpassword2"] = "password below";
329 $errs["RootPW"] = "Got root?";
330 print " need password.</li>\n";
342 $errs["DBserver"] = "Connection failed";
345 $errs["DBserver"] = "Couldn't connect to database";
351 if ( !$wgDatabase->isOpen() ) {
352 $errs["DBserver"] = "Couldn't connect to database";
356 print "<li>Connected to database... $myver";
357 if( version_compare( $myver, "4.0.0" ) >= 0 ) {
358 print "; enabling MySQL 4 enhancements";
359 $conf->DBmysql4
= true;
360 $local = writeLocalSettings( $conf );
364 @$sel = mysql_select_db( $wgDBname, $wgDatabase->mConn
);
366 print "<li>Database <tt>" . htmlspecialchars( $wgDBname ) . "</tt> exists</li>\n";
368 $res = $wgDatabase->query( "CREATE DATABASE `$wgDBname`" );
370 print "<li>Couldn't create database <tt>" .
371 htmlspecialchars( $wgDBname ) .
372 "</tt>; try with root access or check your username/pass.</li>\n";
373 $errs["RootPW"] = "<- Enter";
376 print "<li>Created database <tt>" . htmlspecialchars( $wgDBname ) . "</tt></li>\n";
379 $wgDatabase->selectDB( $wgDBname );
381 if( $wgDatabase->tableExists( "cur" ) ) {
382 print "<li>There are already MediaWiki tables in this database. Checking if updates are needed...</li>\n<pre>";
386 do_ipblocks_update(); flush();
387 do_interwiki_update(); flush();
388 do_index_update(); flush();
389 do_linkscc_update(); flush();
390 do_hitcounter_update(); flush();
391 do_recentchanges_update(); flush();
392 initialiseMessages(); flush();
396 print "<li>Finished update checks.</li>\n";
398 # FIXME: Check for errors
399 print "<li>Creating tables...";
400 dbsource( "../maintenance/tables.sql", $wgDatabase );
401 dbsource( "../maintenance/interwiki.sql", $wgDatabase );
402 dbsource( "../maintenance/indexes.sql", $wgDatabase );
403 print " done.</li>\n";
405 print "<li>Initializing data...";
406 $wgDatabase->query( "INSERT INTO site_stats (ss_row_id,ss_total_views," .
407 "ss_total_edits,ss_good_articles) VALUES (1,0,0,0)" );
409 if( $conf->SysopName
) {
410 $u = User
::newFromName( $conf->getSysopName() );
411 if ( 0 == $u->idForName() ) {
413 $u->setPassword( $conf->getSysopPass() );
414 $u->addRight( "sysop" );
415 $u->addRight( "bureaucrat" );
417 print "<li>Created sysop account <tt>" .
418 htmlspecialchars( $conf->SysopName
) . "</tt>.</li>\n";
420 print "<li>Could not create user - already exists!</li>\n";
423 print "<li>Skipped sysop account creation, no name given.</li>\n";
426 print "<li>Initialising log pages...";
428 "uploadlogpage" => "uploadlogpagetext",
429 "dellogpage" => "dellogpagetext",
430 "protectlogpage" => "protectlogtext",
431 "blocklogpage" => "blocklogtext"
433 $metaNamespace = Namespace::getWikipedia();
434 $now = wfTimestampNow();
435 $won = wfInvertTimestamp( $now );
436 foreach( $logs as $page => $text ) {
437 $logTitle = wfStrencode( $wgLang->ucfirst( str_replace( " ", "_", wfMsgNoDB( $page ) ) ) );
438 $logText = wfStrencode( wfMsgNoDB( $text ) );
439 $wgDatabase->query( "INSERT INTO cur (cur_namespace,cur_title,cur_text," .
440 "cur_restrictions,cur_timestamp,inverse_timestamp,cur_touched) " .
441 "VALUES ($metaNamespace,'$logTitle','$logText','sysop','$now','$won','$now')" );
445 $titleobj = Title
::newFromText( wfMsgNoDB( "mainpage" ) );
446 $title = $titleobj->getDBkey();
447 $sql = "INSERT INTO cur (cur_namespace,cur_title,cur_text,cur_timestamp,inverse_timestamp,cur_touched) " .
448 "VALUES (0,'$title','" .
449 wfStrencode( wfMsg( "mainpagetext" ) ) . "','$now','$won','$now')";
450 $wgDatabase->query( $sql, $fname );
453 initialiseMessages();
454 print "</pre></li>\n";
457 # Grant user permissions
458 dbsource( "../maintenance/users.sql", $wgDatabase );
462 /* Write out the config file now that all is well */
463 print "<p>Creating LocalSettings.php...</p>\n\n";
464 $localSettings = "<" . "?php$endl$local$endl?" . ">";
466 if( version_compare( phpversion(), "4.3.2" ) >= 0 ) {
467 $xt = "xt"; # Refuse to overwrite an existing file
469 $xt = "wt"; # 'x' is not available prior to PHP 4.3.2. We did check above, but race conditions blah blah
471 $f = fopen( "LocalSettings.php", $xt );
474 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" .
475 "<p>Here's the file that would have been written, try to paste it into place manually:</p>\n" .
476 "<pre>\n" . htmlspecialchars( $localSettings ) . "</pre>\n" );
478 fwrite( $f, $localSettings );
481 print "<p>Success! Move the LocalSettings.php file into the parent directory, then follow
482 <a href='{$conf->ScriptPath}/index.php'>this link</a> to your wiki.</p>\n";
492 if( count( $errs ) ) {
493 /* Display options form */
495 if( $conf->posted
) {
496 echo "<p class='error'>Something's not quite right yet; make sure everything below is filled out correctly.</p>\n";
500 <form name
="config" method
="post">
508 aField( $conf, "Sitename", "Site name:" );
512 Your site name should be a relatively short word
. It
'll appear as the namespace
513 name for 'meta
' pages as well as throughout the user interface. Good site names
514 are things like "<a href="http://www.wikipedia.org/">Wikipedia</a>" and
515 "<a href="http://openfacts.berlios.de/">OpenFacts</a>"; avoid punctuation,
516 which may cause problems.
521 aField( $conf, "EmergencyContact", "Contact e-mail" );
525 This will be used as the return address for password reminders and
526 may be displayed in some error conditions so visitors can get in
531 <label class='column
' for="LanguageCode">Language</label>
532 <select id="LanguageCode" name="LanguageCode">
534 $list = getLanguageList();
535 foreach( $list as $code => $name ) {
536 $sel = ($code == $conf->LanguageCode) ? "selected" : "";
537 echo "\t\t<option value=\"$code\" $sel>$name</option>\n";
543 You may select the language for the user interface of the wiki...
544 Some localizations are less complete than others. This also controls
545 the character encoding; Unicode is more flexible, but Latin-1 may be
546 more compatible with older browsers for some languages. Unicode will
547 be used where not specified otherwise.
551 <label class='column
'>Copyright/license metadata</label>
552 <div>Select one:</div>
555 <li><?php aField( $conf, "License", "no license metadata", "radio", "none" ); ?></li>
556 <li><?php aField( $conf, "License", "GNU Free Documentation License 1.2 (Wikipedia-compatible)", "radio", "gfdl" ); ?></li>
558 aField( $conf, "License", "a Creative Commons license...", "radio", "cc" );
559 $partner = "MediaWiki";
560 $exit = urlencode( "$wgServer{$conf->ScriptPath}/config/index.php?License=cc&RightsUrl=[license_url]&RightsText=[license_name]&RightsCode=[license_code]&RightsIcon=[license_button]" );
561 $icon = urlencode( "$wgServer$wgUploadPath/wiki.png" );
562 $ccApp = htmlspecialchars( "http://creativecommons.org/license/?partner=$partner&exit_url=$exit&partner_icon_url=$icon" );
563 print "<a href=\"$ccApp\">choose</a>";
565 <li><?php aField( $conf, "RightsUrl", $conf->RightsUrl, "hidden" ); ?></li>
566 <li><?php aField( $conf, "RightsText", $conf->RightsText, "hidden" ); ?></li>
567 <li><?php aField( $conf, "RightsCode", $conf->RightsCode, "hidden" ); ?></li>
568 <li><?php aField( $conf, "RightsIcon", $conf->RightsIcon, "hidden" ); ?></li>
572 MediaWiki can include a basic license notice, icon, and machine-reable
573 copyright metadata if your wiki's content is to be licensed under
574 the GNU FDL
or a Creative Commons license
. If you
're not sure, leave
580 <?php aField( $conf, "SysopName", "Sysop account name:", "" ) ?>
583 <?php aField( $conf, "SysopPass", "password:", "password" ) ?>
586 <?php aField( $conf, "SysopPass2", "again:", "password" ) ?>
589 A sysop user account can lock or delete pages, block problematic IP
590 addresses from editing, and other maintenance tasks. If creating a new
591 wiki database, a sysop account will be created with the given name
596 <h2>Database config</h2>
600 aField( $conf, "DBserver", "MySQL server" );
603 If your database server isn't on your web server
, enter the name
608 aField( $conf, "DBname", "Database name" );
611 aField( $conf, "DBuser", "DB username" );
614 aField( $conf, "DBpassword", "DB password", "password" );
617 aField( $conf, "DBpassword2", "again", "password" );
620 If you only have a single user account
and database available
,
621 enter those here
. If you have database root
access (see below
)
622 you can specify
new accounts
/databases to be created
.
628 aField( $conf, "RootPW", "DB root password", "password" );
632 You will only need this
if the database
and/or user account
633 above don
't already exist.
634 Do <em>not</em> type in your machine's root password
! MySQL
635 has its own
"root" user with a separate password
. (It might
636 even be blank
, depending on your configuration
.)
640 <label
class='column'> 
;</label
>
641 <input type
="submit" value
="Install!" />
651 /* -------------------------------------------------------------------------------------- */
653 function writeAdminSettings( $conf ) {
655 \$wgDBadminuser = \"{$conf->DBadminuser}\";
656 \$wgDBadminpassword = \"{$conf->DBadminpassword}\";
660 function writeLocalSettings( $conf ) {
661 $conf->DBmysql4
= @$conf->DBmysql4 ?
'true' : 'false';
662 $conf->UseImageResize
= $conf->UseImageResize ?
'true' : 'false';
663 $conf->PasswordSender
= $conf->EmergencyContact
;
664 if( $conf->LanguageCode
== "en-utf8" ) {
665 $conf->LanguageCode
= "en";
666 $conf->Encoding
= "UTF-8";
668 $zlib = ($conf->zlib ?
"" : "# ");
669 $magic = ($conf->ImageMagick ?
"" : "# ");
670 $convert = ($conf->ImageMagick ?
$conf->ImageMagick
: "/usr/bin/convert" );
671 $pretty = ($conf->prettyURLs ?
"" : "# ");
672 $ugly = ($conf->prettyURLs ?
"# " : "");
673 $rights = ($conf->RightsUrl
) ?
"" : "# ";
675 # $proxyKey = Parser::getRandomString() . Parser::getRandomString();
677 $sep = (DIRECTORY_SEPARATOR
== "\\") ?
";" : ":";
679 # This file was automatically generated by the MediaWiki installer.
680 # If you make manual changes, please keep track in case you need to
681 # recreate them later.
683 \$IP = \"{$conf->IP}\";
684 ini_set( \"include_path\", \"\$IP/includes$sep\$IP/languages$sep\" . ini_get(\"include_path\") );
685 include_once( \"DefaultSettings.php\" );
687 if ( \$wgCommandLineMode ) {
688 if ( isset( \$_SERVER ) && array_key_exists( 'REQUEST_METHOD', \$_SERVER ) ) {
689 die( \"This script must be run from the command line\\n\" );
692 ## Compress output if the browser supports it
693 {$zlib}if( !ini_get( 'zlib.output_compression' ) ) ob_start( 'ob_gzhandler' );
696 \$wgSitename = \"{$conf->Sitename}\";
698 \$wgScriptPath = \"{$conf->ScriptPath}\";
699 \$wgScript = \"\$wgScriptPath/index.php\";
700 \$wgRedirectScript = \"\$wgScriptPath/redirect.php\";
702 ## If using PHP as a CGI module, use the ugly URLs
703 {$pretty}\$wgArticlePath = \"\$wgScript/\$1\";
704 {$ugly}\$wgArticlePath = \"\$wgScript?title=\$1\";
706 \$wgStylePath = \"\$wgScriptPath/stylesheets\";
707 \$wgStyleSheetDirectory = \"\$IP/stylesheets\";
709 \$wgUploadPath = \"\$wgScriptPath/images\";
710 \$wgUploadDirectory = \"\$IP/images\";
711 \$wgLogo = \"\$wgUploadPath/wiki.png\";
713 \$wgEmergencyContact = \"{$conf->EmergencyContact}\";
714 \$wgPasswordSender = \"{$conf->PasswordSender}\";
716 \$wgDBserver = \"{$conf->DBserver}\";
717 \$wgDBname = \"{$conf->DBname}\";
718 \$wgDBuser = \"{$conf->DBuser}\";
719 \$wgDBpassword = \"{$conf->DBpassword}\";
721 ## To allow SQL queries through the wiki's Special:Askaql page,
722 ## uncomment the next lines. THIS IS VERY INSECURE. If you want
723 ## to allow semipublic read-only SQL access for your sysops,
724 ## you should define a MySQL user with limited privileges.
725 ## See MySQL docs: http://www.mysql.com/doc/en/GRANT.html
727 # \$wgAllowSysopQueries = true;
728 # \$wgDBsqluser = \"sqluser\";
729 # \$wgDBsqlpassword = \"sqlpass\";
731 \$wgDBmysql4 = \$wgEnablePersistentLC = {$conf->DBmysql4};
733 ## To enable image uploads, make sure the 'images' directory
734 ## is writable, then uncomment this:
735 # \$wgDisableUploads = false;
736 \$wgUseImageResize = {$conf->UseImageResize};
737 {$magic}\$wgUseImageMagick = true;
738 {$magic}\$wgImageMagickConvertCommand = \"{$convert}\";
740 ## If you have the appropriate support software installed
741 ## you can enable inline LaTeX equations:
743 \$wgMathPath = \"{\$wgUploadPath}/math\";
744 \$wgMathDirectory = \"{\$wgUploadDirectory}/math\";
745 \$wgTmpDirectory = \"{\$wgUploadDirectory}/tmp\";
747 \$wgUsePHPTal = true;
748 if ( \$wgUsePHPTal ) {
749 ini_set( \"include_path\", \"\$IP/PHPTAL-NP-0.7.0/libs$sep\" . ini_get(\"include_path\") );
752 \$wgLocalInterwiki = \$wgSitename;
754 \$wgLanguageCode = \"{$conf->LanguageCode}\";
755 " . ($conf->Encoding ?
"\$wgInputEncoding = \$wgOutputEncoding = \"{$conf->Encoding}\";" : "" ) . "
757 #\$wgProxyKey = $proxyKey;
759 ## For attaching licensing metadata to pages, and displaying an
760 ## appropriate copyright notice / icon. GNU Free Documentation
761 ## License and Creative Commons licenses are supported so far.
762 {$rights}\$wgEnableCreativeCommonsRdf = true;
763 \$wgRightsPage = \"\"; # Set to the title of a wiki page that describes your license/copyright
764 \$wgRightsUrl = \"{$conf->RightsUrl}\";
765 \$wgRightsText = \"{$conf->RightsText}\";
766 \$wgRightsIcon = \"{$conf->RightsIcon}\";
767 # \$wgRightsCode = \"{$conf->RightsCode}\"; # Not yet used
771 function dieout( $text ) {
772 die( $text . "\n\n</body>\n</html>" );
775 function importPost( $name, $default = "" ) {
776 if( isset( $_REQUEST[$name] ) ) {
777 return $_REQUEST[$name];
783 function aField( &$conf, $field, $text, $type = "", $value = "" ) {
785 $xtype = "type=\"$type\"";
790 if(!(isset($id)) or ($id == "") ) $id = $field;
791 $nolabel = ($type == "radio") ||
($type == "hidden");
795 echo "\t\t<label class='column' for=\"$id\">$text</label>\n";
798 if( $type == "radio" && $value == $conf->$field ) {
799 $checked = "checked='checked'";
803 echo "\t\t<input $xtype name=\"$field\" id=\"$id\" $checked value=\"";
804 if( $type == "radio" ) {
805 echo htmlspecialchars( $value );
807 echo htmlspecialchars( $conf->$field );
811 echo " $text</label>\n";
815 if(isset($errs[$field])) echo "<span class='error'>" . $errs[$field] . "</span>\n";
818 function getLanguageList() {
819 global $wgLanguageNames;
820 if( !isset( $wgLanguageNames ) ) {
821 $wgLanguageCode = "xxx";
822 function wfLocalUrl( $x ) { return $x; }
823 function wfLocalUrlE( $x ) { return $x; }
824 include( "../languages/Language.php" );
828 $latin1 = array( "da", "de", "en", "es", "nl", "sv" );
830 $d = opendir( "../languages" );
831 while( false !== ($f = readdir( $d ) ) ) {
832 if( preg_match( '/Language([A-Z][a-z]+)\.php$/', $f, $m ) ) {
833 $code = strtolower( $m[1] );
834 $codes[$code] = "$code - " . $wgLanguageNames[$code];
835 if( in_array( $code, $latin1 ) ) {
836 $codes[$code] .= " - Latin-1";
840 $codes["en-utf8"] = "en - English - Unicode";