2010-05-07 12:25:01 +00:00
|
|
|
<?php
|
2010-08-21 18:20:09 +00:00
|
|
|
/**
|
|
|
|
|
* Generator for LocalSettings.php file.
|
|
|
|
|
*
|
2012-05-06 05:50:15 +00:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
|
*
|
2010-08-21 18:20:09 +00:00
|
|
|
* @file
|
2019-11-25 23:24:49 +00:00
|
|
|
* @ingroup Installer
|
2010-08-21 18:20:09 +00:00
|
|
|
*/
|
2010-05-07 12:25:01 +00:00
|
|
|
|
2010-07-29 18:36:39 +00:00
|
|
|
/**
|
2010-08-21 18:20:09 +00:00
|
|
|
* Class for generating LocalSettings.php file.
|
2010-07-29 18:36:39 +00:00
|
|
|
*
|
2019-11-25 23:24:49 +00:00
|
|
|
* @ingroup Installer
|
2010-07-29 18:36:39 +00:00
|
|
|
* @since 1.17
|
|
|
|
|
*/
|
2010-05-07 12:25:01 +00:00
|
|
|
class LocalSettingsGenerator {
|
2010-12-16 11:20:39 +00:00
|
|
|
|
2016-02-17 09:09:32 +00:00
|
|
|
protected $extensions = [];
|
2019-09-11 09:30:12 +00:00
|
|
|
protected $skins = [];
|
2016-02-17 09:09:32 +00:00
|
|
|
protected $values = [];
|
|
|
|
|
protected $groupPermissions = [];
|
2012-06-12 16:18:44 +00:00
|
|
|
protected $dbSettings = '';
|
2015-04-01 07:07:44 +00:00
|
|
|
protected $IP;
|
2010-12-16 11:20:39 +00:00
|
|
|
|
2010-07-21 10:56:35 +00:00
|
|
|
/**
|
|
|
|
|
* @var Installer
|
|
|
|
|
*/
|
2012-06-12 16:18:44 +00:00
|
|
|
protected $installer;
|
2010-05-07 12:25:01 +00:00
|
|
|
|
|
|
|
|
/**
|
2014-04-19 11:55:27 +00:00
|
|
|
* @param Installer $installer
|
2010-05-07 12:25:01 +00:00
|
|
|
*/
|
|
|
|
|
public function __construct( Installer $installer ) {
|
|
|
|
|
$this->installer = $installer;
|
2010-11-08 13:59:10 +00:00
|
|
|
|
2010-05-07 12:25:01 +00:00
|
|
|
$this->extensions = $installer->getVar( '_Extensions' );
|
2014-06-10 11:41:29 +00:00
|
|
|
$this->skins = $installer->getVar( '_Skins' );
|
2015-04-01 07:07:44 +00:00
|
|
|
$this->IP = $installer->getVar( 'IP' );
|
2010-11-08 13:59:10 +00:00
|
|
|
|
2010-05-07 12:25:01 +00:00
|
|
|
$db = $installer->getDBInstaller( $installer->getVar( 'wgDBtype' ) );
|
2010-06-29 02:46:11 +00:00
|
|
|
|
2010-07-21 10:56:35 +00:00
|
|
|
$confItems = array_merge(
|
2016-02-17 09:09:32 +00:00
|
|
|
[
|
2015-06-02 15:38:57 +00:00
|
|
|
'wgServer', 'wgScriptPath',
|
2010-07-21 10:56:35 +00:00
|
|
|
'wgPasswordSender', 'wgImageMagickConvertCommand', 'wgShellLocale',
|
|
|
|
|
'wgLanguageCode', 'wgEnableEmail', 'wgEnableUserEmail', 'wgDiff3',
|
|
|
|
|
'wgEnotifUserTalk', 'wgEnotifWatchlist', 'wgEmailAuthentication',
|
|
|
|
|
'wgDBtype', 'wgSecretKey', 'wgRightsUrl', 'wgSitename', 'wgRightsIcon',
|
2015-10-23 21:29:38 +00:00
|
|
|
'wgRightsText', '_MainCacheType', 'wgEnableUploads',
|
|
|
|
|
'_MemCachedServers', 'wgDBserver', 'wgDBuser',
|
2010-12-07 02:20:14 +00:00
|
|
|
'wgDBpassword', 'wgUseInstantCommons', 'wgUpgradeKey', 'wgDefaultSkin',
|
2016-06-30 09:29:10 +00:00
|
|
|
'wgMetaNamespace', 'wgLogo', 'wgAuthenticationTokenVersion', 'wgPingback',
|
2016-02-17 09:09:32 +00:00
|
|
|
],
|
2010-07-21 10:56:35 +00:00
|
|
|
$db->getGlobalNames()
|
|
|
|
|
);
|
2010-12-16 11:20:39 +00:00
|
|
|
|
2017-03-15 23:53:36 +00:00
|
|
|
$unescaped = [ 'wgRightsIcon', 'wgLogo', '_Caches' ];
|
2016-02-17 09:09:32 +00:00
|
|
|
$boolItems = [
|
2010-07-21 10:56:35 +00:00
|
|
|
'wgEnableEmail', 'wgEnableUserEmail', 'wgEnotifUserTalk',
|
2016-06-30 09:29:10 +00:00
|
|
|
'wgEnotifWatchlist', 'wgEmailAuthentication', 'wgEnableUploads', 'wgUseInstantCommons',
|
|
|
|
|
'wgPingback',
|
2016-02-17 09:09:32 +00:00
|
|
|
];
|
2010-12-16 11:20:39 +00:00
|
|
|
|
2013-04-20 21:11:46 +00:00
|
|
|
foreach ( $confItems as $c ) {
|
2010-05-07 12:25:01 +00:00
|
|
|
$val = $installer->getVar( $c );
|
2010-12-16 11:20:39 +00:00
|
|
|
|
2013-04-20 21:11:46 +00:00
|
|
|
if ( in_array( $c, $boolItems ) ) {
|
2010-05-07 12:25:01 +00:00
|
|
|
$val = wfBoolToStr( $val );
|
|
|
|
|
}
|
2010-12-16 11:20:39 +00:00
|
|
|
|
2013-10-06 19:41:18 +00:00
|
|
|
if ( !in_array( $c, $unescaped ) && $val !== null ) {
|
2010-05-12 20:30:01 +00:00
|
|
|
$val = self::escapePhpString( $val );
|
|
|
|
|
}
|
2010-12-16 11:20:39 +00:00
|
|
|
|
2010-05-07 12:25:01 +00:00
|
|
|
$this->values[$c] = $val;
|
|
|
|
|
}
|
2010-12-16 11:20:39 +00:00
|
|
|
|
2010-05-07 12:25:01 +00:00
|
|
|
$this->dbSettings = $db->getLocalSettings();
|
|
|
|
|
$this->values['wgEmergencyContact'] = $this->values['wgPasswordSender'];
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-02 01:26:26 +00:00
|
|
|
/**
|
|
|
|
|
* For $wgGroupPermissions, set a given ['group']['permission'] value.
|
2013-03-11 17:15:01 +00:00
|
|
|
* @param string $group Group name
|
|
|
|
|
* @param array $rightsArr An array of permissions, in the form of:
|
2016-08-26 11:36:58 +00:00
|
|
|
* [ 'right' => true, 'right2' => false ]
|
2011-06-02 01:26:26 +00:00
|
|
|
*/
|
|
|
|
|
public function setGroupRights( $group, $rightsArr ) {
|
|
|
|
|
$this->groupPermissions[$group] = $rightsArr;
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-29 18:25:10 +00:00
|
|
|
/**
|
|
|
|
|
* Returns the escaped version of a string of php code.
|
2010-12-16 11:20:39 +00:00
|
|
|
*
|
2014-04-19 11:55:27 +00:00
|
|
|
* @param string $string
|
2010-12-16 11:20:39 +00:00
|
|
|
*
|
2016-12-08 05:04:53 +00:00
|
|
|
* @return string|false
|
2010-07-29 18:25:10 +00:00
|
|
|
*/
|
2010-05-07 12:25:01 +00:00
|
|
|
public static function escapePhpString( $string ) {
|
|
|
|
|
if ( is_array( $string ) || is_object( $string ) ) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2010-12-16 11:20:39 +00:00
|
|
|
|
2010-07-21 10:56:35 +00:00
|
|
|
return strtr(
|
|
|
|
|
$string,
|
2016-02-17 09:09:32 +00:00
|
|
|
[
|
2010-05-07 12:25:01 +00:00
|
|
|
"\n" => "\\n",
|
|
|
|
|
"\r" => "\\r",
|
|
|
|
|
"\t" => "\\t",
|
|
|
|
|
"\\" => "\\\\",
|
|
|
|
|
"\$" => "\\\$",
|
|
|
|
|
"\"" => "\\\""
|
2016-02-17 09:09:32 +00:00
|
|
|
]
|
2010-07-21 10:56:35 +00:00
|
|
|
);
|
2010-05-07 12:25:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2010-06-29 02:46:11 +00:00
|
|
|
* Return the full text of the generated LocalSettings.php file,
|
2014-06-10 11:41:29 +00:00
|
|
|
* including the extensions and skins.
|
2010-12-16 11:20:39 +00:00
|
|
|
*
|
2014-04-19 11:55:27 +00:00
|
|
|
* @return string
|
2010-05-07 12:25:01 +00:00
|
|
|
*/
|
2010-06-29 02:46:11 +00:00
|
|
|
public function getText() {
|
2010-05-07 12:25:01 +00:00
|
|
|
$localSettings = $this->getDefaultText();
|
2010-12-16 11:20:39 +00:00
|
|
|
|
2014-06-10 11:41:29 +00:00
|
|
|
if ( count( $this->skins ) ) {
|
|
|
|
|
$localSettings .= "
|
|
|
|
|
# Enabled skins.
|
|
|
|
|
# The following skins were automatically enabled:\n";
|
|
|
|
|
|
|
|
|
|
foreach ( $this->skins as $skinName ) {
|
2015-04-01 07:07:44 +00:00
|
|
|
$localSettings .= $this->generateExtEnableLine( 'skins', $skinName );
|
2014-06-10 11:41:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$localSettings .= "\n";
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-20 21:11:46 +00:00
|
|
|
if ( count( $this->extensions ) ) {
|
2011-03-08 09:28:13 +00:00
|
|
|
$localSettings .= "
|
2015-09-04 13:28:43 +00:00
|
|
|
# Enabled extensions. Most of the extensions are enabled by adding
|
2020-01-27 03:21:24 +00:00
|
|
|
# wfLoadExtension( 'ExtensionName' );
|
2015-09-04 13:28:43 +00:00
|
|
|
# to LocalSettings.php. Check specific extension documentation for more details.
|
2011-03-08 09:28:13 +00:00
|
|
|
# The following extensions were automatically enabled:\n";
|
2010-12-16 11:20:39 +00:00
|
|
|
|
2014-01-12 23:59:44 +00:00
|
|
|
foreach ( $this->extensions as $extName ) {
|
2015-04-01 07:07:44 +00:00
|
|
|
$localSettings .= $this->generateExtEnableLine( 'extensions', $extName );
|
2010-05-07 12:25:01 +00:00
|
|
|
}
|
2014-06-10 11:41:29 +00:00
|
|
|
|
|
|
|
|
$localSettings .= "\n";
|
2010-05-07 12:25:01 +00:00
|
|
|
}
|
2010-06-29 02:46:11 +00:00
|
|
|
|
2014-06-10 11:41:29 +00:00
|
|
|
$localSettings .= "
|
|
|
|
|
# End of automatically generated settings.
|
2011-03-08 09:28:13 +00:00
|
|
|
# Add more configuration options below.\n\n";
|
|
|
|
|
|
2010-06-29 02:46:11 +00:00
|
|
|
return $localSettings;
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-01 07:01:41 +00:00
|
|
|
/**
|
2015-04-01 07:07:44 +00:00
|
|
|
* Generate the appropriate line to enable the given extension or skin
|
|
|
|
|
*
|
2015-04-01 07:01:41 +00:00
|
|
|
* @param string $dir Either "extensions" or "skins"
|
|
|
|
|
* @param string $name Name of extension/skin
|
2015-04-01 07:07:44 +00:00
|
|
|
* @throws InvalidArgumentException
|
2015-04-01 07:01:41 +00:00
|
|
|
* @return string
|
|
|
|
|
*/
|
2015-04-01 07:07:44 +00:00
|
|
|
private function generateExtEnableLine( $dir, $name ) {
|
|
|
|
|
if ( $dir === 'extensions' ) {
|
|
|
|
|
$jsonFile = 'extension.json';
|
|
|
|
|
$function = 'wfLoadExtension';
|
|
|
|
|
} elseif ( $dir === 'skins' ) {
|
|
|
|
|
$jsonFile = 'skin.json';
|
|
|
|
|
$function = 'wfLoadSkin';
|
|
|
|
|
} else {
|
2017-12-07 06:06:13 +00:00
|
|
|
throw new InvalidArgumentException( '$dir was not "extensions" or "skins"' );
|
2015-04-01 07:07:44 +00:00
|
|
|
}
|
|
|
|
|
|
2015-04-01 07:01:41 +00:00
|
|
|
$encName = self::escapePhpString( $name );
|
2015-04-01 07:07:44 +00:00
|
|
|
|
|
|
|
|
if ( file_exists( "{$this->IP}/$dir/$encName/$jsonFile" ) ) {
|
|
|
|
|
return "$function( '$encName' );\n";
|
|
|
|
|
} else {
|
|
|
|
|
return "require_once \"\$IP/$dir/$encName/$encName.php\";\n";
|
|
|
|
|
}
|
2015-04-01 07:01:41 +00:00
|
|
|
}
|
|
|
|
|
|
2010-11-02 17:11:35 +00:00
|
|
|
/**
|
|
|
|
|
* Write the generated LocalSettings to a file
|
|
|
|
|
*
|
2013-03-11 17:15:01 +00:00
|
|
|
* @param string $fileName Full path to filename to write to
|
2010-11-02 17:11:35 +00:00
|
|
|
*/
|
|
|
|
|
public function writeFile( $fileName ) {
|
2010-11-02 20:26:43 +00:00
|
|
|
file_put_contents( $fileName, $this->getText() );
|
2010-11-02 17:11:35 +00:00
|
|
|
}
|
|
|
|
|
|
2010-07-29 18:25:10 +00:00
|
|
|
/**
|
2014-04-19 11:55:27 +00:00
|
|
|
* @return string
|
2010-07-29 18:25:10 +00:00
|
|
|
*/
|
2012-06-12 16:18:44 +00:00
|
|
|
protected function buildMemcachedServerList() {
|
2010-05-07 12:25:01 +00:00
|
|
|
$servers = $this->values['_MemCachedServers'];
|
2010-12-16 11:20:39 +00:00
|
|
|
|
2013-04-20 21:11:46 +00:00
|
|
|
if ( !$servers ) {
|
2016-02-17 21:08:07 +00:00
|
|
|
return '[]';
|
2010-05-07 12:25:01 +00:00
|
|
|
} else {
|
2016-02-17 21:08:07 +00:00
|
|
|
$ret = '[ ';
|
2010-05-07 12:25:01 +00:00
|
|
|
$servers = explode( ',', $servers );
|
2010-12-16 11:20:39 +00:00
|
|
|
|
2013-04-20 21:11:46 +00:00
|
|
|
foreach ( $servers as $srv ) {
|
2010-05-07 12:25:01 +00:00
|
|
|
$srv = trim( $srv );
|
|
|
|
|
$ret .= "'$srv', ";
|
|
|
|
|
}
|
2010-12-16 11:20:39 +00:00
|
|
|
|
2016-02-17 21:08:07 +00:00
|
|
|
return rtrim( $ret, ', ' ) . ' ]';
|
2010-05-07 12:25:01 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-29 18:25:10 +00:00
|
|
|
/**
|
2014-04-19 11:55:27 +00:00
|
|
|
* @return string
|
2010-12-16 11:20:39 +00:00
|
|
|
*/
|
2012-06-12 16:18:44 +00:00
|
|
|
protected function getDefaultText() {
|
2013-04-20 21:11:46 +00:00
|
|
|
if ( !$this->values['wgImageMagickConvertCommand'] ) {
|
2010-05-07 12:25:01 +00:00
|
|
|
$this->values['wgImageMagickConvertCommand'] = '/usr/bin/convert';
|
|
|
|
|
$magic = '#';
|
|
|
|
|
} else {
|
|
|
|
|
$magic = '';
|
|
|
|
|
}
|
2010-12-16 11:20:39 +00:00
|
|
|
|
2013-04-20 21:11:46 +00:00
|
|
|
if ( !$this->values['wgShellLocale'] ) {
|
2015-07-28 16:17:40 +00:00
|
|
|
$this->values['wgShellLocale'] = 'C.UTF-8';
|
2010-05-07 12:25:01 +00:00
|
|
|
$locale = '#';
|
|
|
|
|
} else {
|
|
|
|
|
$locale = '';
|
|
|
|
|
}
|
2010-12-16 11:20:39 +00:00
|
|
|
|
2011-01-28 21:02:36 +00:00
|
|
|
$metaNamespace = '';
|
2013-04-20 21:11:46 +00:00
|
|
|
if ( $this->values['wgMetaNamespace'] !== $this->values['wgSitename'] ) {
|
2011-01-28 21:02:36 +00:00
|
|
|
$metaNamespace = "\$wgMetaNamespace = \"{$this->values['wgMetaNamespace']}\";\n";
|
|
|
|
|
}
|
2010-12-16 11:20:39 +00:00
|
|
|
|
2011-06-02 01:26:26 +00:00
|
|
|
$groupRights = '';
|
2013-12-06 14:51:01 +00:00
|
|
|
$noFollow = '';
|
2013-04-20 21:11:46 +00:00
|
|
|
if ( $this->groupPermissions ) {
|
2011-06-02 01:26:26 +00:00
|
|
|
$groupRights .= "# The following permissions were set based on your choice in the installer\n";
|
2013-04-20 21:11:46 +00:00
|
|
|
foreach ( $this->groupPermissions as $group => $rightArr ) {
|
2011-06-02 01:26:26 +00:00
|
|
|
$group = self::escapePhpString( $group );
|
2013-04-20 21:11:46 +00:00
|
|
|
foreach ( $rightArr as $right => $perm ) {
|
2011-06-02 01:26:26 +00:00
|
|
|
$right = self::escapePhpString( $right );
|
|
|
|
|
$groupRights .= "\$wgGroupPermissions['$group']['$right'] = " .
|
2011-06-06 20:01:48 +00:00
|
|
|
wfBoolToStr( $perm ) . ";\n";
|
2011-06-02 01:26:26 +00:00
|
|
|
}
|
|
|
|
|
}
|
2014-06-10 11:41:29 +00:00
|
|
|
$groupRights .= "\n";
|
|
|
|
|
|
2014-06-21 18:37:42 +00:00
|
|
|
if ( ( isset( $this->groupPermissions['*']['edit'] ) &&
|
|
|
|
|
$this->groupPermissions['*']['edit'] === false )
|
|
|
|
|
&& ( isset( $this->groupPermissions['*']['createaccount'] ) &&
|
|
|
|
|
$this->groupPermissions['*']['createaccount'] === false )
|
|
|
|
|
&& ( isset( $this->groupPermissions['*']['read'] ) &&
|
|
|
|
|
$this->groupPermissions['*']['read'] !== false )
|
2014-02-05 11:02:29 +00:00
|
|
|
) {
|
2014-06-10 11:41:29 +00:00
|
|
|
$noFollow = "# Set \$wgNoFollowLinks to true if you open up your wiki to editing by\n"
|
2013-11-16 04:49:29 +00:00
|
|
|
. "# the general public and wish to apply nofollow to external links as a\n"
|
|
|
|
|
. "# deterrent to spammers. Nofollow is not a comprehensive anti-spam solution\n"
|
|
|
|
|
. "# and open wikis will generally require other anti-spam measures; for more\n"
|
|
|
|
|
. "# information, see https://www.mediawiki.org/wiki/Manual:Combating_spam\n"
|
2014-06-10 11:41:29 +00:00
|
|
|
. "\$wgNoFollowLinks = false;\n\n";
|
2013-11-16 04:49:29 +00:00
|
|
|
}
|
2011-06-02 01:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
2013-11-23 18:41:20 +00:00
|
|
|
$serverSetting = "";
|
2013-10-06 19:41:18 +00:00
|
|
|
if ( array_key_exists( 'wgServer', $this->values ) && $this->values['wgServer'] !== null ) {
|
2013-11-23 18:41:20 +00:00
|
|
|
$serverSetting = "\n## The protocol and server name to use in fully-qualified URLs\n";
|
2015-10-23 20:09:04 +00:00
|
|
|
$serverSetting .= "\$wgServer = \"{$this->values['wgServer']}\";";
|
2013-10-06 19:41:18 +00:00
|
|
|
}
|
|
|
|
|
|
2015-10-23 21:29:38 +00:00
|
|
|
switch ( $this->values['_MainCacheType'] ) {
|
2010-05-07 12:25:01 +00:00
|
|
|
case 'anything':
|
|
|
|
|
case 'db':
|
|
|
|
|
case 'memcached':
|
|
|
|
|
case 'accel':
|
2015-10-23 21:29:38 +00:00
|
|
|
$cacheType = 'CACHE_' . strtoupper( $this->values['_MainCacheType'] );
|
2010-05-07 12:25:01 +00:00
|
|
|
break;
|
2017-03-15 19:26:55 +00:00
|
|
|
case 'none':
|
2010-05-07 12:25:01 +00:00
|
|
|
default:
|
2017-03-15 19:26:55 +00:00
|
|
|
$cacheType = 'CACHE_NONE';
|
2010-05-07 12:25:01 +00:00
|
|
|
}
|
2010-12-16 11:20:39 +00:00
|
|
|
|
2010-05-07 12:25:01 +00:00
|
|
|
$mcservers = $this->buildMemcachedServerList();
|
2018-04-02 22:27:18 +00:00
|
|
|
if ( file_exists( dirname( __DIR__ ) . '/PlatformSettings.php' ) ) {
|
|
|
|
|
$platformSettings = "\n## Include platform/distribution defaults";
|
|
|
|
|
$platformSettings .= "\nrequire_once \"\$IP/includes/PlatformSettings.php\";";
|
|
|
|
|
} else {
|
|
|
|
|
$platformSettings = '';
|
|
|
|
|
}
|
2013-10-08 11:43:42 +00:00
|
|
|
|
2020-02-25 01:33:18 +00:00
|
|
|
$version = MW_VERSION;
|
2010-05-07 12:25:01 +00:00
|
|
|
return "<?php
|
2020-02-25 01:33:18 +00:00
|
|
|
# This file was automatically generated by the MediaWiki {$version}
|
2010-05-07 12:25:01 +00:00
|
|
|
# installer. If you make manual changes, please keep track in case you
|
|
|
|
|
# need to recreate them later.
|
|
|
|
|
#
|
|
|
|
|
# See includes/DefaultSettings.php for all configurable settings
|
|
|
|
|
# and their default values, but don't forget to make changes in _this_
|
|
|
|
|
# file, not there.
|
|
|
|
|
#
|
|
|
|
|
# Further documentation for configuration settings may be found at:
|
2014-03-12 22:30:35 +00:00
|
|
|
# https://www.mediawiki.org/wiki/Manual:Configuration_settings
|
2010-05-07 12:25:01 +00:00
|
|
|
|
2010-12-06 15:00:56 +00:00
|
|
|
# Protect against web entry
|
|
|
|
|
if ( !defined( 'MEDIAWIKI' ) ) {
|
|
|
|
|
exit;
|
2010-05-07 12:25:01 +00:00
|
|
|
}
|
2018-04-02 22:27:18 +00:00
|
|
|
{$platformSettings}
|
2010-05-07 12:25:01 +00:00
|
|
|
|
|
|
|
|
## Uncomment this to disable output compression
|
|
|
|
|
# \$wgDisableOutputCompression = true;
|
|
|
|
|
|
2013-03-07 16:50:43 +00:00
|
|
|
\$wgSitename = \"{$this->values['wgSitename']}\";
|
2011-01-28 21:02:36 +00:00
|
|
|
{$metaNamespace}
|
2010-05-07 12:25:01 +00:00
|
|
|
## The URL base path to the directory containing the wiki;
|
|
|
|
|
## defaults for all runtime URL paths are based off of this.
|
2012-04-19 13:35:34 +00:00
|
|
|
## For more information on customizing the URLs
|
|
|
|
|
## (like /w/index.php/Page_title to /wiki/Page_title) please see:
|
2014-03-12 22:30:35 +00:00
|
|
|
## https://www.mediawiki.org/wiki/Manual:Short_URL
|
2013-03-07 16:50:43 +00:00
|
|
|
\$wgScriptPath = \"{$this->values['wgScriptPath']}\";
|
2013-11-23 18:41:20 +00:00
|
|
|
${serverSetting}
|
2010-05-07 12:25:01 +00:00
|
|
|
|
2015-10-23 12:40:00 +00:00
|
|
|
## The URL path to static resources (images, scripts, etc.)
|
|
|
|
|
\$wgResourceBasePath = \$wgScriptPath;
|
|
|
|
|
|
|
|
|
|
## The URL path to the logo. Make sure you change this from the default,
|
2010-05-07 12:25:01 +00:00
|
|
|
## or else you'll overwrite your logo when you upgrade!
|
2013-12-22 13:20:13 +00:00
|
|
|
\$wgLogo = \"{$this->values['wgLogo']}\";
|
2010-05-07 12:25:01 +00:00
|
|
|
|
|
|
|
|
## UPO means: this is also a user preference option
|
|
|
|
|
|
2013-03-07 16:50:43 +00:00
|
|
|
\$wgEnableEmail = {$this->values['wgEnableEmail']};
|
|
|
|
|
\$wgEnableUserEmail = {$this->values['wgEnableUserEmail']}; # UPO
|
2010-05-07 12:25:01 +00:00
|
|
|
|
|
|
|
|
\$wgEmergencyContact = \"{$this->values['wgEmergencyContact']}\";
|
2013-03-07 16:50:43 +00:00
|
|
|
\$wgPasswordSender = \"{$this->values['wgPasswordSender']}\";
|
2010-05-07 12:25:01 +00:00
|
|
|
|
2013-03-07 16:50:43 +00:00
|
|
|
\$wgEnotifUserTalk = {$this->values['wgEnotifUserTalk']}; # UPO
|
|
|
|
|
\$wgEnotifWatchlist = {$this->values['wgEnotifWatchlist']}; # UPO
|
2010-05-07 12:25:01 +00:00
|
|
|
\$wgEmailAuthentication = {$this->values['wgEmailAuthentication']};
|
|
|
|
|
|
|
|
|
|
## Database settings
|
2013-03-07 16:50:43 +00:00
|
|
|
\$wgDBtype = \"{$this->values['wgDBtype']}\";
|
|
|
|
|
\$wgDBserver = \"{$this->values['wgDBserver']}\";
|
|
|
|
|
\$wgDBname = \"{$this->values['wgDBname']}\";
|
|
|
|
|
\$wgDBuser = \"{$this->values['wgDBuser']}\";
|
|
|
|
|
\$wgDBpassword = \"{$this->values['wgDBpassword']}\";
|
2010-05-07 12:25:01 +00:00
|
|
|
|
|
|
|
|
{$this->dbSettings}
|
|
|
|
|
|
|
|
|
|
## Shared memory settings
|
2013-03-07 16:50:43 +00:00
|
|
|
\$wgMainCacheType = $cacheType;
|
2010-05-07 12:25:01 +00:00
|
|
|
\$wgMemCachedServers = $mcservers;
|
|
|
|
|
|
|
|
|
|
## To enable image uploads, make sure the 'images' directory
|
|
|
|
|
## is writable, then set this to true:
|
2013-03-07 16:50:43 +00:00
|
|
|
\$wgEnableUploads = {$this->values['wgEnableUploads']};
|
2010-05-07 12:25:01 +00:00
|
|
|
{$magic}\$wgUseImageMagick = true;
|
|
|
|
|
{$magic}\$wgImageMagickConvertCommand = \"{$this->values['wgImageMagickConvertCommand']}\";
|
|
|
|
|
|
2015-06-13 17:29:15 +00:00
|
|
|
# InstantCommons allows wiki to use images from https://commons.wikimedia.org
|
2013-03-07 16:50:43 +00:00
|
|
|
\$wgUseInstantCommons = {$this->values['wgUseInstantCommons']};
|
2010-07-10 12:29:15 +00:00
|
|
|
|
2016-06-30 09:29:10 +00:00
|
|
|
# Periodically send a pingback to https://www.mediawiki.org/ with basic data
|
|
|
|
|
# about this MediaWiki instance. The Wikimedia Foundation shares this data
|
|
|
|
|
# with MediaWiki developers to help guide future development efforts.
|
|
|
|
|
\$wgPingback = {$this->values['wgPingback']};
|
|
|
|
|
|
2010-05-07 12:25:01 +00:00
|
|
|
## If you use ImageMagick (or any other shell command) on a
|
|
|
|
|
## Linux server, this will need to be set to the name of an
|
|
|
|
|
## available UTF-8 locale
|
|
|
|
|
{$locale}\$wgShellLocale = \"{$this->values['wgShellLocale']}\";
|
|
|
|
|
|
|
|
|
|
## Set \$wgCacheDirectory to a writable directory on the web server
|
|
|
|
|
## to make your wiki go slightly faster. The directory should not
|
2019-01-27 09:15:42 +00:00
|
|
|
## be publicly accessible from the web.
|
2010-05-07 12:25:01 +00:00
|
|
|
#\$wgCacheDirectory = \"\$IP/cache\";
|
|
|
|
|
|
2016-01-29 05:19:58 +00:00
|
|
|
# Site language code, should be one of the list in ./languages/data/Names.php
|
2010-05-07 12:25:01 +00:00
|
|
|
\$wgLanguageCode = \"{$this->values['wgLanguageCode']}\";
|
|
|
|
|
|
|
|
|
|
\$wgSecretKey = \"{$this->values['wgSecretKey']}\";
|
|
|
|
|
|
2016-02-05 18:47:51 +00:00
|
|
|
# Changing this will log out all existing sessions.
|
|
|
|
|
\$wgAuthenticationTokenVersion = \"{$this->values['wgAuthenticationTokenVersion']}\";
|
|
|
|
|
|
2010-11-09 16:51:08 +00:00
|
|
|
# Site upgrade key. Must be set to a string (default provided) to turn on the
|
|
|
|
|
# web installer while LocalSettings.php is in place
|
* Made the web upgrade process more friendly. Instead of saying "access denied, go away" when the user has a normal LocalSettings.php file, generate a random $wgUpgradeKey and instruct the user to insert it into their LocalSettings.php. The subsequent file modification then authenticates the session and allows the upgrade.
* When an upgrade key is entered, or a supplied upgrade key is edited into LocalSettings.php by the upgrader, fetch database settings from LocalSettings.php and AdminSettings.php for use during the upgrade. This allows the DBConnect page to be skipped, making web upgrade almost as easy to use as CLI upgrade.
* Made LocalSettingsGenerator add $wgUpgradeKey in non-commented form, for easier subsequent upgrades.
* Converted the $wgUpgradeKey check to a normal in-sequence page, called ExistingWiki. This allows the removal of related special cases from WebInstaller. The code for WebInstaller_ExistingWiki is loosely based on WebInstaller_Locked.
* Added Status::replaceMessage(), to support informative DB connection error messages from the ExistingWiki page.
* In WebInstaller::getInfoBox(), call parse() with $lineStart=true, so that line-start syntax like bullet points can work.
* Reduced the length of the generated $wgUpgradeKey from 64 to 16. This is ample for what it does, and makes it fit on the screen and not overlap with the right sidebar when when displayed by WebInstaller_ExistingWiki.
* Added $wgUpgradeKey to DefaultSettings.php.
2010-12-09 08:24:54 +00:00
|
|
|
\$wgUpgradeKey = \"{$this->values['wgUpgradeKey']}\";
|
2010-11-09 16:51:08 +00:00
|
|
|
|
2010-05-07 12:25:01 +00:00
|
|
|
## For attaching licensing metadata to pages, and displaying an
|
|
|
|
|
## appropriate copyright notice / icon. GNU Free Documentation
|
|
|
|
|
## License and Creative Commons licenses are supported so far.
|
|
|
|
|
\$wgRightsPage = \"\"; # Set to the title of a wiki page that describes your license/copyright
|
2013-03-07 16:50:43 +00:00
|
|
|
\$wgRightsUrl = \"{$this->values['wgRightsUrl']}\";
|
2010-05-07 12:25:01 +00:00
|
|
|
\$wgRightsText = \"{$this->values['wgRightsText']}\";
|
|
|
|
|
\$wgRightsIcon = \"{$this->values['wgRightsIcon']}\";
|
|
|
|
|
|
2010-07-04 22:11:18 +00:00
|
|
|
# Path to the GNU diff3 utility. Used for conflict resolution.
|
2010-05-07 12:25:01 +00:00
|
|
|
\$wgDiff3 = \"{$this->values['wgDiff3']}\";
|
2011-05-05 11:52:23 +00:00
|
|
|
|
2014-06-10 11:41:29 +00:00
|
|
|
{$groupRights}{$noFollow}## Default skin: you can change the default skin. Use the internal symbolic
|
|
|
|
|
## names, ie 'vector', 'monobook':
|
|
|
|
|
\$wgDefaultSkin = \"{$this->values['wgDefaultSkin']}\";
|
|
|
|
|
";
|
2010-05-07 12:25:01 +00:00
|
|
|
}
|
2010-08-12 09:55:05 +00:00
|
|
|
}
|