From cecb985bee3bdd252e1b8dc0bd500b37cd52be01 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 16 May 2007 20:58:53 +0000 Subject: Aktualisierung auf MediaWiki 1.10.0 Plugins angepasst und verbessert kleine Korrekturen am Design --- config/index.php | 169 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 111 insertions(+), 58 deletions(-) (limited to 'config/index.php') 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 {
  • Fatal: zend.ze1_compatibility_mode is active! + This option causes horrible bugs with MediaWiki; you cannot install or use + MediaWiki unless this option is disabled. +

    Cannot install MediaWiki.

    " ); } @@ -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 "
  • Warning: A value for session.save_path + 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.
  • "; +} elseif ( is_dir( $sessionSavePath ) && is_writable( $sessionSavePath ) ) { + # All good? Let the user know + print "
  • Session save path appears to be valid.
  • "; +} 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 session.save_path in + PHP.ini 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 "
  • PHP is configured with no memory_limit.
  • \n"; } else { - print "
  • PHP's memory_limit is " . htmlspecialchars( $memlimit ) . ". If this is too low, installation may fail! "; + print "
  • PHP's memory_limit 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.
    " . htmlspecialchars( $memlimit ) . " seems too low, installation may fail!"; } else { $conf->raiseMemory = true; print "ok."; @@ -390,13 +441,6 @@ if( empty( $memlimit ) || $memlimit == -1 ) { print "
  • \n"; } -$conf->zlib = function_exists( "gzencode" ); -if( $conf->zlib ) { - print "
  • Have zlib support; enabling output compression.
  • \n"; -} else { - print "
  • No zlib support.
  • \n"; -} - $conf->turck = function_exists( 'mmcache_get' ); if ( $conf->turck ) { print "
  • Turck MMCache installed
  • \n"; @@ -415,7 +459,7 @@ if ( $conf->eaccel ) { if( !$conf->turck && !$conf->eaccel && !$conf->apc ) { echo( '
  • Couldn\'t find Turck MMCache, - eAccelerator or + eAccelerator, or APC. Object caching functions cannot be used.
  • ' ); } @@ -468,8 +512,6 @@ if( $conf->HaveGD ) { } } -$conf->UseImageResize = $conf->HaveGD || $conf->ImageMagick; - $conf->IP = dirname( dirname( __FILE__ ) ); print "
  • Installation directory: " . htmlspecialchars( $conf->IP ) . "
  • \n"; @@ -509,10 +551,7 @@ print "
  • 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 for help.
  • \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( "
  • 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( "
  • 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 "
  • There are already MediaWiki tables in this database. Checking if updates are needed...
  • \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 "
  • SHOW TABLE STATUS query failed!
  • \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 "
  • Warning: Unrecognised existing collation
  • \n"; + } + if ( $existingSchema && $existingSchema != $conf->DBschema ) { + print "
  • Warning: 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.
  • \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 "
    \n";
    +			print "
    \n";
     			chdir( ".." );
     			flush();
     			do_all_updates();
     			chdir( "config" );
     			print "
    \n"; - print "
  • Finished update checks.
  • \n"; + print "

    - 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.

    @@ -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.

    @@ -1175,7 +1228,7 @@ if( count( $errs ) ) { aField( $conf, "RootPW", "Superuser password:", "password" ); ?>
    - +

    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 ) ) { ?>

    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.

    Avoid exotic characters; something like mw_ is good.

    @@ -1221,8 +1274,9 @@ if( count( $errs ) ) { aField( $conf, "DBts2schema", "Schema for tsearch2:" ); ?>
    -

    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.

    +

    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.

    @@ -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}\"; -- cgit v1.2.3-54-g00ecf