/** * Return the full text of the generated LocalSettings.php file, * including the extensions * * @return String */ public function getText() { $localSettings = $this->getDefaultText(); 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"; $ip = $this->installer->getVar( 'IP' ); foreach ( $this->extensions as $ext) { $path = str_replace( $ip, '', $extensions[$ext]['path'] ); $prefix = ''; if ( $path !== $extensions[$ext]['path'] ) { $prefix = '$IP'; } $path = $prefix . self::escapePhpString( $path ); $localSettings .= "require_once \"$path\";\n"; } } $localSettings .= "\n\n# End of automatically generated settings. # Add more configuration options below.\n\n"; return $localSettings; }
/** * Constructor. * * @param $installer Installer subclass */ public function __construct(Installer $installer) { $this->installer = $installer; $this->extensions = $installer->getVar('_Extensions'); $db = $installer->getDBInstaller($installer->getVar('wgDBtype')); $confItems = array_merge(array('wgScriptPath', 'wgScriptExtension', 'wgPasswordSender', 'wgImageMagickConvertCommand', 'wgShellLocale', 'wgLanguageCode', 'wgEnableEmail', 'wgEnableUserEmail', 'wgDiff3', 'wgEnotifUserTalk', 'wgEnotifWatchlist', 'wgEmailAuthentication', 'wgDBtype', 'wgSecretKey', 'wgRightsUrl', 'wgSitename', 'wgRightsIcon', 'wgRightsText', 'wgRightsCode', 'wgMainCacheType', 'wgEnableUploads', 'wgMainCacheType', '_MemCachedServers', 'wgDBserver', 'wgDBuser', 'wgDBpassword', 'wgUseInstantCommons', 'wgUpgradeKey', 'wgDefaultSkin', 'wgMetaNamespace', 'wgResourceLoaderMaxQueryLength'), $db->getGlobalNames()); $unescaped = array('wgRightsIcon'); $boolItems = array('wgEnableEmail', 'wgEnableUserEmail', 'wgEnotifUserTalk', 'wgEnotifWatchlist', 'wgEmailAuthentication', 'wgEnableUploads', 'wgUseInstantCommons'); foreach ($confItems as $c) { $val = $installer->getVar($c); if (in_array($c, $boolItems)) { $val = wfBoolToStr($val); } if (!in_array($c, $unescaped)) { $val = self::escapePhpString($val); } $this->values[$c] = $val; } $this->dbSettings = $db->getLocalSettings(); $this->safeMode = $installer->getVar('_SafeMode'); $this->values['wgEmergencyContact'] = $this->values['wgPasswordSender']; }