'envCheckPCRE',
'envCheckMemory',
'envCheckCache',
+ 'envCheckModSecurity',
'envCheckDiff3',
'envCheckGraphics',
'envCheckServer',
$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();
}
}
}
+ $this->setVar( '_CompiledDBs', $compiledDBs );
$this->parserTitle = Title::newFromText( 'Installer' );
$this->parserOptions = new ParserOptions; // language will be wrong :(
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;
$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.
*/
* 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 );
}
$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;
}
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;
}
*/
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 ) {
/**
* 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 ) {
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
*
*/
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 );
/**
* Insert Main Page with default content.
*
+ * @param $installer DatabaseInstaller
* @return Status
*/
protected function createMainpage( DatabaseInstaller $installer ) {