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 error_reporting( E_ALL
);
22 header( "Content-type: text/html; charset=utf-8" );
23 @ini_set
( "display_errors", true );
25 ?
><!DOCTYPE HTML
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
26 "http://www.w3.org/TR/html4/loose.dtd">
29 <meta http
-equiv
="Content-type" content
="text/html; charset=utf-8">
30 <title
>MediaWiki installation
</title
>
31 <style type
="text/css">
33 @import
"../skins/monobook/main.css";
37 margin
: 1em
0 1em
2.5em
;
44 .config
-section label
.column
{
56 zoom
: 100%
; /* IE hack */
59 .config
-section
.config
-desc
{
66 .iput
-text
, .iput
-password
{
73 background
-color
: #fff;
81 background
-color
: #FFF0F0;
82 border
: 2px solid red
;
90 list-style
-type
: none
;
91 list-style
-image
: none
;
112 <div id
="globalWrapper">
113 <div id
="column-content">
115 <div id
="bodyContent">
120 # Relative includes seem to break if a parent directory is not readable;
121 # this is common for public_html subdirs under user home directories.
123 # As a dirty hack, we'll try to set up the include path first.
125 $IP = dirname( dirname( __FILE__
) );
126 $sep = PATH_SEPARATOR
;
127 if( !ini_set( "include_path", ".$sep$IP$sep$IP/includes$sep$IP/languages" ) ) {
128 set_include_path( ".$sep$IP$sep$IP/includes$sep$IP/languages" );
132 define( "MEDIAWIKI", true );
133 define( "MEDIAWIKI_INSTALL", true );
134 require_once( "includes/Defines.php" );
135 require_once( "includes/DefaultSettings.php" );
136 require_once( "includes/MagicWord.php" );
137 require_once( "includes/Namespace.php" );
140 <h1
>MediaWiki
<?php
print $wgVersion ?
> installation
</h1
>
144 /* Check for existing configurations and bug out! */
146 if( file_exists( "../LocalSettings.php" ) ) {
147 dieout( " <p><strong>Setup has completed, <a href='../index.php'>your wiki</a> is configured.</strong></p>
149 <p>Please delete the /config directory for extra security.</p></div></div></div></div>" );
152 if( file_exists( "./LocalSettings.php" ) ) {
153 writeSuccessMessage();
158 if( !is_writable( "." ) ) {
159 dieout( "<h2>Can't write config file, aborting</h2>
161 <p>In order to configure the wiki you have to make the <tt>config</tt> subdirectory
162 writable by the web server. Once configuration is done you'll move the created
163 <tt>LocalSettings.php</tt> to the parent directory, and for added safety you can
164 then remove the <tt>config</tt> subdirectory entirely.</p>
166 <p>To make the directory writable on a Unix/Linux system:</p>
169 cd <i>/path/to/wiki</i>
175 require_once( "install-utils.inc" );
176 require_once( "maintenance/updaters.inc" );
179 function getEncoded( $data ) {
180 # removing latin1 support, no need...
183 function getSitename() { return $this->getEncoded( $this->Sitename
); }
184 function getSysopName() { return $this->getEncoded( $this->SysopName
); }
185 function getSysopPass() { return $this->getEncoded( $this->SysopPass
); }
190 <h2
>Checking environment
...</h2
>
191 <p
><em
>Please
include all of the lines below when reporting installation problems
.</em
></p
>
192 <ul
class="env-check">
196 $wgNoOutputBuffer = true;
197 $conf = new ConfigData
;
199 install_version_checks();
201 print "<li>PHP " . phpversion() . " installed</li>\n";
203 if( ini_get( "register_globals" ) ) {
206 <div style
="font-size:110%">
207 <strong
class="error">Warning
:</strong
>
208 <strong
>PHP
's <tt><a href="http://php.net/register_globals">register_globals</a></tt> option is enabled. Disable it if you can.</strong>
210 MediaWiki will work, but your server is more exposed to PHP-based security vulnerabilities.
217 if( ini_get( "magic_quotes_runtime" ) ) {
219 ?><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>
220 This option corrupts data input unpredictably
; you cannot install
or use
221 MediaWiki unless this option is disabled
.
225 if( ini_get( "magic_quotes_sybase" ) ) {
227 ?
><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
>
228 This option corrupts data input unpredictably
; you cannot install
or use
229 MediaWiki unless this option is disabled
.
233 if( ini_get( "mbstring.func_overload" ) ) {
235 ?
><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
>
236 This option causes errors
and may corrupt data unpredictably
;
237 you cannot install
or use MediaWiki unless this option is disabled
.
242 dieout( "</ul><p>Cannot install Mediawiki.</p>" );
245 if( ini_get( "safe_mode" ) ) {
246 $conf->safeMode
= true;
248 <li
><b
class='error'>Warning
:</b
> <strong
>PHP
's
249 <a href='http
://www.php.net/features.safe-mode'>safe mode</a> is active.</strong>
250 You may have problems caused by this
, particularly
if using image uploads
.
254 $conf->safeMode
= false;
258 $sapi = php_sapi_name();
259 $conf->prettyURLs
= true;
260 print "<li>PHP server API is $sapi; ";
263 case "apache2handler":
264 print "ok, using pretty URLs (<tt>index.php/Page_Title</tt>)";
270 case "apache2filter":
272 print "using ugly URLs (<tt>index.php?title=Page_Title</tt>)";
273 $conf->prettyURLs
= false;
278 $conf->xml
= function_exists( "utf8_encode" );
280 print "<li>Have XML / Latin1-UTF-8 conversion support.</li>\n";
282 dieout( "PHP's XML module is missing; the wiki requires functions in
283 this module and won't work in this configuration.
284 If you're running Mandrake, install the php-xml package." );
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 = "/Users/brion/Sites/inplace";
375 $conf->IP
= dirname( dirname( __FILE__
) );
376 print "<li>Installation directory: <tt>" . htmlspecialchars( $conf->IP
) . "</tt></li>\n";
378 # $conf->ScriptPath = "/~brion/inplace";
379 $conf->ScriptPath
= preg_replace( '{^(.*)/config.*$}', '$1', $_SERVER["PHP_SELF"] ); # was SCRIPT_NAME
380 print "<li>Script URI path: <tt>" . htmlspecialchars( $conf->ScriptPath
) . "</tt></li>\n";
382 print "<li style='font-weight:bold;color:green;font-size:110%'>Environment checked. You can install MediaWiki.</li>\n";
383 $conf->posted
= ($_SERVER["REQUEST_METHOD"] == "POST");
385 $conf->Sitename
= ucfirst( importPost( "Sitename", "" ) );
386 $defaultEmail = empty( $_SERVER["SERVER_ADMIN"] )
388 : $_SERVER["SERVER_ADMIN"];
389 $conf->EmergencyContact
= importPost( "EmergencyContact", $defaultEmail );
390 $conf->DBtype
= importPost( "DBtype", "mysql" );
391 $conf->DBserver
= importPost( "DBserver", "localhost" );
392 $conf->DBname
= importPost( "DBname", "wikidb" );
393 $conf->DBuser
= importPost( "DBuser", "wikiuser" );
394 $conf->DBpassword
= importPost( "DBpassword" );
395 $conf->DBpassword2
= importPost( "DBpassword2" );
396 $conf->DBprefix
= importPost( "DBprefix" );
397 $conf->DBmysql5
= (importPost( "DBmysql5" ) == "true") ?
"true" : "false";
398 $conf->RootPW
= importPost( "RootPW" );
399 $conf->LanguageCode
= importPost( "LanguageCode", "en" );
400 $conf->SysopName
= importPost( "SysopName", "WikiSysop" );
401 $conf->SysopPass
= importPost( "SysopPass" );
402 $conf->SysopPass2
= importPost( "SysopPass2" );
404 /* Check for validity */
407 if( $conf->Sitename
== "" ||
$conf->Sitename
== "MediaWiki" ||
$conf->Sitename
== "Mediawiki" ) {
408 $errs["Sitename"] = "Must not be blank or \"MediaWiki\"";
410 if( $conf->DBuser
== "" ) {
411 $errs["DBuser"] = "Must not be blank";
413 if( $conf->DBpassword
== "" ) {
414 $errs["DBpassword"] = "Must not be blank";
416 if( $conf->DBpassword
!= $conf->DBpassword2
) {
417 $errs["DBpassword2"] = "Passwords don't match!";
419 if( !preg_match( '/^[A-Za-z_0-9]*$/', $conf->DBprefix
) ) {
420 $errs["DBprefix"] = "Invalid table prefix";
423 if( $conf->SysopPass
== "" ) {
424 $errs["SysopPass"] = "Must not be blank";
426 if( $conf->SysopPass
!= $conf->SysopPass2
) {
427 $errs["SysopPass2"] = "Passwords don't match!";
430 $conf->License
= importRequest( "License", "none" );
431 if( $conf->License
== "gfdl" ) {
432 $conf->RightsUrl
= "http://www.gnu.org/copyleft/fdl.html";
433 $conf->RightsText
= "GNU Free Documentation License 1.2";
434 $conf->RightsCode
= "gfdl";
435 $conf->RightsIcon
= '${wgStylePath}/common/images/gnu-fdl.png';
436 } elseif( $conf->License
== "none" ) {
437 $conf->RightsUrl
= $conf->RightsText
= $conf->RightsCode
= $conf->RightsIcon
= "";
439 $conf->RightsUrl
= importRequest( "RightsUrl", "" );
440 $conf->RightsText
= importRequest( "RightsText", "" );
441 $conf->RightsCode
= importRequest( "RightsCode", "" );
442 $conf->RightsIcon
= importRequest( "RightsIcon", "" );
445 $conf->Shm
= importRequest( "Shm", "none" );
446 $conf->MCServers
= importRequest( "MCServers" );
448 /* Test memcached servers */
450 if ( $conf->Shm
== 'memcached' && $conf->MCServers
) {
451 $conf->MCServerArray
= array_map( 'trim', explode( ',', $conf->MCServers
) );
452 foreach ( $conf->MCServerArray
as $server ) {
453 $error = testMemcachedServer( $server );
455 $errs["MCServers"] = $error;
459 } else if ( $conf->Shm
== 'memcached' ) {
460 $errs["MCServers"] = "Please specify at least one server if you wish to use memcached";
463 /* default values for installation */
464 $conf->Email
=importRequest("Email", "email_enabled");
465 $conf->Emailuser
=importRequest("Emailuser", "emailuser_enabled");
466 $conf->Enotif
=importRequest("Enotif", "enotif_allpages");
467 $conf->Eauthent
=importRequest("Eauthent", "eauthent_enabled");
469 if( $conf->posted
&& ( 0 == count( $errs ) ) ) {
470 do { /* So we can 'continue' to end prematurely */
471 $conf->Root
= ($conf->RootPW
!= "");
473 /* Load up the settings and get installin' */
474 $local = writeLocalSettings( $conf );
475 $wgCommandLineMode = false;
478 if (!in_array($conf->DBtype
, array("mysql", "oracle"))) {
479 $errs["DBtype"] = "Unknown database type.";
482 print "<li>Database type: {$conf->DBtype}</li>\n";
483 $dbclass = 'Database'.ucfirst($conf->DBtype
);
484 require_once("$dbclass.php");
485 $wgDBtype = $conf->DBtype
;
486 $wgDBadminuser = "root";
487 $wgDBadminpassword = $conf->RootPW
;
488 $wgDBprefix = $conf->DBprefix
;
489 $wgCommandLineMode = true;
490 $wgUseDatabaseMessages = false; /* FIXME: For database failure */
491 require_once( "includes/Setup.php" );
494 require_once( "maintenance/InitialiseMessages.inc" );
496 $wgTitle = Title
::newFromText( "Installation script" );
497 $mysqlOldClient = version_compare( mysql_get_client_info(), "4.1.0", "lt" );
498 if( $mysqlOldClient ) {
499 print "<li><b>PHP is linked with old MySQL client libraries. If you are
500 using a MySQL 4.1 server and have problems connecting to the database,
501 see <a href='http://dev.mysql.com/doc/mysql/en/old-client.html'
502 >http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b></li>\n";
506 # Attempt to connect with the specific credentials *first*
507 # This is a quick fix to bug 921 ("Install script always attempts to connect to database as root")
509 if( $conf->DBtype
== 'mysql' ) {
510 $ok = true; # Let's be optimistic
511 echo( "<li>Attempting to connect to database server..." );
512 $wgDatabase = Database
::newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, "", 1 );
513 if( $wgDatabase->isOpen() ) {
516 $wgDBadminuser = $wgDBuser;
517 $wgDBadminpassword = $wgDBpassword;
518 echo( "success. Connected as $wgDBuser.</li>\n" );
520 # Right, work out what's up
521 $errno = mysql_errno();
522 $errtx = htmlspecialchars( mysql_error() );
526 # Connection to server failed
528 echo( "failed with error [$errno] $errtx.</li>\n" );
529 $errs["DBserver"] = "Connection failed";
533 # Authentication error, attempt to use root
534 sleep( 1 ); # Rate limiting
535 $wgDatabase = $dbc->newFromParams( $wgDBserver, "root", $conf->RootPW
, "", 1 );
536 if( $wgDatabase->isOpen() ) {
539 echo( "success. Connected as root.</li>\n" );
541 # That didn't work either
543 echo( "failed due to authentication errors. Check passwords.</li>" );
544 $errs["DBuser"] = "Check name/pass";
545 $errs["DBpassword"] = "or enter root";
546 $errs["DBpassword2"] = "password below";
547 $errs["RootPW"] = "Got root?";
551 # Something vicious and undocumented happened
552 # Panic and run our little installer ass off
554 echo( "failed with error [$errno] $errtx.</li>\n" );
555 $errs["DBserver"] = "Couldn't connect to database";
558 } # norm. conn. attempt
561 # Set the version info. and ignore errors
562 $wgDatabase->ignoreErrors( true );
563 $myver = mysql_get_server_info( $wgDatabase->mConn
);
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 );
630 if( $wgDatabase->tableExists( "cur" ) ||
$wgDatabase->tableExists( "revision" ) ) {
631 print "<li>There are already MediaWiki tables in this database. Checking if updates are needed...</li>\n";
633 # Create user if required
635 $conn = Database
::newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1 );
636 if ( $conn->isOpen() ) {
637 print "<li>DB user account ok</li>\n";
640 print "<li>Granting user permissions...";
641 if( $mysqlOldClient && $mysqlNewAuth ) {
642 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>";
645 dbsource( "../maintenance/users.sql", $wgDatabase );
655 print "<li>Finished update checks.</li>\n";
657 # FIXME: Check for errors
658 print "<li>Creating tables...";
659 if ($conf->DBtype
== 'mysql') {
661 print " using MySQL 5 table defs...";
662 dbsource( "../maintenance/mysql5/tables.sql", $wgDatabase );
664 print " using MySQL 4 table defs...";
665 dbsource( "../maintenance/tables.sql", $wgDatabase );
667 dbsource( "../maintenance/interwiki.sql", $wgDatabase );
669 dbsource( "../maintenance/oracle/tables.sql", $wgDatabase );
670 dbsource( "../maintenance/oracle/interwiki.sql", $wgDatabase );
673 print " done.</li>\n";
675 print "<li>Initializing data...";
676 $wgDatabase->insert( 'site_stats',
677 array( 'ss_row_id' => 1,
678 'ss_total_views' => 0,
679 'ss_total_edits' => 0,
680 'ss_good_articles' => 0 ) );
681 # setting up the db user
683 print "<li>Granting user permissions...</li>\n";
684 dbsource( "../maintenance/users.sql", $wgDatabase );
687 if( $conf->SysopName
) {
688 $u = User
::newFromName( $conf->getSysopName() );
689 if ( 0 == $u->idForName() ) {
691 $u->setPassword( $conf->getSysopPass() );
694 $u->addGroup( "sysop" );
695 $u->addGroup( "bureaucrat" );
697 print "<li>Created sysop account <tt>" .
698 htmlspecialchars( $conf->SysopName
) . "</tt>.</li>\n";
700 print "<li>Could not create user - already exists!</li>\n";
703 print "<li>Skipped sysop account creation, no name given.</li>\n";
706 $titleobj = Title
::newFromText( wfMsgNoDB( "mainpage" ) );
707 $article = new Article( $titleobj );
708 $newid = $article->insertOn( $wgDatabase );
709 $revision = new Revision( array(
711 'text' => wfMsg( 'mainpagetext' ) . "\n\n" . wfMsg( 'mainpagedocfooter' ),
714 'user_text' => 'MediaWiki default',
716 $revid = $revision->insertOn( $wgDatabase );
717 $article->updateRevisionOn( $wgDatabase, $revision );
720 initialiseMessages();
721 print "</pre></li>\n";
724 /* Write out the config file now that all is well */
725 print "<p>Creating LocalSettings.php...</p>\n\n";
726 $localSettings = "<" . "?php$endl$local$endl?" . ">";
727 // Fix up a common line-ending problem (due to CVS on Windows)
728 $localSettings = str_replace( "\r\n", "\n", $localSettings );
730 if( version_compare( phpversion(), "4.3.2" ) >= 0 ) {
731 $xt = "xt"; # Refuse to overwrite an existing file
733 $xt = "wt"; # 'x' is not available prior to PHP 4.3.2. We did check above, but race conditions blah blah
735 $f = fopen( "LocalSettings.php", $xt );
738 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" .
739 "<p>Here's the file that would have been written, try to paste it into place manually:</p>\n" .
740 "<pre>\n" . htmlspecialchars( $localSettings ) . "</pre>\n" );
742 if(fwrite( $f, $localSettings ) ) {
744 writeSuccessMessage();
747 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");
759 if( count( $errs ) ) {
760 /* Display options form */
762 if( $conf->posted
) {
763 echo "<p class='error-top'>Something's not quite right yet; make sure everything below is filled out correctly.</p>\n";
767 <form action
="index.php" name
="config" method
="post">
772 <div
class="config-section">
773 <div
class="config-input">
775 aField( $conf, "Sitename", "Wiki name:" );
778 <p
class="config-desc">
779 Preferably a short word without punctuation
, i
.e
. "Wikipedia".<br
>
780 Will appear
as the
namespace name
for "meta" pages
, and throughout the
interface.
783 <div
class="config-input">
785 aField( $conf, "EmergencyContact", "Contact e-mail:" );
788 <p
class="config-desc">
789 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
.
792 <div
class="config-input">
793 <label
class='column' for="LanguageCode">Language
:</label
>
794 <select id
="LanguageCode" name
="LanguageCode">
797 $list = getLanguageList();
798 foreach( $list as $code => $name ) {
799 $sel = ($code == $conf->LanguageCode
) ?
'selected="selected"' : '';
800 echo "\t\t<option value=\"$code\" $sel>$name</option>\n";
805 <p
class="config-desc">
806 Select the language
for your wiki
's interface. Some localizations aren't fully complete
. Unicode (UTF
-8) used
for all localizations
.
809 <div
class="config-input">
810 <label
class='column'>Copyright
/license
:</label
>
813 <li
><?php
aField( $conf, "License", "No license metadata", "radio", "none" ); ?
></li
>
814 <li
><?php
aField( $conf, "License", "GNU Free Documentation License 1.2 (Wikipedia-compatible)", "radio", "gfdl" ); ?
></li
>
816 aField( $conf, "License", "A Creative Commons license - ", "radio", "cc" );
817 $partner = "MediaWiki";
818 $exit = urlencode( "$wgServer{$conf->ScriptPath}/config/index.php?License=cc&RightsUrl=[license_url]&RightsText=[license_name]&RightsCode=[license_code]&RightsIcon=[license_button]" );
819 $icon = urlencode( "$wgServer$wgUploadPath/wiki.png" );
820 $ccApp = htmlspecialchars( "http://creativecommons.org/license/?partner=$partner&exit_url=$exit&partner_icon_url=$icon" );
821 print "<a href=\"$ccApp\" target='_blank'>choose</a>";
823 <?php
if( $conf->License
== "cc" ) { ?
>
825 <li
><?php
aField( $conf, "RightsIcon", "<img src=\"" . htmlspecialchars( $conf->RightsIcon
) . "\" alt='icon' />", "hidden" ); ?
></li
>
826 <li
><?php
aField( $conf, "RightsText", htmlspecialchars( $conf->RightsText
), "hidden" ); ?
></li
>
827 <li
><?php
aField( $conf, "RightsCode", "code: " . htmlspecialchars( $conf->RightsCode
), "hidden" ); ?
></li
>
828 <li
><?php
aField( $conf, "RightsUrl", "<a href=\"" . htmlspecialchars( $conf->RightsUrl
) . "\">" . htmlspecialchars( $conf->RightsUrl
) . "</a>", "hidden" ); ?
></li
>
834 <p
class="config-desc">
835 A notice
, icon
, and machine
-readable copyright metadata will be displayed
for the license you pick
.
839 <div
class="config-input">
840 <?php
aField( $conf, "SysopName", "Admin username:" ) ?
>
842 <div
class="config-input">
843 <?php
aField( $conf, "SysopPass", "Password:", "password" ) ?
>
845 <div
class="config-input">
846 <?php
aField( $conf, "SysopPass2", "Password confirm:", "password" ) ?
>
848 <p
class="config-desc">
849 An admin can lock
/delete pages
, block users from editing
, and other maintenance tasks
.<br
>
850 A
new account will be added only when creating a
new wiki database
.
853 <div
class="config-input">
854 <label
class='column'>Shared memory caching
:</label
>
857 <li
><?php
aField( $conf, "Shm", "No caching", "radio", "none" ); ?
></li
>
859 if ( $conf->turck
) {
861 aField( $conf, "Shm", "Turck MMCache", "radio", "turck" );
866 if ( $conf->eaccel
) {
868 aField( $conf, "Shm", "eAccelerator", "radio", "eaccel" );
872 <li
><?php
aField( $conf, "Shm", "Memcached", "radio", "memcached" ); ?
></li
>
874 <div style
="clear:left"><?php
aField( $conf, "MCServers", "Memcached servers:", "text" ) ?
></div
>
876 <p
class="config-desc">
877 Using a shared memory system such
as Turck MMCache
, eAccelerator
, or Memcached will speed
878 up MediaWiki significantly
. Memcached is the best solution but needs to be
879 installed
. Specify the server addresses
and ports in a comma
-separted
list. Only
880 use Turck shared memory
if the wiki will be running on a single Apache server
.
884 <h2
>E
-mail
, e
-mail notification
and authentication setup
</h2
>
886 <div
class="config-section">
887 <div
class="config-input">
888 <label
class='column'>E
-mail (general
):</label
>
890 <li
><?php
aField( $conf, "Email", "Enabled", "radio", "email_enabled" ); ?
></li
>
891 <li
><?php
aField( $conf, "Email", "Disabled", "radio", "email_disabled" ); ?
></li
>
894 <p
class="config-desc">
895 Use this to disable all e
-mail
functions (send a password reminder
, user
-to
-user e
-mail
and e
-mail notification
),
896 if sending e
-mails on your server doesn
't work.
898 <div class="config-input">
899 <label class='column
'>User-to-user e-mail:</label>
901 <li><?php aField( $conf, "Emailuser", "Enabled", "radio", "emailuser_enabled" ); ?></li>
902 <li><?php aField( $conf, "Emailuser", "Disabled", "radio", "emailuser_disabled" ); ?></li>
905 <p class="config-desc">
906 Use this to disable only the user-to-user e-mail function (EmailUser).
908 <div class="config-input">
909 <label class='column
'>E-mail notification:</label>
911 <li><?php aField( $conf, "Enotif", "Disabled", "radio", "enotif_disabled" ); ?></li>
912 <li><?php aField( $conf, "Enotif", "Enabled for user_talk changes only", "radio", "enotif_usertalk" ); ?></li>
913 <li><?php aField( $conf, "Enotif", "Enabled for user_talk and watch list changes (not recommended for large wikis)", "radio", "enotif_allpages" ); ?></li>
916 <div class="config-desc">
918 E-mail notification sends a notification e-mail to a user, when the user_talk page is changed
919 and/or when watch-listed pages are changed, depending on the above settings.
920 When testing this feature, be reminded, that obviously an e-mail address must be present in your preferences
921 and that your own changes never trigger notifications to be sent to yourself.</p>
923 <p>Users get corresponding options to select or deselect in their users' preferences
.
924 The user options are not shown on the preference page
, if e
-mail notification is disabled
.</p
>
926 <p
>There are additional options
for fine tuning in
/includes
/DefaultSettings
.php
.</p
>
929 <div
class="config-input">
930 <label
class='column'>E
-mail authentication
:</label
>
932 <li
><?php
aField( $conf, "Eauthent", "Disabled", "radio", "eauthent_disabled" ); ?
></li
>
933 <li
><?php
aField( $conf, "Eauthent", "Enabled", "radio", "eauthent_enabled" ); ?
></li
>
936 <div
class="config-desc">
937 <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
938 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
>
940 <p
>The e
-mail address stays authenticated
as long
as the user does not change it
; the time of authentication is indicated
941 on the user preference page
.</p
>
943 <p
>If the option is enabled
, only authenticated e
-mail addresses can receive EmailUser mails
and/or
944 e
-mail notification mails
.</p
>
949 <h2
>Database config
</h2
>
951 <div
class="config-section">
952 <div
class="config-input">
953 <label
class='column'>Database type
:</label
>
955 <li
><?php
aField( $conf, "DBtype", "MySQL", "radio", "mysql"); ?
></li
>
956 <li
><?php
aField( $conf, "DBtype", "Oracle", "radio", "oracle" ); ?
></li
>
960 <div
class="config-input" style
="clear:left"><?php
961 aField( $conf, "DBserver", "SQL server host:" );
963 <p
class="config-desc">
964 If your database server isn
't on your web server, enter the name
965 or IP address here. MySQL only.
968 <div class="config-input"><?php
969 aField( $conf, "DBname", "Database name:" );
971 <div class="config-desc">
972 If using Oracle, set this to your connection identifier.
974 <div class="config-input"><?php
975 aField( $conf, "DBuser", "DB username:" );
977 <div class="config-input"><?php
978 aField( $conf, "DBpassword", "DB password:", "password" );
980 <div class="config-input"><?php
981 aField( $conf, "DBpassword2", "DB password confirm:", "password" );
983 <p class="config-desc">
984 If you only have a single user account and database available,
985 enter those here. If you have database root access (see below)
986 you can specify new accounts/databases to be created.
989 <div class="config-input"><?php
990 aField( $conf, "DBprefix", "Database table prefix:" );
992 <div class="config-desc">
993 <p>If you need to share one database between multiple wikis, or
994 MediaWiki and another web application, you may choose to
995 add a prefix to all the table names to avoid conflicts.</p>
997 <p>Avoid exotic characters; something like <tt>mw_</tt> is good.</p>
1000 <div class="config-input"><label class="column">Database charset</label>
1001 <div>Select one:</div>
1003 <li><?php aField( $conf, "DBmysql5", "Backwards-compatible UTF-8", "radio", "false" ); ?></li>
1004 <li><?php aField( $conf, "DBmysql5", "Experimental MySQL 4.1/5.0 UTF-8", "radio", "true" ); ?></li>
1007 <p class="config-desc">
1008 <b>EXPERIMENTAL:</b> You can enable explicit Unicode charset support
1009 for MySQL 4.1 and 5.0 servers. This is not well tested and may
1010 cause things to break. <b>If upgrading an older installation, leave
1011 in backwards-compatible mode.</b>
1014 <div class="config-input">
1016 aField( $conf, "RootPW", "DB root password:", "password" );
1019 <p class="config-desc">
1020 You will only need this if the database and/or user account
1021 above don't already exist
.
1022 Do <em
>not
</em
> type in your machine
's root password! MySQL
1023 has its own "root" user with a separate password. (It might
1024 even be blank, depending on your configuration.)
1027 <div class="config-input" style="padding:2em 0 3em">
1028 <label class='column
'> </label>
1029 <input type="submit" value="Install MediaWiki!" class="btn-install" />
1039 /* -------------------------------------------------------------------------------------- */
1040 function writeSuccessMessage() {
1041 if ( ini_get( 'safe_mode
' ) && !ini_get( 'open_basedir
' ) ) {
1043 <p>Installation successful!</p>
1044 <p>To complete the installation, please do the following:
1046 <li>Download config/LocalSettings.php with your FTP client or file manager</li>
1047 <li>Upload it to the parent directory</li>
1048 <li>Delete config/LocalSettings.php</li>
1049 <li>Start using <a href='../index
.php
'>your wiki</a>!
1051 <p>If you are in a shared hosting environment, do <strong>not</strong> just move LocalSettings.php
1052 remotely. LocalSettings.php is currently owned by the user your webserver is running under,
1053 which means that anyone on the same server can read your database password! Downloading
1054 it and uploading it again will hopefully change the ownership to a user ID specific to you.</p>
1057 echo "<p>Installation successful! Move the config/LocalSettings.php file into the parent directory, then follow
1058 <a href='../index
.php
'>this link</a> to your wiki.</p>\n";
1063 function escapePhpString( $string ) {
1064 return strtr( $string,
1075 function writeLocalSettings( $conf ) {
1076 $conf->UseImageResize = $conf->UseImageResize ? 'true' : 'false';
1077 $conf->PasswordSender = $conf->EmergencyContact;
1078 $zlib = ($conf->zlib ? "" : "# ");
1079 $magic = ($conf->ImageMagick ? "" : "# ");
1080 $convert = ($conf->ImageMagick ? $conf->ImageMagick : "/usr/bin/convert" );
1081 $pretty = ($conf->prettyURLs ? "" : "# ");
1082 $ugly = ($conf->prettyURLs ? "# " : "");
1083 $rights = ($conf->RightsUrl) ? "" : "# ";
1084 $hashedUploads = $conf->safeMode ? '' : '# ';
1086 switch ( $conf->Shm
) {
1088 $cacheType = 'CACHE_MEMCACHED';
1089 $mcservers = var_export( $conf->MCServerArray
, true );
1093 $cacheType = 'CACHE_ACCEL';
1094 $mcservers = 'array()';
1097 $cacheType = 'CACHE_NONE';
1098 $mcservers = 'array()';
1101 if ( $conf->Email
== 'email_enabled' ) {
1102 $enableemail = 'true';
1103 $enableuseremail = ( $conf->Emailuser
== 'emailuser_enabled' ) ?
'true' : 'false' ;
1104 $eauthent = ( $conf->Eauthent
== 'eauthent_enabled' ) ?
'true' : 'false' ;
1105 switch ( $conf->Enotif
) {
1106 case 'enotif_usertalk':
1107 $enotifusertalk = 'true';
1108 $enotifwatchlist = 'false';
1110 case 'enotif_allpages':
1111 $enotifusertalk = 'true';
1112 $enotifwatchlist = 'true';
1115 $enotifusertalk = 'false';
1116 $enotifwatchlist = 'false';
1119 $enableuseremail = 'false';
1120 $enableemail = 'false';
1121 $eauthent = 'false';
1122 $enotifusertalk = 'false';
1123 $enotifwatchlist = 'false';
1126 $file = @fopen
( "/dev/urandom", "r" );
1128 $secretKey = bin2hex( fread( $file, 32 ) );
1132 for ( $i=0; $i<8; $i++
) {
1133 $secretKey .= dechex(mt_rand(0, 0x7fffffff));
1135 print "<li>Warning: \$wgSecretKey key is insecure, generated with mt_rand(). Consider changing it manually.</li>\n";
1138 # Add slashes to strings for double quoting
1139 $slconf = array_map( "escapePhpString", get_object_vars( $conf ) );
1140 if( $conf->License
== 'gfdl' ) {
1141 # Needs literal string interpolation for the current style path
1142 $slconf['RightsIcon'] = $conf->RightsIcon
;
1145 $sep = PATH_SEPARATOR
;
1147 # This file was automatically generated by the MediaWiki installer.
1148 # If you make manual changes, please keep track in case you need to
1149 # recreate them later.
1151 # See includes/DefaultSettings.php for all configurable settings
1152 # and their default values, but don't forget to make changes in _this_
1155 \$IP = \"{$slconf['IP']}\";
1156 if( !ini_set( \"include_path\", \".$sep\$IP$sep\$IP/includes$sep\$IP/languages\" ) ) {
1157 set_include_path( \".$sep\$IP$sep\$IP/includes$sep\$IP/languages\" );
1159 require_once( \"includes/DefaultSettings.php\" );
1161 # If PHP's memory limit is very low, some operations may fail.
1162 " . ($conf->raiseMemory ?
'' : '# ' ) . "ini_set( 'memory_limit', '20M' );" . "
1164 if ( \$wgCommandLineMode ) {
1165 if ( isset( \$_SERVER ) && array_key_exists( 'REQUEST_METHOD', \$_SERVER ) ) {
1166 die( \"This script must be run from the command line\\n\" );
1168 } elseif ( empty( \$wgNoOutputBuffer ) ) {
1169 ## Compress output if the browser supports it
1170 {$zlib}if( !ini_get( 'zlib.output_compression' ) ) @ob_start( 'ob_gzhandler' );
1173 \$wgSitename = \"{$slconf['Sitename']}\";
1175 \$wgScriptPath = \"{$slconf['ScriptPath']}\";
1176 \$wgScript = \"\$wgScriptPath/index.php\";
1177 \$wgRedirectScript = \"\$wgScriptPath/redirect.php\";
1179 ## If using PHP as a CGI module, use the ugly URLs
1180 {$pretty}\$wgArticlePath = \"\$wgScript/\$1\";
1181 {$ugly}\$wgArticlePath = \"\$wgScript?title=\$1\";
1183 \$wgStylePath = \"\$wgScriptPath/skins\";
1184 \$wgStyleDirectory = \"\$IP/skins\";
1185 \$wgLogo = \"\$wgStylePath/common/images/wiki.png\";
1187 \$wgUploadPath = \"\$wgScriptPath/images\";
1188 \$wgUploadDirectory = \"\$IP/images\";
1190 \$wgEnableEmail = $enableemail;
1191 \$wgEnableUserEmail = $enableuseremail;
1193 \$wgEmergencyContact = \"{$slconf['EmergencyContact']}\";
1194 \$wgPasswordSender = \"{$slconf['PasswordSender']}\";
1196 ## For a detailed description of the following switches see
1197 ## http://meta.wikimedia.org/Enotif and http://meta.wikimedia.org/Eauthent
1198 ## There are many more options for fine tuning available see
1199 ## /includes/DefaultSettings.php
1200 ## UPO means: this is also a user preference option
1201 \$wgEnotifUserTalk = $enotifusertalk; # UPO
1202 \$wgEnotifWatchlist = $enotifwatchlist; # UPO
1203 \$wgEmailAuthentication = $eauthent;
1205 \$wgDBserver = \"{$slconf['DBserver']}\";
1206 \$wgDBname = \"{$slconf['DBname']}\";
1207 \$wgDBuser = \"{$slconf['DBuser']}\";
1208 \$wgDBpassword = \"{$slconf['DBpassword']}\";
1209 \$wgDBprefix = \"{$slconf['DBprefix']}\";
1210 \$wgDBtype = \"{$slconf['DBtype']}\";
1212 # Experimental charset support for MySQL 4.1/5.0.
1213 \$wgDBmysql5 = {$conf->DBmysql5};
1215 ## Shared memory settings
1216 \$wgMainCacheType = $cacheType;
1217 \$wgMemCachedServers = $mcservers;
1219 ## To enable image uploads, make sure the 'images' directory
1220 ## is writable, then uncomment this:
1221 # \$wgEnableUploads = true;
1222 \$wgUseImageResize = {$conf->UseImageResize};
1223 {$magic}\$wgUseImageMagick = true;
1224 {$magic}\$wgImageMagickConvertCommand = \"{$convert}\";
1226 ## If you want to use image uploads under safe mode,
1227 ## create the directories images/archive, images/thumb and
1228 ## images/temp, and make them all writable. Then uncomment
1229 ## this, if it's not already uncommented:
1230 {$hashedUploads}\$wgHashedUploadDirectory = false;
1232 ## If you have the appropriate support software installed
1233 ## you can enable inline LaTeX equations:
1234 # \$wgUseTeX = true;
1235 \$wgMathPath = \"{\$wgUploadPath}/math\";
1236 \$wgMathDirectory = \"{\$wgUploadDirectory}/math\";
1237 \$wgTmpDirectory = \"{\$wgUploadDirectory}/tmp\";
1239 \$wgLocalInterwiki = \$wgSitename;
1241 \$wgLanguageCode = \"{$slconf['LanguageCode']}\";
1243 \$wgProxyKey = \"$secretKey\";
1245 ## Default skin: you can change the default skin. Use the internal symbolic
1246 ## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook':
1247 # \$wgDefaultSkin = 'monobook';
1249 ## For attaching licensing metadata to pages, and displaying an
1250 ## appropriate copyright notice / icon. GNU Free Documentation
1251 ## License and Creative Commons licenses are supported so far.
1252 {$rights}\$wgEnableCreativeCommonsRdf = true;
1253 \$wgRightsPage = \"\"; # Set to the title of a wiki page that describes your license/copyright
1254 \$wgRightsUrl = \"{$slconf['RightsUrl']}\";
1255 \$wgRightsText = \"{$slconf['RightsText']}\";
1256 \$wgRightsIcon = \"{$slconf['RightsIcon']}\";
1257 # \$wgRightsCode = \"{$slconf['RightsCode']}\"; # Not yet used
1259 \$wgDiff3 = \"{$slconf['diff3']}\";
1261 // Keep things in Unix line endings internally;
1262 // the system will write out as local text type.
1263 return str_replace( "\r\n", "\n", $localsettings );
1266 function dieout( $text ) {
1267 die( $text . "\n\n</body>\n</html>" );
1270 function importVar( &$var, $name, $default = "" ) {
1271 if( isset( $var[$name] ) ) {
1272 $retval = $var[$name];
1273 if ( get_magic_quotes_gpc() ) {
1274 $retval = stripslashes( $retval );
1282 function importPost( $name, $default = "" ) {
1283 return importVar( $_POST, $name, $default );
1286 function importRequest( $name, $default = "" ) {
1287 return importVar( $_REQUEST, $name, $default );
1292 function aField( &$conf, $field, $text, $type = "text", $value = "" ) {
1295 $xtype = "type=\"$type\"";
1300 if(!(isset($id)) or ($id == "") ) $id = $field;
1301 $nolabel = ($type == "radio") ||
($type == "hidden");
1303 if ($type == 'radio')
1304 $id .= $radioCount++
;
1309 echo "\t\t<label class='column' for=\"$id\">$text</label>\n";
1312 if( $type == "radio" && $value == $conf->$field ) {
1313 $checked = "checked='checked'";
1317 echo "\t\t<input $xtype name=\"$field\" id=\"$id\" class=\"iput-$type\" $checked value=\"";
1318 if( $type == "radio" ) {
1319 echo htmlspecialchars( $value );
1321 echo htmlspecialchars( $conf->$field );
1325 echo " $text</label>\n";
1329 if(isset($errs[$field])) echo "<span class='error'>" . $errs[$field] . "</span>\n";
1332 function getLanguageList() {
1333 global $wgLanguageNames;
1334 if( !isset( $wgLanguageNames ) ) {
1335 $wgContLanguageCode = "xxx";
1336 function wfLocalUrl( $x ) { return $x; }
1337 function wfLocalUrlE( $x ) { return $x; }
1338 require_once( "languages/Names.php" );
1343 $d = opendir( "../languages" );
1344 while( false !== ($f = readdir( $d ) ) ) {
1346 if( preg_match( '/Language([A-Z][a-z_]+)\.php$/', $f, $m ) ) {
1347 $code = str_replace( '_', '-', strtolower( $m[1] ) );
1348 if( isset( $wgLanguageNames[$code] ) ) {
1349 $name = $code . ' - ' . $wgLanguageNames[$code];
1353 $codes[$code] = $name;
1361 #Check for location of an executable
1362 # @param string $loc single location to check
1363 # @param array $names filenames to check for.
1364 # @param mixed $versioninfo array of details to use when checking version, use false for no version checking
1365 function locate_executable($loc, $names, $versioninfo = false) {
1366 if (!is_array($names))
1367 $names = array($names);
1369 foreach ($names as $name) {
1370 $command = "$loc".DIRECTORY_SEPARATOR
."$name";
1371 if (file_exists($command)) {
1375 $file = str_replace('$1', $command, $versioninfo[0]);
1376 if (strstr(`
$file`
, $versioninfo[1]) !== false)
1383 function get_db_version() {
1384 global $wgDatabase, $conf;
1385 if ($conf->DBtype
== 'mysql')
1386 return mysql_get_server_info( $wgDatabase->mConn
);
1387 else if ($conf->DBtype
== 'oracle')
1388 return oci_server_version($wgDatabase->mConn
);
1391 # Test a memcached server
1392 function testMemcachedServer( $server ) {
1393 $hostport = explode(":", $server);
1396 if ( !function_exists( 'fsockopen' ) ) {
1397 $errstr = "Can't connect to memcached, fsockopen() not present";
1399 if ( !$errstr && count( $hostport ) != 2 ) {
1400 $errstr = 'Please specify host and port';
1401 var_dump( $hostport );
1404 list( $host, $port ) = $hostport;
1408 $fp = @fsockopen
( $host, $port, $errno, $fsockerr, 1.0 );
1409 if ( $fp === false ) {
1410 $errstr = "Cannot connect to memcached on $host:$port : $fsockerr";
1414 $command = "version\r\n";
1415 $bytes = fwrite( $fp, $command );
1416 if ( $bytes != strlen( $command ) ) {
1417 $errstr = "Cannot write to memcached socket on $host:$port";
1421 $expected = "VERSION ";
1422 $response = fread( $fp, strlen( $expected ) );
1423 if ( $response != $expected ) {
1424 $errstr = "Didn't get correct memcached response from $host:$port";
1431 echo "<li>Connected to memcached on $host:$port successfully";
1437 <div
class="license">
1439 <p
>This program is free software
; you can redistribute it
and/or modify
1440 it under the terms of the GNU General
Public License
as published by
1441 the Free Software Foundation
; either version
2 of the License
, or
1442 (at your option
) any later version
.</p
>
1444 <p
>This program is distributed in the hope that it will be useful
,
1445 but WITHOUT ANY WARRANTY
; without even the implied warranty of
1446 MERCHANTABILITY
or FITNESS
FOR A PARTICULAR PURPOSE
. See the
1447 GNU General
Public License
for more details
.</p
>
1449 <p
>You should have received
<a href
="../COPYING">a copy of the GNU General
Public License
</a
>
1450 along with this program
; if not
, write to the Free Software
1451 Foundation
, Inc
., 59 Temple Place
- Suite
330, Boston
, MA
02111-1307, USA
.
1452 or <a href
="http://www.gnu.org/copyleft/gpl.html">read it online
</a
></p
>
1458 <div id
="column-one">
1459 <div
class="portlet" id
="p-logo">
1460 <a style
="background-image: url(../skins/common/images/mediawiki.png);"
1461 href
="http://www.mediawiki.org/"
1462 title
="Main Page"></a
>
1464 <script type
="text/javascript"> if (window
.isMSIE55
) fixalpha(); </script
>
1465 <div
class='portlet'><div
class='pBody'>
1467 <li
><strong
><a href
="http://www.mediawiki.org/">MediaWiki home
</a
></strong
></li
>
1468 <li
><a href
="../README">Readme
</a
></li
>
1469 <li
><a href
="../RELEASE-NOTES">Release notes
</a
></li
>
1470 <li
><a href
="../docs/">Documentation
</a
></li
>
1471 <li
><a href
="http://meta.wikipedia.org/wiki/MediaWiki_User's_Guide">User
's Guide</a></li>
1472 <li><a href="http://meta.wikimedia.org/wiki/MediaWiki_FAQ">FAQ</a></li>
1474 <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>