summaryrefslogtreecommitdiff
path: root/config/index.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2007-05-16 20:58:53 +0000
committerPierre Schmitz <pierre@archlinux.de>2007-05-16 20:58:53 +0000
commitcecb985bee3bdd252e1b8dc0bd500b37cd52be01 (patch)
tree17266aa237742640aabee7856f0202317a45d540 /config/index.php
parent0bac06c301f2a83edb0236e4c2434da16848d549 (diff)
Aktualisierung auf MediaWiki 1.10.0
Plugins angepasst und verbessert kleine Korrekturen am Design
Diffstat (limited to 'config/index.php')
-rw-r--r--config/index.php169
1 files changed, 111 insertions, 58 deletions
diff --git a/config/index.php b/config/index.php
index 69394e69..d036e8c8 100644
--- a/config/index.php
+++ b/config/index.php
@@ -226,6 +226,26 @@ class ConfigData {
function getSitename() { return $this->getEncoded( $this->Sitename ); }
function getSysopName() { return $this->getEncoded( $this->SysopName ); }
function getSysopPass() { return $this->getEncoded( $this->SysopPass ); }
+
+ function setSchema( $schema ) {
+ $this->DBschema = $schema;
+ switch ( $this->DBschema ) {
+ case 'mysql5':
+ $this->DBTableOptions = 'ENGINE=InnoDB, DEFAULT CHARSET=utf8';
+ $this->DBmysql5 = 'true';
+ break;
+ case 'mysql5-binary':
+ $this->DBTableOptions = 'ENGINE=InnoDB, DEFAULT CHARSET=binary';
+ $this->DBmysql5 = 'true';
+ break;
+ default:
+ $this->DBTableOptions = 'TYPE=InnoDB';
+ $this->DBmysql5 = 'false';
+ }
+ # Set the global for use during install
+ global $wgDBTableOptions;
+ $wgDBTableOptions = $this->DBTableOptions;
+ }
}
?>
@@ -245,7 +265,7 @@ class ConfigData {
<?php
$endl = "
";
-$wgNoOutputBuffer = true;
+define( 'MW_NO_OUTPUT_BUFFER', 1 );
$conf = new ConfigData;
install_version_checks();
@@ -326,6 +346,15 @@ if( ini_get( "mbstring.func_overload" ) ) {
<?php
}
+if( ini_get( "zend.ze1_compatibility_mode" ) ) {
+ $fatal = true;
+ ?><li class="error"><strong>Fatal: <a href="http://www.php.net/manual/en/ini.core.php">zend.ze1_compatibility_mode</a> is active!</strong>
+ This option causes horrible bugs with MediaWiki; you cannot install or use
+ MediaWiki unless this option is disabled.
+ <?php
+}
+
+
if( $fatal ) {
dieout( "</ul><p>Cannot install MediaWiki.</p>" );
}
@@ -360,20 +389,42 @@ if( $conf->xml ) {
If you're running Mandrake, install the php-xml package." );
}
-# Crude check for session support
+# Check for session support
if( !function_exists( 'session_name' ) )
dieout( "PHP's session module is missing. MediaWiki requires session support in order to function." );
-# Likewise for PCRE
+# session.save_path doesn't *have* to be set, but if it is, and it's
+# not valid/writable/etc. then it can cause problems
+$sessionSavePath = ini_get( 'session.save_path' );
+# Warn the user if it's not set, but let them proceed
+if( !$sessionSavePath ) {
+ print "<li><strong>Warning:</strong> A value for <tt>session.save_path</tt>
+ has not been set in PHP.ini. If the default value causes problems with
+ saving session data, set it to a valid path which is read/write/execute
+ for the user your web server is running under.</li>";
+} elseif ( is_dir( $sessionSavePath ) && is_writable( $sessionSavePath ) ) {
+ # All good? Let the user know
+ print "<li>Session save path appears to be valid.</li>";
+} else {
+ # Something not right? Halt the installation so the user can fix it up
+ dieout( "Your session save path appears to be invalid or is not writable.
+ PHP needs to be able to save data to this location in order for correct
+ session operation. Please check that <tt>session.save_path</tt> in
+ <tt>PHP.ini</tt> points to a valid path, and is read/write/execute for
+ the user your web server is running under." );
+}
+
+# Check for PCRE support
if( !function_exists( 'preg_match' ) )
- dieout( "The PCRE regular expression functions are missing. MediaWiki requires these in order to function." );
+ dieout( "The PCRE support module appears to be missing. MediaWiki requires the
+ Perl-compatible regular expression functions." );
$memlimit = ini_get( "memory_limit" );
$conf->raiseMemory = false;
if( empty( $memlimit ) || $memlimit == -1 ) {
print "<li>PHP is configured with no <tt>memory_limit</tt>.</li>\n";
} else {
- print "<li>PHP's <tt>memory_limit</tt> is " . htmlspecialchars( $memlimit ) . ". <strong>If this is too low, installation may fail!</strong> ";
+ print "<li>PHP's <tt>memory_limit</tt> is " . htmlspecialchars( $memlimit ) . ". ";
$n = intval( $memlimit );
if( preg_match( '/^([0-9]+)[Mm]$/', trim( $memlimit ), $m ) ) {
$n = intval( $m[1] * (1024*1024) );
@@ -381,7 +432,7 @@ if( empty( $memlimit ) || $memlimit == -1 ) {
if( $n < 20*1024*1024 ) {
print "Attempting to raise limit to 20M... ";
if( false === ini_set( "memory_limit", "20M" ) ) {
- print "failed.";
+ print "failed.<br /><b>" . htmlspecialchars( $memlimit ) . " seems too low, installation may fail!</b>";
} else {
$conf->raiseMemory = true;
print "ok.";
@@ -390,13 +441,6 @@ if( empty( $memlimit ) || $memlimit == -1 ) {
print "</li>\n";
}
-$conf->zlib = function_exists( "gzencode" );
-if( $conf->zlib ) {
- print "<li>Have zlib support; enabling output compression.</li>\n";
-} else {
- print "<li>No zlib support.</li>\n";
-}
-
$conf->turck = function_exists( 'mmcache_get' );
if ( $conf->turck ) {
print "<li><a href=\"http://turck-mmcache.sourceforge.net/\">Turck MMCache</a> installed</li>\n";
@@ -415,7 +459,7 @@ if ( $conf->eaccel ) {
if( !$conf->turck && !$conf->eaccel && !$conf->apc ) {
echo( '<li>Couldn\'t find <a href="http://turck-mmcache.sourceforge.net">Turck MMCache</a>,
- <a href="http://eaccelerator.sourceforge.net">eAccelerator</a> or
+ <a href="http://eaccelerator.sourceforge.net">eAccelerator</a>, or
<a href="http://www.php.net/apc">APC</a>. Object caching functions cannot be used.</li>' );
}
@@ -468,8 +512,6 @@ if( $conf->HaveGD ) {
}
}
-$conf->UseImageResize = $conf->HaveGD || $conf->ImageMagick;
-
$conf->IP = dirname( dirname( __FILE__ ) );
print "<li>Installation directory: <tt>" . htmlspecialchars( $conf->IP ) . "</tt></li>\n";
@@ -509,10 +551,7 @@ print "<li style='font-weight:bold;color:green;font-size:110%'>Environment check
## MySQL specific:
$conf->DBprefix = importPost( "DBprefix" );
- $conf->DBschema = importPost( "DBschema", "mysql4" );
- $conf->DBmysql5 = ($conf->DBschema == "mysql5" ||
- $conf->DBschema == "mysql5-binary")
- ? "true" : "false";
+ $conf->setSchema( importPost( "DBschema", "mysql4" ) );
$conf->LanguageCode = importPost( "LanguageCode", "en" );
## Postgres specific:
@@ -529,7 +568,10 @@ if( $conf->Sitename == "" || $conf->Sitename == "MediaWiki" || $conf->Sitename =
if( $conf->DBuser == "" ) {
$errs["DBuser"] = "Must not be blank";
}
-if( $conf->DBpassword == "" ) {
+if( ($conf->DBtype == 'mysql') && (strlen($conf->DBuser) > 16) ) {
+ $errs["DBuser"] = "Username too long";
+}
+if( $conf->DBpassword == "" && $conf->DBtype != "postgres" ) {
$errs["DBpassword"] = "Must not be blank";
}
if( $conf->DBpassword != $conf->DBpassword2 ) {
@@ -654,7 +696,7 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) {
>http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b></li>\n";
}
$ok = true; # Let's be optimistic
-
+
# Decide if we're going to use the superuser or the regular database user
$conf->Root = $useRoot;
if( $conf->Root ) {
@@ -664,7 +706,7 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) {
$db_user = $wgDBuser;
$db_pass = $wgDBpassword;
}
-
+
# Attempt to connect
echo( "<li>Attempting to connect to database server as $db_user..." );
$wgDatabase = Database::newFromParams( $wgDBserver, $db_user, $db_pass, '', 1 );
@@ -706,14 +748,14 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) {
break;
} # switch
} #conn. att.
-
+
if( !$ok ) { continue; }
} else /* not mysql */ {
error_reporting( E_ALL );
$wgSuperUser = '';
## Possible connect as a superuser
- if( $conf->Root ) {
+ if( $useRoot ) {
$wgDBsuperuser = $conf->RootUser;
echo( "<li>Attempting to connect to database \"postgres\" as superuser \"$wgDBsuperuser\"..." );
$wgDatabase = $dbc->newFromParams($wgDBserver, $wgDBsuperuser, $conf->RootPW, "postgres", 1);
@@ -797,6 +839,32 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) {
if( $wgDatabase->tableExists( "cur" ) || $wgDatabase->tableExists( "revision" ) ) {
print "<li>There are already MediaWiki tables in this database. Checking if updates are needed...</li>\n";
+ # Determine existing default character set
+ if ( $wgDatabase->tableExists( "revision" ) ) {
+ $revision = $wgDatabase->escapeLike( $conf->DBprefix . 'revision' );
+ $res = $wgDatabase->query( "SHOW TABLE STATUS LIKE '$revision'" );
+ $row = $wgDatabase->fetchObject( $res );
+ if ( !$row ) {
+ echo "<li>SHOW TABLE STATUS query failed!</li>\n";
+ $existingSchema = false;
+ } elseif ( preg_match( '/^latin1/', $row->Collation ) ) {
+ $existingSchema = 'mysql4';
+ } elseif ( preg_match( '/^utf8/', $row->Collation ) ) {
+ $existingSchema = 'mysql5';
+ } elseif ( preg_match( '/^binary/', $row->Collation ) ) {
+ $existingSchema = 'mysql5-binary';
+ } else {
+ $existingSchema = false;
+ echo "<li><strong>Warning:</strong> Unrecognised existing collation</li>\n";
+ }
+ if ( $existingSchema && $existingSchema != $conf->DBschema ) {
+ print "<li><strong>Warning:</strong> you requested the {$conf->DBschema} schema, " .
+ "but the existing database has the $existingSchema schema. This upgrade script ".
+ "can't convert it, so it will remain $existingSchema.</li>\n";
+ $conf->setSchema( $existingSchema );
+ }
+ }
+
# Create user if required (todo: other databases)
if ( $conf->Root && $conf->DBtype == 'mysql') {
$conn = $dbc->newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1 );
@@ -812,33 +880,18 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) {
dbsource( "../maintenance/users.sql", $wgDatabase );
}
}
- print "<pre>\n";
+ print "</ul><pre>\n";
chdir( ".." );
flush();
do_all_updates();
chdir( "config" );
print "</pre>\n";
- print "<li>Finished update checks.</li>\n";
+ print "<ul><li>Finished update checks.</li>\n";
} else {
# FIXME: Check for errors
print "<li>Creating tables...";
if ($conf->DBtype == 'mysql') {
- switch( $conf->DBschema ) {
- case "mysql4":
- print " using MySQL 4 table defs...";
- dbsource( "../maintenance/tables.sql", $wgDatabase );
- break;
- case "mysql5":
- print " using MySQL 5 UTF-8 table defs...";
- dbsource( "../maintenance/mysql5/tables.sql", $wgDatabase );
- break;
- case "mysql5-binary":
- print " using MySQL 5 binary table defs...";
- dbsource( "../maintenance/mysql5/tables-binary.sql", $wgDatabase );
- break;
- default:
- dieout( " <b>invalid schema selection!</b></li>" );
- }
+ dbsource( "../maintenance/tables.sql", $wgDatabase );
dbsource( "../maintenance/interwiki.sql", $wgDatabase );
} else if ($conf->DBtype == 'postgres') {
$wgDatabase->setup_database();
@@ -900,7 +953,7 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) {
$newid = $article->insertOn( $wgDatabase );
$revision = new Revision( array(
'page' => $newid,
- 'text' => wfMsg( 'mainpagetext' ) . "\n\n" . wfMsg( 'mainpagedocfooter' ),
+ 'text' => wfMsg( 'mainpagetext' ) . "\n\n" . wfMsgNoTrans( 'mainpagedocfooter' ),
'comment' => '',
'user' => 0,
'user_text' => 'MediaWiki default',
@@ -912,7 +965,7 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) {
/* Write out the config file now that all is well */
print "<li style=\"list-style: none\">\n";
print "<p>Creating LocalSettings.php...</p>\n\n";
- $localSettings = "<" . "?php$endl$local$endl?" . ">\r\n";
+ $localSettings = "<" . "?php$endl$local$endl\r\n";
// Fix up a common line-ending problem (due to CVS on Windows)
$localSettings = str_replace( "\r\n", "\n", $localSettings );
$f = fopen( "LocalSettings.php", 'xt' );
@@ -1063,7 +1116,7 @@ if( count( $errs ) ) {
<p class="config-desc">
Using a shared memory system such as Turck MMCache, APC, eAccelerator, or Memcached
will speed up MediaWiki significantly. Memcached is the best solution but needs to be
- installed. Specify the server addresses and ports in a comma-separted list. Only
+ installed. Specify the server addresses and ports in a comma-separated list. Only
use Turck shared memory if the wiki will be running on a single Apache server.
</p>
</div>
@@ -1079,7 +1132,7 @@ if( count( $errs ) ) {
</ul>
</div>
<p class="config-desc">
- Use this to disable all e-mail functions (password reminders, user-to-user e-mail and e-mail notifications)
+ Use this to disable all e-mail functions (password reminders, user-to-user e-mail, and e-mail notifications)
if sending mail doesn't work on your server.
</p>
@@ -1157,7 +1210,7 @@ if( count( $errs ) ) {
enter those here. If you have database root access (see below)
you can specify new accounts/databases to be created. This account
will not be created if it pre-exists. If this is the case, ensure that it
- has SELECT, INSERT, UPDATE and DELETE permissions on the MediaWiki database.
+ has SELECT, INSERT, UPDATE, and DELETE permissions on the MediaWiki database.
</p>
<div class="config-input">
@@ -1175,7 +1228,7 @@ if( count( $errs ) ) {
aField( $conf, "RootPW", "Superuser password:", "password" );
?>
</div>
-
+
<p class="config-desc">
If the database user specified above does not exist, or does not have access to create
the database (if needed) or tables within it, please check the box and provide details
@@ -1188,7 +1241,7 @@ if( count( $errs ) ) {
?></div>
<div class="config-desc">
<p>If you need to share one database between multiple wikis, or
- MediaWiki and another web application, you may choose to
+ between MediaWiki and another web application, you may choose to
add a prefix to all the table names to avoid conflicts.</p>
<p>Avoid exotic characters; something like <tt>mw_</tt> is good.</p>
@@ -1221,8 +1274,9 @@ if( count( $errs ) ) {
aField( $conf, "DBts2schema", "Schema for tsearch2:" );
?></div>
<div class="config-desc">
- <p>The username specified above will have it's search path set to the above schemas,
- so it is recommended that you create a new user.</p>
+ <p>The username specified above (at "DB username") will have its search path set to the above schemas,
+ so it is recommended that you create a new user. The above schemas are generally correct:
+ only change them if you are sure you need to.</p>
</div>
</div>
@@ -1283,9 +1337,7 @@ function escapePhpString( $string ) {
}
function writeLocalSettings( $conf ) {
- $conf->UseImageResize = $conf->UseImageResize ? 'true' : 'false';
$conf->PasswordSender = $conf->EmergencyContact;
- $zlib = ($conf->zlib ? "" : "# ");
$magic = ($conf->ImageMagick ? "" : "# ");
$convert = ($conf->ImageMagick ? $conf->ImageMagick : "/usr/bin/convert" );
$rights = ($conf->RightsUrl) ? "" : "# ";
@@ -1380,10 +1432,9 @@ if ( \$wgCommandLineMode ) {
if ( isset( \$_SERVER ) && array_key_exists( 'REQUEST_METHOD', \$_SERVER ) ) {
die( \"This script must be run from the command line\\n\" );
}
-} elseif ( empty( \$wgNoOutputBuffer ) ) {
- ## Compress output if the browser supports it
- {$zlib}if( !ini_get( 'zlib.output_compression' ) ) @ob_start( 'ob_gzhandler' );
}
+## Uncomment this to disable output compression
+# \$wgDisableOutputCompression = true;
\$wgSitename = \"{$slconf['Sitename']}\";
@@ -1417,6 +1468,9 @@ if ( \$wgCommandLineMode ) {
\$wgDBport = \"{$slconf['DBport']}\";
\$wgDBprefix = \"{$slconf['DBprefix']}\";
+# MySQL table options to use during installation or update
+\$wgDBTableOptions = \"{$slconf['DBTableOptions']}\";
+
# Schemas for Postgres
\$wgDBmwschema = \"{$slconf['DBmwschema']}\";
\$wgDBts2schema = \"{$slconf['DBts2schema']}\";
@@ -1431,7 +1485,6 @@ if ( \$wgCommandLineMode ) {
## To enable image uploads, make sure the 'images' directory
## is writable, then set this to true:
\$wgEnableUploads = false;
-\$wgUseImageResize = {$conf->UseImageResize};
{$magic}\$wgUseImageMagick = true;
{$magic}\$wgImageMagickConvertCommand = \"{$convert}\";