summaryrefslogtreecommitdiff
path: root/includes/installer/LocalSettingsGenerator.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/installer/LocalSettingsGenerator.php')
-rw-r--r--includes/installer/LocalSettingsGenerator.php59
1 files changed, 29 insertions, 30 deletions
diff --git a/includes/installer/LocalSettingsGenerator.php b/includes/installer/LocalSettingsGenerator.php
index 72ea3db7..5c803d3e 100644
--- a/includes/installer/LocalSettingsGenerator.php
+++ b/includes/installer/LocalSettingsGenerator.php
@@ -73,14 +73,14 @@ class LocalSettingsGenerator {
'wgEnotifWatchlist', 'wgEmailAuthentication', 'wgEnableUploads', 'wgUseInstantCommons'
);
- foreach( $confItems as $c ) {
+ foreach ( $confItems as $c ) {
$val = $installer->getVar( $c );
- if( in_array( $c, $boolItems ) ) {
+ if ( in_array( $c, $boolItems ) ) {
$val = wfBoolToStr( $val );
}
- if ( !in_array( $c, $unescaped ) ) {
+ if ( !in_array( $c, $unescaped ) && $val !== null ) {
$val = self::escapePhpString( $val );
}
@@ -136,15 +136,17 @@ class LocalSettingsGenerator {
public function getText() {
$localSettings = $this->getDefaultText();
- if( count( $this->extensions ) ) {
+ if ( count( $this->extensions ) ) {
+ $extensions = $this->installer->findExtensions();
$localSettings .= "
# Enabled Extensions. Most extensions are enabled by including the base extension file here
# but check specific extension documentation for more details
# The following extensions were automatically enabled:\n";
- foreach( $this->extensions as $extName ) {
- $encExtName = self::escapePhpString( $extName );
- $localSettings .= "require_once( \"\$IP/extensions/$encExtName/$encExtName.php\" );\n";
+ $ip = $this->installer->getVar( 'IP' );
+ foreach ( $this->extensions as $ext) {
+ $path = str_replace( $ip, '$IP', $extensions[$ext]['path'] );
+ $localSettings .= "require_once \"$path\";\n";
}
}
@@ -169,13 +171,13 @@ class LocalSettingsGenerator {
protected function buildMemcachedServerList() {
$servers = $this->values['_MemCachedServers'];
- if( !$servers ) {
+ if ( !$servers ) {
return 'array()';
} else {
$ret = 'array( ';
$servers = explode( ',', $servers );
- foreach( $servers as $srv ) {
+ foreach ( $servers as $srv ) {
$srv = trim( $srv );
$ret .= "'$srv', ";
}
@@ -188,33 +190,33 @@ class LocalSettingsGenerator {
* @return String
*/
protected function getDefaultText() {
- if( !$this->values['wgImageMagickConvertCommand'] ) {
+ if ( !$this->values['wgImageMagickConvertCommand'] ) {
$this->values['wgImageMagickConvertCommand'] = '/usr/bin/convert';
$magic = '#';
} else {
$magic = '';
}
- if( !$this->values['wgShellLocale'] ) {
+ if ( !$this->values['wgShellLocale'] ) {
$this->values['wgShellLocale'] = 'en_US.UTF-8';
$locale = '#';
} else {
$locale = '';
}
- //$rightsUrl = $this->values['wgRightsUrl'] ? '' : '#'; // TODO: Fixme, I'm unused!
+ //$rightsUrl = $this->values['wgRightsUrl'] ? '' : '#'; // @todo FIXME: I'm unused!
$hashedUploads = $this->safeMode ? '' : '#';
$metaNamespace = '';
- if( $this->values['wgMetaNamespace'] !== $this->values['wgSitename'] ) {
+ if ( $this->values['wgMetaNamespace'] !== $this->values['wgSitename'] ) {
$metaNamespace = "\$wgMetaNamespace = \"{$this->values['wgMetaNamespace']}\";\n";
}
$groupRights = '';
- if( $this->groupPermissions ) {
+ if ( $this->groupPermissions ) {
$groupRights .= "# The following permissions were set based on your choice in the installer\n";
- foreach( $this->groupPermissions as $group => $rightArr ) {
+ foreach ( $this->groupPermissions as $group => $rightArr ) {
$group = self::escapePhpString( $group );
- foreach( $rightArr as $right => $perm ) {
+ foreach ( $rightArr as $right => $perm ) {
$right = self::escapePhpString( $right );
$groupRights .= "\$wgGroupPermissions['$group']['$right'] = " .
wfBoolToStr( $perm ) . ";\n";
@@ -222,12 +224,18 @@ class LocalSettingsGenerator {
}
}
- switch( $this->values['wgMainCacheType'] ) {
+ $wgServerSetting = "";
+ if ( array_key_exists( 'wgServer', $this->values ) && $this->values['wgServer'] !== null ) {
+ $wgServerSetting = "\n## The protocol and server name to use in fully-qualified URLs\n";
+ $wgServerSetting .= "\$wgServer = \"{$this->values['wgServer']}\";\n";
+ }
+
+ switch ( $this->values['wgMainCacheType'] ) {
case 'anything':
case 'db':
case 'memcached':
case 'accel':
- $cacheType = 'CACHE_' . strtoupper( $this->values['wgMainCacheType']);
+ $cacheType = 'CACHE_' . strtoupper( $this->values['wgMainCacheType'] );
break;
case 'none':
default:
@@ -235,6 +243,7 @@ class LocalSettingsGenerator {
}
$mcservers = $this->buildMemcachedServerList();
+
return "<?php
# This file was automatically generated by the MediaWiki {$GLOBALS['wgVersion']}
# installer. If you make manual changes, please keep track in case you
@@ -264,10 +273,7 @@ if ( !defined( 'MEDIAWIKI' ) ) {
## http://www.mediawiki.org/wiki/Manual:Short_URL
\$wgScriptPath = \"{$this->values['wgScriptPath']}\";
\$wgScriptExtension = \"{$this->values['wgScriptExtension']}\";
-
-## The protocol and server name to use in fully-qualified URLs
-\$wgServer = \"{$this->values['wgServer']}\";
-
+${wgServerSetting}
## The relative URL path to the skins directory
\$wgStylePath = \"\$wgScriptPath/skins\";
@@ -335,7 +341,7 @@ if ( !defined( 'MEDIAWIKI' ) ) {
\$wgUpgradeKey = \"{$this->values['wgUpgradeKey']}\";
## Default skin: you can change the default skin. Use the internal symbolic
-## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook', 'vector':
+## names, ie 'cologneblue', 'monobook', 'vector':
\$wgDefaultSkin = \"{$this->values['wgDefaultSkin']}\";
## For attaching licensing metadata to pages, and displaying an
@@ -349,13 +355,6 @@ if ( !defined( 'MEDIAWIKI' ) ) {
# Path to the GNU diff3 utility. Used for conflict resolution.
\$wgDiff3 = \"{$this->values['wgDiff3']}\";
-# Query string length limit for ResourceLoader. You should only set this if
-# your web server has a query string length limit (then set it to that limit),
-# or if you have suhosin.get.max_value_length set in php.ini (then set it to
-# that value)
-\$wgResourceLoaderMaxQueryLength = {$this->values['wgResourceLoaderMaxQueryLength']};
-
{$groupRights}";
}
-
}