X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Finstaller%2FInstaller.php;h=d8afba134d5a5d290740549893ce654995b0ec96;hb=4143a62299f0517d36cc452ef5585b3c36d3098f;hp=729825da5cf0cbf28b756ebe359a8cdec2f39a43;hpb=ae58a0dcf235e380ec9063794ca2a161cac255ad;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index 729825da5c..d8afba134d 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -97,6 +97,7 @@ abstract class Installer { 'envCheckPCRE', 'envCheckMemory', 'envCheckCache', + 'envCheckModSecurity', 'envCheckDiff3', 'envCheckGraphics', 'envCheckServer', @@ -332,12 +333,14 @@ abstract class Installer { $this->settings[$var] = $GLOBALS[$var]; } + $compiledDBs = array(); foreach ( self::getDBTypes() as $type ) { $installer = $this->getDBInstaller( $type ); if ( !$installer->isCompiled() ) { continue; } + $compiledDBs[] = $type; $defaults = $installer->getGlobalDefaults(); @@ -349,6 +352,7 @@ abstract class Installer { } } } + $this->setVar( '_CompiledDBs', $compiledDBs ); $this->parserTitle = Title::newFromText( 'Installer' ); $this->parserOptions = new ParserOptions; // language will be wrong :( @@ -621,19 +625,13 @@ abstract class Installer { protected function envCheckDB() { global $wgLang; - $compiledDBs = array(); $allNames = array(); foreach ( self::getDBTypes() as $name ) { - if ( $this->getDBInstaller( $name )->isCompiled() ) { - $compiledDBs[] = $name; - } - $allNames[] = wfMsg( 'config-type-' . $name ); + $allNames[] = wfMsg( "config-type-$name" ); } - $this->setVar( '_CompiledDBs', $compiledDBs ); - - if ( !$compiledDBs ) { + if ( !$this->getVar( '_CompiledDBs' ) ) { $this->showError( 'config-no-db', $wgLang->commaList( $allNames ) ); // @todo FIXME: This only works for the web installer! return false; @@ -805,6 +803,15 @@ abstract class Installer { $this->setVar( '_Caches', $caches ); } + /** + * Scare user to death if they have mod_security + */ + protected function envCheckModSecurity() { + if ( self::apacheModulePresent( 'mod_security' ) ) { + $this->showMessage( 'config-mod-security' ); + } + } + /** * Search for GNU diff3. */ @@ -846,7 +853,12 @@ abstract class Installer { * Environment check for the server hostname. */ protected function envCheckServer() { - $server = WebRequest::detectServer(); + if ( $this->getVar( 'wgServer' ) ) { + // wgServer was pre-defined, perhaps by the cli installer + $server = $this->getVar( 'wgServer' ); + } else { + $server = WebRequest::detectServer(); + } $this->showMessage( 'config-using-server', $server ); $this->setVar( 'wgServer', $server ); } @@ -859,10 +871,6 @@ abstract class Installer { $IP = dirname( dirname( dirname( __FILE__ ) ) ); $this->setVar( 'IP', $IP ); - if( !$this->getVar( 'wgScriptPath' ) ) { - $this->showError( 'config-no-uri' ); - return false; - } $this->showMessage( 'config-using-uri', $this->getVar( 'wgServer' ), $this->getVar( 'wgScriptPath' ) ); return true; } @@ -978,7 +986,10 @@ abstract class Installer { protected function envCheckSuhosinMaxValueLength() { $maxValueLength = ini_get( 'suhosin.get.max_value_length' ); if ( $maxValueLength > 0 ) { - $this->showMessage( 'config-suhosin-max-value-length', $maxValueLength ); + if( $maxValueLength < 1024 ) { + # Only warn if the value is below the sane 1024 + $this->showMessage( 'config-suhosin-max-value-length', $maxValueLength ); + } } else { $maxValueLength = -1; } @@ -1035,7 +1046,7 @@ abstract class Installer { */ if( $utf8 ) { $useNormalizer = 'utf8'; - $utf8 = utf8_normalize( $not_normal_c, UNORM_NFC ); + $utf8 = utf8_normalize( $not_normal_c, UtfNormal::UNORM_NFC ); if ( $utf8 !== $normal_c ) $needsUpdate = true; } if( $intl ) { @@ -1115,6 +1126,9 @@ abstract class Installer { /** * Same as locateExecutable(), but checks in getPossibleBinPaths() by default * @see locateExecutable() + * @param $names + * @param $versionInfo bool + * @return bool|string */ public static function locateExecutableInDefaultPaths( $names, $versionInfo = false ) { foreach( self::getPossibleBinPaths() as $path ) { @@ -1172,6 +1186,23 @@ abstract class Installer { return false; } + /** + * Checks for presence of an Apache module. Works only if PHP is running as an Apache module, too. + * + * @param $moduleName String: Name of module to check. + * @return bool + */ + public static function apacheModulePresent( $moduleName ) { + if ( function_exists( 'apache_get_modules' ) && in_array( $moduleName, apache_get_modules() ) ) { + return true; + } + // try it the hard way + ob_start(); + phpinfo( INFO_MODULES ); + $info = ob_get_clean(); + return strpos( $info, $moduleName ) !== false; + } + /** * ParserOptions are constructed before we determined the language, so fix it * @@ -1179,11 +1210,13 @@ abstract class Installer { */ public function setParserLanguage( $lang ) { $this->parserOptions->setTargetLanguage( $lang ); - $this->parserOptions->setUserLang( $lang->getCode() ); + $this->parserOptions->setUserLang( $lang ); } /** * Overridden by WebInstaller to provide lastPage parameters. + * @param $page stirng + * @return string */ protected function getDocUrl( $page ) { return "{$_SERVER['PHP_SELF']}?page=" . urlencode( $page ); @@ -1471,6 +1504,7 @@ abstract class Installer { /** * Insert Main Page with default content. * + * @param $installer DatabaseInstaller * @return Status */ protected function createMainpage( DatabaseInstaller $installer ) {