Use MainConfigNames instead of string literals
Part 1, proof of concept. Hundreds of files left to go. These changes brought to you in large part by vim macros. Bug: T305805 Change-Id: I44789091e9f6394c800a11b29f22528c8dcacf71
This commit is contained in:
parent
0bdc2c0fc8
commit
747bc81ac0
47 changed files with 379 additions and 266 deletions
|
|
@ -25,6 +25,7 @@ use MediaWiki\Cache\LinkBatchFactory;
|
|||
use MediaWiki\CommentFormatter\CommentFormatter;
|
||||
use MediaWiki\HookContainer\HookContainer;
|
||||
use MediaWiki\Linker\LinkRenderer;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\ParamValidator\TypeDef\UserDef;
|
||||
use MediaWiki\Revision\RevisionAccessException;
|
||||
use MediaWiki\Revision\RevisionRecord;
|
||||
|
|
@ -128,22 +129,22 @@ class ApiFeedContributions extends ApiBase {
|
|||
$params = $this->extractRequestParams();
|
||||
|
||||
$config = $this->getConfig();
|
||||
if ( !$config->get( 'Feed' ) ) {
|
||||
if ( !$config->get( MainConfigNames::Feed ) ) {
|
||||
$this->dieWithError( 'feed-unavailable' );
|
||||
}
|
||||
|
||||
$feedClasses = $config->get( 'FeedClasses' );
|
||||
$feedClasses = $config->get( MainConfigNames::FeedClasses );
|
||||
if ( !isset( $feedClasses[$params['feedformat']] ) ) {
|
||||
$this->dieWithError( 'feed-invalid' );
|
||||
}
|
||||
|
||||
if ( $params['showsizediff'] && $this->getConfig()->get( 'MiserMode' ) ) {
|
||||
if ( $params['showsizediff'] && $this->getConfig()->get( MainConfigNames::MiserMode ) ) {
|
||||
$this->dieWithError( 'apierror-sizediffdisabled' );
|
||||
}
|
||||
|
||||
$msg = wfMessage( 'Contributions' )->inContentLanguage()->text();
|
||||
$feedTitle = $config->get( 'Sitename' ) . ' - ' . $msg .
|
||||
' [' . $config->get( 'LanguageCode' ) . ']';
|
||||
$feedTitle = $config->get( MainConfigNames::Sitename ) . ' - ' . $msg .
|
||||
' [' . $config->get( MainConfigNames::LanguageCode ) . ']';
|
||||
|
||||
$target = $params['user'];
|
||||
if ( ExternalUserNames::isExternal( $target ) ) {
|
||||
|
|
@ -190,7 +191,7 @@ class ApiFeedContributions extends ApiBase {
|
|||
$this->commentFormatter
|
||||
);
|
||||
|
||||
$feedLimit = $this->getConfig()->get( 'FeedLimit' );
|
||||
$feedLimit = $this->getConfig()->get( MainConfigNames::FeedLimit );
|
||||
if ( $pager->getLimit() > $feedLimit ) {
|
||||
$pager->setLimit( $feedLimit );
|
||||
}
|
||||
|
|
@ -292,7 +293,7 @@ class ApiFeedContributions extends ApiBase {
|
|||
}
|
||||
|
||||
public function getAllowedParams() {
|
||||
$feedFormatNames = array_keys( $this->getConfig()->get( 'FeedClasses' ) );
|
||||
$feedFormatNames = array_keys( $this->getConfig()->get( MainConfigNames::FeedClasses ) );
|
||||
|
||||
$ret = [
|
||||
'feedformat' => [
|
||||
|
|
@ -327,7 +328,7 @@ class ApiFeedContributions extends ApiBase {
|
|||
],
|
||||
];
|
||||
|
||||
if ( $this->getConfig()->get( 'MiserMode' ) ) {
|
||||
if ( $this->getConfig()->get( MainConfigNames::MiserMode ) ) {
|
||||
$ret['showsizediff'][ApiBase::PARAM_HELP_MSG] = 'api-help-param-disabled-in-miser-mode';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
use MediaWiki\MainConfigNames;
|
||||
|
||||
/**
|
||||
* This action allows users to get their watchlist items in RSS/Atom formats.
|
||||
* When executed, it performs a nested call to the API to get the needed data,
|
||||
|
|
@ -64,13 +66,13 @@ class ApiFeedWatchlist extends ApiBase {
|
|||
*/
|
||||
public function execute() {
|
||||
$config = $this->getConfig();
|
||||
$feedClasses = $config->get( 'FeedClasses' );
|
||||
$feedClasses = $config->get( MainConfigNames::FeedClasses );
|
||||
$params = [];
|
||||
$feedItems = [];
|
||||
try {
|
||||
$params = $this->extractRequestParams();
|
||||
|
||||
if ( !$config->get( 'Feed' ) ) {
|
||||
if ( !$config->get( MainConfigNames::Feed ) ) {
|
||||
$this->dieWithError( 'feed-unavailable' );
|
||||
}
|
||||
|
||||
|
|
@ -90,7 +92,7 @@ class ApiFeedWatchlist extends ApiBase {
|
|||
'wlprop' => 'title|user|comment|timestamp|ids|loginfo',
|
||||
'wldir' => 'older', // reverse order - from newest to oldest
|
||||
'wlend' => $endTime, // stop at this time
|
||||
'wllimit' => min( 50, $this->getConfig()->get( 'FeedLimit' ) )
|
||||
'wllimit' => min( 50, $this->getConfig()->get( MainConfigNames::FeedLimit ) )
|
||||
];
|
||||
|
||||
if ( $params['wlowner'] !== null ) {
|
||||
|
|
@ -138,8 +140,8 @@ class ApiFeedWatchlist extends ApiBase {
|
|||
|
||||
$msg = wfMessage( 'watchlist' )->inContentLanguage()->text();
|
||||
|
||||
$feedTitle = $this->getConfig()->get( 'Sitename' ) . ' - ' . $msg .
|
||||
' [' . $this->getConfig()->get( 'LanguageCode' ) . ']';
|
||||
$feedTitle = $this->getConfig()->get( MainConfigNames::Sitename ) . ' - ' . $msg .
|
||||
' [' . $this->getConfig()->get( MainConfigNames::LanguageCode ) . ']';
|
||||
$feedUrl = SpecialPage::getTitleFor( 'Watchlist' )->getFullURL();
|
||||
|
||||
$feed = new $feedClasses[$params['feedformat']] (
|
||||
|
|
@ -154,9 +156,9 @@ class ApiFeedWatchlist extends ApiBase {
|
|||
$this->getMain()->setCacheMaxAge( 0 );
|
||||
|
||||
// @todo FIXME: Localise brackets
|
||||
$feedTitle = $this->getConfig()->get( 'Sitename' ) . ' - Error - ' .
|
||||
$feedTitle = $this->getConfig()->get( MainConfigNames::Sitename ) . ' - Error - ' .
|
||||
wfMessage( 'watchlist' )->inContentLanguage()->text() .
|
||||
' [' . $this->getConfig()->get( 'LanguageCode' ) . ']';
|
||||
' [' . $this->getConfig()->get( MainConfigNames::LanguageCode ) . ']';
|
||||
$feedUrl = SpecialPage::getTitleFor( 'Watchlist' )->getFullURL();
|
||||
|
||||
$feedFormat = $params['feedformat'] ?? 'rss';
|
||||
|
|
@ -253,7 +255,7 @@ class ApiFeedWatchlist extends ApiBase {
|
|||
}
|
||||
|
||||
public function getAllowedParams( $flags = 0 ) {
|
||||
$feedFormatNames = array_keys( $this->getConfig()->get( 'FeedClasses' ) );
|
||||
$feedFormatNames = array_keys( $this->getConfig()->get( MainConfigNames::FeedClasses ) );
|
||||
$ret = [
|
||||
'feedformat' => [
|
||||
ApiBase::PARAM_DFLT => 'rss',
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ use MediaWiki\Interwiki\InterwikiLookup;
|
|||
use MediaWiki\Languages\LanguageConverterFactory;
|
||||
use MediaWiki\Languages\LanguageFactory;
|
||||
use MediaWiki\Languages\LanguageNameUtils;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\SpecialPage\SpecialPageFactory;
|
||||
use MediaWiki\User\UserGroupManager;
|
||||
use MediaWiki\User\UserOptionsLookup;
|
||||
|
|
@ -231,8 +232,8 @@ class ApiQuerySiteinfo extends ApiQueryBase {
|
|||
$mainPage = Title::newMainPage();
|
||||
$data['mainpage'] = $mainPage->getPrefixedText();
|
||||
$data['base'] = wfExpandUrl( $mainPage->getFullURL(), PROTO_CURRENT );
|
||||
$data['sitename'] = $config->get( 'Sitename' );
|
||||
$data['mainpageisdomainroot'] = (bool)$config->get( 'MainPageIsDomainRoot' );
|
||||
$data['sitename'] = $config->get( MainConfigNames::Sitename );
|
||||
$data['mainpageisdomainroot'] = (bool)$config->get( MainConfigNames::MainPageIsDomainRoot );
|
||||
|
||||
// A logo can either be a relative or an absolute path
|
||||
// make sure we always return an absolute path
|
||||
|
|
@ -243,14 +244,15 @@ class ApiQuerySiteinfo extends ApiQueryBase {
|
|||
|
||||
$data['phpversion'] = PHP_VERSION;
|
||||
$data['phpsapi'] = PHP_SAPI;
|
||||
$data['dbtype'] = $config->get( 'DBtype' );
|
||||
$data['dbtype'] = $config->get( MainConfigNames::DBtype );
|
||||
$data['dbversion'] = $this->getDB()->getServerVersion();
|
||||
|
||||
$allowFrom = [ '' ];
|
||||
$allowException = true;
|
||||
if ( !$config->get( 'AllowExternalImages' ) ) {
|
||||
$data['imagewhitelistenabled'] = (bool)$config->get( 'EnableImageWhitelist' );
|
||||
$allowFrom = $config->get( 'AllowExternalImagesFrom' );
|
||||
if ( !$config->get( MainConfigNames::AllowExternalImages ) ) {
|
||||
$data['imagewhitelistenabled'] =
|
||||
(bool)$config->get( MainConfigNames::EnableImageWhitelist );
|
||||
$allowFrom = $config->get( MainConfigNames::AllowExternalImagesFrom );
|
||||
$allowException = !empty( $allowFrom );
|
||||
}
|
||||
if ( $allowException ) {
|
||||
|
|
@ -278,13 +280,13 @@ class ApiQuerySiteinfo extends ApiQueryBase {
|
|||
$data['linktrail'] = $linktrail ?: '';
|
||||
|
||||
$data['legaltitlechars'] = Title::legalChars();
|
||||
$data['invalidusernamechars'] = $config->get( 'InvalidUsernameCharacters' );
|
||||
$data['invalidusernamechars'] = $config->get( MainConfigNames::InvalidUsernameCharacters );
|
||||
|
||||
$data['allunicodefixes'] = (bool)$config->get( 'AllUnicodeFixes' );
|
||||
$data['allunicodefixes'] = (bool)$config->get( MainConfigNames::AllUnicodeFixes );
|
||||
$data['fixarabicunicode'] = true; // Config removed in 1.35, always true
|
||||
$data['fixmalayalamunicode'] = true; // Config removed in 1.35, always true
|
||||
|
||||
$baseDir = $this->getConfig()->get( 'BaseDirectory' );
|
||||
$baseDir = $this->getConfig()->get( MainConfigNames::BaseDirectory );
|
||||
$git = SpecialVersion::getGitHeadSha1( $baseDir );
|
||||
if ( $git ) {
|
||||
$data['git-hash'] = $git;
|
||||
|
|
@ -293,8 +295,9 @@ class ApiQuerySiteinfo extends ApiQueryBase {
|
|||
}
|
||||
|
||||
// 'case-insensitive' option is reserved for future
|
||||
$data['case'] = $config->get( 'CapitalLinks' ) ? 'first-letter' : 'case-sensitive';
|
||||
$data['lang'] = $config->get( 'LanguageCode' );
|
||||
$data['case'] =
|
||||
$config->get( MainConfigNames::CapitalLinks ) ? 'first-letter' : 'case-sensitive';
|
||||
$data['lang'] = $config->get( MainConfigNames::LanguageCode );
|
||||
|
||||
$fallbacks = [];
|
||||
foreach ( $this->contentLanguage->getFallbackLanguages() as $code ) {
|
||||
|
|
@ -324,54 +327,55 @@ class ApiQuerySiteinfo extends ApiQueryBase {
|
|||
}
|
||||
$data['writeapi'] = true; // Deprecated since MW 1.32
|
||||
|
||||
$data['maxarticlesize'] = $config->get( 'MaxArticleSize' ) * 1024;
|
||||
$data['maxarticlesize'] = $config->get( MainConfigNames::MaxArticleSize ) * 1024;
|
||||
|
||||
$tz = $config->get( 'Localtimezone' );
|
||||
$offset = $config->get( 'LocalTZoffset' );
|
||||
$tz = $config->get( MainConfigNames::Localtimezone );
|
||||
$offset = $config->get( MainConfigNames::LocalTZoffset );
|
||||
$data['timezone'] = $tz;
|
||||
$data['timeoffset'] = (int)$offset;
|
||||
$data['articlepath'] = $config->get( 'ArticlePath' );
|
||||
$data['scriptpath'] = $config->get( 'ScriptPath' );
|
||||
$data['script'] = $config->get( 'Script' );
|
||||
$data['variantarticlepath'] = $config->get( 'VariantArticlePath' );
|
||||
$data['articlepath'] = $config->get( MainConfigNames::ArticlePath );
|
||||
$data['scriptpath'] = $config->get( MainConfigNames::ScriptPath );
|
||||
$data['script'] = $config->get( MainConfigNames::Script );
|
||||
$data['variantarticlepath'] = $config->get( MainConfigNames::VariantArticlePath );
|
||||
$data[ApiResult::META_BC_BOOLS][] = 'variantarticlepath';
|
||||
$data['server'] = $config->get( 'Server' );
|
||||
$data['servername'] = $config->get( 'ServerName' );
|
||||
$data['server'] = $config->get( MainConfigNames::Server );
|
||||
$data['servername'] = $config->get( MainConfigNames::ServerName );
|
||||
$data['wikiid'] = WikiMap::getCurrentWikiId();
|
||||
$data['time'] = wfTimestamp( TS_ISO_8601, time() );
|
||||
|
||||
$data['misermode'] = (bool)$config->get( 'MiserMode' );
|
||||
$data['misermode'] = (bool)$config->get( MainConfigNames::MiserMode );
|
||||
|
||||
$data['uploadsenabled'] = UploadBase::isEnabled();
|
||||
$data['maxuploadsize'] = UploadBase::getMaxUploadSize();
|
||||
$data['minuploadchunksize'] = ApiUpload::getMinUploadChunkSize( $config );
|
||||
|
||||
$data['galleryoptions'] = $config->get( 'GalleryOptions' );
|
||||
$data['galleryoptions'] = $config->get( MainConfigNames::GalleryOptions );
|
||||
|
||||
$data['thumblimits'] = $config->get( 'ThumbLimits' );
|
||||
$data['thumblimits'] = $config->get( MainConfigNames::ThumbLimits );
|
||||
ApiResult::setArrayType( $data['thumblimits'], 'BCassoc' );
|
||||
ApiResult::setIndexedTagName( $data['thumblimits'], 'limit' );
|
||||
$data['imagelimits'] = [];
|
||||
ApiResult::setArrayType( $data['imagelimits'], 'BCassoc' );
|
||||
ApiResult::setIndexedTagName( $data['imagelimits'], 'limit' );
|
||||
foreach ( $config->get( 'ImageLimits' ) as $k => $limit ) {
|
||||
foreach ( $config->get( MainConfigNames::ImageLimits ) as $k => $limit ) {
|
||||
$data['imagelimits'][$k] = [ 'width' => $limit[0], 'height' => $limit[1] ];
|
||||
}
|
||||
|
||||
$favicon = $config->get( 'Favicon' );
|
||||
$favicon = $config->get( MainConfigNames::Favicon );
|
||||
if ( $favicon ) {
|
||||
// Expand any local path to full URL to improve API usability (T77093).
|
||||
$data['favicon'] = wfExpandUrl( $favicon );
|
||||
}
|
||||
|
||||
$data['centralidlookupprovider'] = $config->get( 'CentralIdLookupProvider' );
|
||||
$providerIds = array_keys( $config->get( 'CentralIdLookupProviders' ) );
|
||||
$data['centralidlookupprovider'] =
|
||||
$config->get( MainConfigNames::CentralIdLookupProvider );
|
||||
$providerIds = array_keys( $config->get( MainConfigNames::CentralIdLookupProviders ) );
|
||||
$data['allcentralidlookupproviders'] = $providerIds;
|
||||
|
||||
$data['interwikimagic'] = (bool)$config->get( 'InterwikiMagic' );
|
||||
$data['magiclinks'] = $config->get( 'EnableMagicLinks' );
|
||||
$data['interwikimagic'] = (bool)$config->get( MainConfigNames::InterwikiMagic );
|
||||
$data['magiclinks'] = $config->get( MainConfigNames::EnableMagicLinks );
|
||||
|
||||
$data['categorycollation'] = $config->get( 'CategoryCollation' );
|
||||
$data['categorycollation'] = $config->get( MainConfigNames::CategoryCollation );
|
||||
|
||||
$this->getHookRunner()->onAPIQuerySiteInfoGeneralInfo( $this, $data );
|
||||
|
||||
|
|
@ -379,7 +383,7 @@ class ApiQuerySiteinfo extends ApiQueryBase {
|
|||
}
|
||||
|
||||
protected function appendNamespaces( $property ) {
|
||||
$nsProtection = $this->getConfig()->get( 'NamespaceProtection' );
|
||||
$nsProtection = $this->getConfig()->get( MainConfigNames::NamespaceProtection );
|
||||
|
||||
$data = [
|
||||
ApiResult::META_TYPE => 'assoc',
|
||||
|
|
@ -494,15 +498,15 @@ class ApiQuerySiteinfo extends ApiQueryBase {
|
|||
|
||||
$params = $this->extractRequestParams();
|
||||
$langCode = $params['inlanguagecode'] ?? '';
|
||||
$interwikiMagic = $this->getConfig()->get( 'InterwikiMagic' );
|
||||
$interwikiMagic = $this->getConfig()->get( MainConfigNames::InterwikiMagic );
|
||||
|
||||
if ( $interwikiMagic ) {
|
||||
$langNames = $this->languageNameUtils->getLanguageNames( $langCode );
|
||||
}
|
||||
|
||||
$getPrefixes = $this->interwikiLookup->getAllPrefixes( $local );
|
||||
$extraLangPrefixes = $this->getConfig()->get( 'ExtraInterlanguageLinkPrefixes' );
|
||||
$localInterwikis = $this->getConfig()->get( 'LocalInterwikis' );
|
||||
$extraLangPrefixes = $this->getConfig()->get( MainConfigNames::ExtraInterlanguageLinkPrefixes );
|
||||
$localInterwikis = $this->getConfig()->get( MainConfigNames::LocalInterwikis );
|
||||
$data = [];
|
||||
|
||||
foreach ( $getPrefixes as $row ) {
|
||||
|
|
@ -555,7 +559,7 @@ class ApiQuerySiteinfo extends ApiQueryBase {
|
|||
|
||||
protected function appendDbReplLagInfo( $property, $includeAll ) {
|
||||
$data = [];
|
||||
$showHostnames = $this->getConfig()->get( 'ShowHostnames' );
|
||||
$showHostnames = $this->getConfig()->get( MainConfigNames::ShowHostnames );
|
||||
if ( $includeAll ) {
|
||||
if ( !$showHostnames ) {
|
||||
$this->dieWithError( 'apierror-siteinfo-includealldenied', 'includeAllDenied' );
|
||||
|
|
@ -605,14 +609,14 @@ class ApiQuerySiteinfo extends ApiQueryBase {
|
|||
$data = [];
|
||||
$result = $this->getResult();
|
||||
$allGroups = array_values( $this->userGroupManager->listAllGroups() );
|
||||
foreach ( $config->get( 'GroupPermissions' ) as $group => $permissions ) {
|
||||
foreach ( $config->get( MainConfigNames::GroupPermissions ) as $group => $permissions ) {
|
||||
$arr = [
|
||||
'name' => $group,
|
||||
'rights' => array_keys( $permissions, true ),
|
||||
];
|
||||
|
||||
if ( $numberInGroup ) {
|
||||
$autopromote = $config->get( 'Autopromote' );
|
||||
$autopromote = $config->get( MainConfigNames::Autopromote );
|
||||
|
||||
if ( $group == 'user' ) {
|
||||
$arr['number'] = SiteStats::users();
|
||||
|
|
@ -623,10 +627,10 @@ class ApiQuerySiteinfo extends ApiQueryBase {
|
|||
}
|
||||
|
||||
$groupArr = [
|
||||
'add' => $config->get( 'AddGroups' ),
|
||||
'remove' => $config->get( 'RemoveGroups' ),
|
||||
'add-self' => $config->get( 'GroupsAddToSelf' ),
|
||||
'remove-self' => $config->get( 'GroupsRemoveFromSelf' )
|
||||
'add' => $config->get( MainConfigNames::AddGroups ),
|
||||
'remove' => $config->get( MainConfigNames::RemoveGroups ),
|
||||
'add-self' => $config->get( MainConfigNames::GroupsAddToSelf ),
|
||||
'remove-self' => $config->get( MainConfigNames::GroupsRemoveFromSelf )
|
||||
];
|
||||
|
||||
foreach ( $groupArr as $type => $rights ) {
|
||||
|
|
@ -655,7 +659,9 @@ class ApiQuerySiteinfo extends ApiQueryBase {
|
|||
|
||||
protected function appendFileExtensions( $property ) {
|
||||
$data = [];
|
||||
foreach ( array_unique( $this->getConfig()->get( 'FileExtensions' ) ) as $ext ) {
|
||||
foreach (
|
||||
array_unique( $this->getConfig()->get( MainConfigNames::FileExtensions ) ) as $ext
|
||||
) {
|
||||
$data[] = [ 'ext' => $ext ];
|
||||
}
|
||||
ApiResult::setIndexedTagName( $data, 'fe' );
|
||||
|
|
@ -664,7 +670,7 @@ class ApiQuerySiteinfo extends ApiQueryBase {
|
|||
}
|
||||
|
||||
protected function appendInstalledLibraries( $property ) {
|
||||
$baseDir = $this->getConfig()->get( 'BaseDirectory' );
|
||||
$baseDir = $this->getConfig()->get( MainConfigNames::BaseDirectory );
|
||||
$path = "$baseDir/vendor/composer/installed.json";
|
||||
if ( !file_exists( $path ) ) {
|
||||
return true;
|
||||
|
|
@ -767,16 +773,16 @@ class ApiQuerySiteinfo extends ApiQueryBase {
|
|||
|
||||
protected function appendRightsInfo( $property ) {
|
||||
$config = $this->getConfig();
|
||||
$rightsPage = $config->get( 'RightsPage' );
|
||||
$rightsPage = $config->get( MainConfigNames::RightsPage );
|
||||
// The default value is null, but the installer sets it to empty string
|
||||
if ( strlen( $rightsPage ) ) {
|
||||
$title = Title::newFromText( $rightsPage );
|
||||
$url = wfExpandUrl( $title->getLinkURL(), PROTO_CURRENT );
|
||||
} else {
|
||||
$title = false;
|
||||
$url = $config->get( 'RightsUrl' );
|
||||
$url = $config->get( MainConfigNames::RightsUrl );
|
||||
}
|
||||
$text = $config->get( 'RightsText' );
|
||||
$text = $config->get( MainConfigNames::RightsText );
|
||||
if ( $title && !strlen( $text ) ) {
|
||||
$text = $title->getPrefixedText();
|
||||
}
|
||||
|
|
@ -792,10 +798,10 @@ class ApiQuerySiteinfo extends ApiQueryBase {
|
|||
protected function appendRestrictions( $property ) {
|
||||
$config = $this->getConfig();
|
||||
$data = [
|
||||
'types' => $config->get( 'RestrictionTypes' ),
|
||||
'levels' => $config->get( 'RestrictionLevels' ),
|
||||
'cascadinglevels' => $config->get( 'CascadingRestrictionLevels' ),
|
||||
'semiprotectedlevels' => $config->get( 'SemiprotectedRestrictionLevels' ),
|
||||
'types' => $config->get( MainConfigNames::RestrictionTypes ),
|
||||
'levels' => $config->get( MainConfigNames::RestrictionLevels ),
|
||||
'cascadinglevels' => $config->get( MainConfigNames::CascadingRestrictionLevels ),
|
||||
'semiprotectedlevels' => $config->get( MainConfigNames::SemiprotectedRestrictionLevels ),
|
||||
];
|
||||
|
||||
ApiResult::setArrayType( $data['types'], 'BCarray' );
|
||||
|
|
@ -937,7 +943,7 @@ class ApiQuerySiteinfo extends ApiQueryBase {
|
|||
|
||||
public function appendProtocols( $property ) {
|
||||
// Make a copy of the global so we don't try to set the _element key of it - T47130
|
||||
$protocols = array_values( $this->getConfig()->get( 'UrlProtocols' ) );
|
||||
$protocols = array_values( $this->getConfig()->get( MainConfigNames::UrlProtocols ) );
|
||||
ApiResult::setArrayType( $protocols, 'BCarray' );
|
||||
ApiResult::setIndexedTagName( $protocols, 'p' );
|
||||
|
||||
|
|
@ -951,12 +957,12 @@ class ApiQuerySiteinfo extends ApiQueryBase {
|
|||
}
|
||||
|
||||
public function appendUploadDialog( $property ) {
|
||||
$config = $this->getConfig()->get( 'UploadDialog' );
|
||||
$config = $this->getConfig()->get( MainConfigNames::UploadDialog );
|
||||
return $this->getResult()->addValue( 'query', $property, $config );
|
||||
}
|
||||
|
||||
public function appendSubscribedHooks( $property ) {
|
||||
$hooks = $this->getConfig()->get( 'Hooks' );
|
||||
$hooks = $this->getConfig()->get( MainConfigNames::Hooks );
|
||||
$myWgHooks = $hooks;
|
||||
ksort( $myWgHooks );
|
||||
|
||||
|
|
@ -980,7 +986,7 @@ class ApiQuerySiteinfo extends ApiQueryBase {
|
|||
public function getCacheMode( $params ) {
|
||||
// Messages for $wgExtraInterlanguageLinkPrefixes depend on user language
|
||||
if (
|
||||
count( $this->getConfig()->get( 'ExtraInterlanguageLinkPrefixes' ) ) &&
|
||||
count( $this->getConfig()->get( MainConfigNames::ExtraInterlanguageLinkPrefixes ) ) &&
|
||||
$params['prop'] !== null &&
|
||||
in_array( 'interwikimap', $params['prop'] )
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
namespace MediaWiki\Auth;
|
||||
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use StatusValue;
|
||||
|
||||
|
|
@ -48,7 +49,7 @@ class CheckBlocksSecondaryAuthenticationProvider extends AbstractSecondaryAuthen
|
|||
|
||||
protected function postInitSetup() {
|
||||
if ( $this->blockDisablesLogin === null ) {
|
||||
$this->blockDisablesLogin = $this->config->get( 'BlockDisablesLogin' );
|
||||
$this->blockDisablesLogin = $this->config->get( MainConfigNames::BlockDisablesLogin );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
namespace MediaWiki\Auth;
|
||||
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
|
|
@ -72,8 +73,8 @@ class TemporaryPasswordAuthenticationRequest extends AuthenticationRequest {
|
|||
$config = MediaWikiServices::getInstance()->getMainConfig();
|
||||
|
||||
// get the min password length
|
||||
$minLength = $config->get( 'MinimalPasswordLength' );
|
||||
$policy = $config->get( 'PasswordPolicy' );
|
||||
$minLength = $config->get( MainConfigNames::MinimalPasswordLength );
|
||||
$policy = $config->get( MainConfigNames::PasswordPolicy );
|
||||
foreach ( $policy['policies'] as $p ) {
|
||||
foreach ( [ 'MinimalPasswordLength', 'MinimumPasswordLengthToLogin' ] as $check ) {
|
||||
$minLength = max( $minLength, $p[$check]['value'] ?? $p[$check] ?? 0 );
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
namespace MediaWiki\Auth;
|
||||
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\User\UserRigorOptions;
|
||||
use SpecialPage;
|
||||
|
|
@ -85,16 +86,18 @@ class TemporaryPasswordPrimaryAuthenticationProvider
|
|||
|
||||
protected function postInitSetup() {
|
||||
if ( $this->emailEnabled === null ) {
|
||||
$this->emailEnabled = $this->config->get( 'EnableEmail' );
|
||||
$this->emailEnabled = $this->config->get( MainConfigNames::EnableEmail );
|
||||
}
|
||||
if ( $this->newPasswordExpiry === null ) {
|
||||
$this->newPasswordExpiry = $this->config->get( 'NewPasswordExpiry' );
|
||||
$this->newPasswordExpiry = $this->config->get( MainConfigNames::NewPasswordExpiry );
|
||||
}
|
||||
if ( $this->passwordReminderResendTime === null ) {
|
||||
$this->passwordReminderResendTime = $this->config->get( 'PasswordReminderResendTime' );
|
||||
$this->passwordReminderResendTime =
|
||||
$this->config->get( MainConfigNames::PasswordReminderResendTime );
|
||||
}
|
||||
if ( $this->allowRequiringEmail === null ) {
|
||||
$this->allowRequiringEmail = $this->config->get( 'AllowRequiringEmailForResets' );
|
||||
$this->allowRequiringEmail =
|
||||
$this->config->get( MainConfigNames::AllowRequiringEmailForResets );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
namespace MediaWiki\Auth;
|
||||
|
||||
use BagOStuff;
|
||||
use MediaWiki\MainConfigNames;
|
||||
|
||||
/**
|
||||
* A pre-authentication provider to throttle authentication actions.
|
||||
|
|
@ -61,7 +62,7 @@ class ThrottlePreAuthenticationProvider extends AbstractPreAuthenticationProvide
|
|||
}
|
||||
|
||||
protected function postInitSetup() {
|
||||
$accountCreationThrottle = $this->config->get( 'AccountCreationThrottle' );
|
||||
$accountCreationThrottle = $this->config->get( MainConfigNames::AccountCreationThrottle );
|
||||
// Handle old $wgAccountCreationThrottle format (number of attempts per 24 hours)
|
||||
if ( !is_array( $accountCreationThrottle ) ) {
|
||||
$accountCreationThrottle = [ [
|
||||
|
|
@ -74,7 +75,8 @@ class ThrottlePreAuthenticationProvider extends AbstractPreAuthenticationProvide
|
|||
$this->throttleSettings += [
|
||||
// @codeCoverageIgnoreEnd
|
||||
'accountCreationThrottle' => $accountCreationThrottle,
|
||||
'passwordAttemptThrottle' => $this->config->get( 'PasswordAttemptThrottle' ),
|
||||
'passwordAttemptThrottle' =>
|
||||
$this->config->get( MainConfigNames::PasswordAttemptThrottle ),
|
||||
];
|
||||
|
||||
if ( !empty( $this->throttleSettings['accountCreationThrottle'] ) ) {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ namespace MediaWiki\Auth;
|
|||
|
||||
use BagOStuff;
|
||||
use MediaWiki\Logger\LoggerFactory;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use Psr\Log\LoggerAwareInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
|
@ -70,7 +71,7 @@ class Throttler implements LoggerAwareInterface {
|
|||
|
||||
if ( $conditions === null ) {
|
||||
$config = MediaWikiServices::getInstance()->getMainConfig();
|
||||
$conditions = $config->get( 'PasswordAttemptThrottle' );
|
||||
$conditions = $config->get( MainConfigNames::PasswordAttemptThrottle );
|
||||
$params += [
|
||||
'type' => 'password',
|
||||
'cache' => \ObjectCache::getLocalClusterInstance(),
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
namespace MediaWiki\Auth;
|
||||
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use StatusValue;
|
||||
use User;
|
||||
|
|
@ -60,11 +61,11 @@ class UserDataAuthenticationRequest extends AuthenticationRequest {
|
|||
],
|
||||
];
|
||||
|
||||
if ( !$config->get( 'EnableEmail' ) ) {
|
||||
if ( !$config->get( MainConfigNames::EnableEmail ) ) {
|
||||
unset( $ret['email'] );
|
||||
}
|
||||
|
||||
if ( in_array( 'realname', $config->get( 'HiddenPrefs' ), true ) ) {
|
||||
if ( in_array( 'realname', $config->get( MainConfigNames::HiddenPrefs ), true ) ) {
|
||||
unset( $ret['realname'] );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Revision\RevisionRecord;
|
||||
use Wikimedia\Rdbms\IResultWrapper;
|
||||
|
|
@ -49,9 +50,9 @@ class ChangesFeed {
|
|||
*/
|
||||
public function getFeedObject( $title, $description, $url ) {
|
||||
$mainConfig = MediaWikiServices::getInstance()->getMainConfig();
|
||||
$sitename = $mainConfig->get( 'Sitename' );
|
||||
$languageCode = $mainConfig->get( 'LanguageCode' );
|
||||
$feedClasses = $mainConfig->get( 'FeedClasses' );
|
||||
$sitename = $mainConfig->get( MainConfigNames::Sitename );
|
||||
$languageCode = $mainConfig->get( MainConfigNames::LanguageCode );
|
||||
$feedClasses = $mainConfig->get( MainConfigNames::FeedClasses );
|
||||
if ( !isset( $feedClasses[$this->format] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
*/
|
||||
|
||||
use MediaWiki\HookContainer\HookRunner;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Permissions\Authority;
|
||||
use MediaWiki\Storage\NameTableAccessException;
|
||||
|
|
@ -143,7 +144,8 @@ class ChangeTags {
|
|||
* @return array Array of all defined/enabled tags.
|
||||
*/
|
||||
public static function getSoftwareTags( $all = false ) {
|
||||
$coreTags = MediaWikiServices::getInstance()->getMainConfig()->get( 'SoftwareTags' );
|
||||
$coreTags = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::SoftwareTags );
|
||||
$softwareTags = [];
|
||||
|
||||
if ( !is_array( $coreTags ) ) {
|
||||
|
|
@ -893,7 +895,8 @@ class ChangeTags {
|
|||
public static function modifyDisplayQuery( &$tables, &$fields, &$conds,
|
||||
&$join_conds, &$options, $filter_tag = '', bool $exclude = false
|
||||
) {
|
||||
$useTagFilter = MediaWikiServices::getInstance()->getMainConfig()->get( 'UseTagFilter' );
|
||||
$useTagFilter = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::UseTagFilter );
|
||||
|
||||
// Normalize to arrays
|
||||
$tables = (array)$tables;
|
||||
|
|
@ -1058,7 +1061,8 @@ class ChangeTags {
|
|||
}
|
||||
|
||||
$config = $context->getConfig();
|
||||
if ( !$config->get( 'UseTagFilter' ) || !count( self::listDefinedTags() ) ) {
|
||||
if ( !$config->get( MainConfigNames::UseTagFilter ) ||
|
||||
!count( self::listDefinedTags() ) ) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
|
||||
use MediaWiki\HookContainer\HookRunner;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Revision\RevisionRecord;
|
||||
use MediaWiki\Revision\RevisionStore;
|
||||
|
|
@ -163,7 +164,8 @@ class XmlDumpWriter {
|
|||
* @return string
|
||||
*/
|
||||
private function sitename() {
|
||||
$sitename = MediaWikiServices::getInstance()->getMainConfig()->get( 'Sitename' );
|
||||
$sitename = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::Sitename );
|
||||
return Xml::element( 'sitename', [], $sitename );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
*/
|
||||
|
||||
use MediaWiki\Linker\LinkTarget;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Page\PageIdentity;
|
||||
use MediaWiki\Permissions\Authority;
|
||||
|
|
@ -1840,7 +1841,7 @@ class FileRepo {
|
|||
* @return string
|
||||
*/
|
||||
public function getDisplayName() {
|
||||
$sitename = MediaWikiServices::getInstance()->getMainConfig()->get( 'Sitename' );
|
||||
$sitename = MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::Sitename );
|
||||
|
||||
if ( $this->isLocal() ) {
|
||||
return $sitename;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
|
|
@ -124,7 +125,8 @@ class Http {
|
|||
public static function getProxy() {
|
||||
wfDeprecated( __METHOD__, '1.34' );
|
||||
|
||||
$httpProxy = MediaWikiServices::getInstance()->getMainConfig()->get( 'HTTPProxy' );
|
||||
$httpProxy = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::HTTPProxy );
|
||||
return (string)$httpProxy;
|
||||
}
|
||||
|
||||
|
|
@ -137,7 +139,8 @@ class Http {
|
|||
*/
|
||||
public static function createMultiClient( array $options = [] ) {
|
||||
wfDeprecated( __METHOD__, '1.34' );
|
||||
$httpProxy = MediaWikiServices::getInstance()->getMainConfig()->get( 'HTTPProxy' );
|
||||
$httpProxy = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::HTTPProxy );
|
||||
return MediaWikiServices::getInstance()->getHttpRequestFactory()
|
||||
->createMultiClient( $options + [ 'proxy' => $httpProxy ] );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use Psr\Log\LoggerAwareInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
|
@ -115,7 +116,8 @@ abstract class MWHttpRequest implements LoggerAwareInterface {
|
|||
// The timeout should always be set by HttpRequestFactory, so this
|
||||
// should only happen if the class was directly constructed
|
||||
wfDeprecated( __METHOD__ . ' without the timeout option', '1.35' );
|
||||
$httpTimeout = MediaWikiServices::getInstance()->getMainConfig()->get( 'HTTPTimeout' );
|
||||
$httpTimeout = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::HTTPTimeout );
|
||||
$this->timeout = $httpTimeout;
|
||||
}
|
||||
if ( isset( $options['connectTimeout'] ) && $options['connectTimeout'] != 'default' ) {
|
||||
|
|
@ -124,7 +126,8 @@ abstract class MWHttpRequest implements LoggerAwareInterface {
|
|||
// The timeout should always be set by HttpRequestFactory, so this
|
||||
// should only happen if the class was directly constructed
|
||||
wfDeprecated( __METHOD__ . ' without the connectTimeout option', '1.35' );
|
||||
$httpConnectTimeout = MediaWikiServices::getInstance()->getMainConfig()->get( 'HTTPConnectTimeout' );
|
||||
$httpConnectTimeout = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::HTTPConnectTimeout );
|
||||
$this->connectTimeout = $httpConnectTimeout;
|
||||
}
|
||||
if ( isset( $options['userAgent'] ) ) {
|
||||
|
|
@ -225,8 +228,10 @@ abstract class MWHttpRequest implements LoggerAwareInterface {
|
|||
* @return void
|
||||
*/
|
||||
protected function proxySetup() {
|
||||
$httpProxy = MediaWikiServices::getInstance()->getMainConfig()->get( 'HTTPProxy' );
|
||||
$localHTTPProxy = MediaWikiServices::getInstance()->getMainConfig()->get( 'LocalHTTPProxy' );
|
||||
$httpProxy = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::HTTPProxy );
|
||||
$localHTTPProxy = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::LocalHTTPProxy );
|
||||
// If proxies are disabled, clear any other proxy
|
||||
if ( $this->noProxy ) {
|
||||
$this->proxy = '';
|
||||
|
|
@ -287,7 +292,8 @@ abstract class MWHttpRequest implements LoggerAwareInterface {
|
|||
*/
|
||||
private static function isLocalURL( $url ) {
|
||||
$commandLineMode = MediaWikiServices::getInstance()->getMainConfig()->get( 'CommandLineMode' );
|
||||
$localVirtualHosts = MediaWikiServices::getInstance()->getMainConfig()->get( 'LocalVirtualHosts' );
|
||||
$localVirtualHosts = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::LocalVirtualHosts );
|
||||
if ( $commandLineMode ) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
* @ingroup SpecialPage
|
||||
*/
|
||||
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
||||
|
|
@ -114,7 +115,8 @@ class ImportStreamSource implements ImportSource {
|
|||
* @return Status
|
||||
*/
|
||||
public static function newFromURL( $url, $method = 'GET' ) {
|
||||
$httpImportTimeout = MediaWikiServices::getInstance()->getMainConfig()->get( 'HTTPImportTimeout' );
|
||||
$httpImportTimeout = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::HTTPImportTimeout );
|
||||
wfDebug( __METHOD__ . ": opening $url" );
|
||||
# Use the standard HTTP fetch function; it times out
|
||||
# quicker and sorts out user-agent problems which might
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ use MediaWiki\Cache\CacheKeyHelper;
|
|||
use MediaWiki\Content\IContentHandlerFactory;
|
||||
use MediaWiki\HookContainer\HookContainer;
|
||||
use MediaWiki\HookContainer\HookRunner;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Page\PageIdentity;
|
||||
use MediaWiki\Page\WikiPageFactory;
|
||||
|
|
@ -1048,7 +1049,8 @@ class WikiImporter {
|
|||
* @throws MWException
|
||||
*/
|
||||
private function makeContent( Title $title, $revisionId, $contentInfo ) {
|
||||
$maxArticleSize = MediaWikiServices::getInstance()->getMainConfig()->get( 'MaxArticleSize' );
|
||||
$maxArticleSize = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::MaxArticleSize );
|
||||
|
||||
if ( !isset( $contentInfo['text'] ) ) {
|
||||
throw new MWException( 'Missing text field in import.' );
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
* @ingroup SpecialPage
|
||||
*/
|
||||
use MediaWiki\Logger\LoggerFactory;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Revision\MutableRevisionSlots;
|
||||
use MediaWiki\Revision\SlotRecord;
|
||||
|
|
@ -739,7 +740,7 @@ class WikiRevision implements ImportableUploadRevision, ImportableOldRevision {
|
|||
*/
|
||||
public function downloadSource() {
|
||||
$importer = new ImportableUploadRevisionImporter(
|
||||
$this->config->get( 'EnableUploads' ),
|
||||
$this->config->get( MainConfigNames::EnableUploads ),
|
||||
LoggerFactory::getInstance( 'UploadRevisionImporter' )
|
||||
);
|
||||
return $importer->downloadSource( $this );
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
use MediaWiki\HookContainer\HookContainer;
|
||||
use MediaWiki\HookContainer\StaticHookRegistry;
|
||||
use MediaWiki\Interwiki\NullInterwikiLookup;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Settings\SettingsBuilder;
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
|
@ -382,7 +383,7 @@ abstract class Installer {
|
|||
CACHE_DB => $emptyCache,
|
||||
CACHE_ANYTHING => $emptyCache,
|
||||
CACHE_MEMCACHED => $emptyCache,
|
||||
] + $baseConfig->get( 'ObjectCaches' );
|
||||
] + $baseConfig->get( MainConfigNames::ObjectCaches );
|
||||
|
||||
$configOverrides->set( 'ObjectCaches', $objectCaches );
|
||||
|
||||
|
|
@ -511,7 +512,7 @@ abstract class Installer {
|
|||
|
||||
// Disable object cache (otherwise CACHE_ANYTHING will try CACHE_DB and
|
||||
// SqlBagOStuff will then throw since we just disabled wfGetDB)
|
||||
$wgObjectCaches = $mwServices->getMainConfig()->get( 'ObjectCaches' );
|
||||
$wgObjectCaches = $mwServices->getMainConfig()->get( MainConfigNames::ObjectCaches );
|
||||
|
||||
$this->parserOptions = new ParserOptions( $user ); // language will be wrong :(
|
||||
// Don't try to access DB before user language is initialised
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
* @defgroup JobQueue JobQueue
|
||||
*/
|
||||
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Page\PageReference;
|
||||
|
||||
|
|
@ -69,7 +70,8 @@ abstract class Job implements RunnableJob {
|
|||
* @return Job
|
||||
*/
|
||||
public static function factory( $command, $params = [] ) {
|
||||
$jobClasses = MediaWikiServices::getInstance()->getMainConfig()->get( 'JobClasses' );
|
||||
$jobClasses = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::JobClasses );
|
||||
|
||||
if ( $params instanceof PageReference ) {
|
||||
// Backwards compatibility for old signature ($command, $title, $params)
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
*
|
||||
* @file
|
||||
*/
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Page\PageIdentity;
|
||||
use MediaWiki\Revision\RevisionLookup;
|
||||
|
|
@ -215,7 +216,7 @@ class CategoryMembershipChangeJob extends Job {
|
|||
$catMembChange = new CategoryMembershipChange( $title, $blc, $newRev );
|
||||
$catMembChange->checkTemplateLinks();
|
||||
|
||||
$batchSize = $config->get( 'UpdateRowsPerQuery' );
|
||||
$batchSize = $config->get( MainConfigNames::UpdateRowsPerQuery );
|
||||
$insertCount = 0;
|
||||
|
||||
foreach ( $categoryInserts as $categoryName ) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\User\UserIdentity;
|
||||
|
||||
|
|
@ -34,7 +35,8 @@ class ClearUserWatchlistJob extends Job implements GenericParameterJob {
|
|||
}
|
||||
|
||||
public function run() {
|
||||
$updateRowsPerQuery = MediaWikiServices::getInstance()->getMainConfig()->get( 'UpdateRowsPerQuery' );
|
||||
$updateRowsPerQuery = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::UpdateRowsPerQuery );
|
||||
$userId = $this->params['userId'];
|
||||
$maxWatchlistId = $this->params['maxWatchlistId'];
|
||||
$batchSize = $updateRowsPerQuery;
|
||||
|
|
@ -83,7 +85,8 @@ class ClearUserWatchlistJob extends Job implements GenericParameterJob {
|
|||
}
|
||||
|
||||
$dbw->delete( 'watchlist', [ 'wl_id' => $watchlistIds ], __METHOD__ );
|
||||
if ( MediaWikiServices::getInstance()->getMainConfig()->get( 'WatchlistExpiry' ) ) {
|
||||
if ( MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::WatchlistExpiry ) ) {
|
||||
$dbw->delete( 'watchlist_expiry', [ 'we_item' => $watchlistIds ], __METHOD__ );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
* @ingroup JobQueue
|
||||
*/
|
||||
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
|
|
@ -49,7 +50,7 @@ class ClearWatchlistNotificationsJob extends Job implements GenericParameterJob
|
|||
public function run() {
|
||||
$services = MediaWikiServices::getInstance();
|
||||
$lbFactory = $services->getDBLoadBalancerFactory();
|
||||
$rowsPerQuery = $services->getMainConfig()->get( 'UpdateRowsPerQuery' );
|
||||
$rowsPerQuery = $services->getMainConfig()->get( MainConfigNames::UpdateRowsPerQuery );
|
||||
|
||||
$dbw = $lbFactory->getMainLB()->getConnectionRef( DB_PRIMARY );
|
||||
$ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ );
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Page\PageReference;
|
||||
|
||||
|
|
@ -73,8 +74,10 @@ class HTMLCacheUpdateJob extends Job {
|
|||
}
|
||||
|
||||
public function run() {
|
||||
$updateRowsPerJob = MediaWikiServices::getInstance()->getMainConfig()->get( 'UpdateRowsPerJob' );
|
||||
$updateRowsPerQuery = MediaWikiServices::getInstance()->getMainConfig()->get( 'UpdateRowsPerQuery' );
|
||||
$updateRowsPerJob = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::UpdateRowsPerJob );
|
||||
$updateRowsPerQuery = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::UpdateRowsPerQuery );
|
||||
if ( isset( $this->params['table'] ) && !isset( $this->params['pages'] ) ) {
|
||||
$this->params['recursive'] = true; // b/c; base job
|
||||
}
|
||||
|
|
@ -141,7 +144,7 @@ class HTMLCacheUpdateJob extends Job {
|
|||
$ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ );
|
||||
// Update page_touched (skipping pages already touched since the root job).
|
||||
// Check $wgUpdateRowsPerQuery; batch jobs are sized by that already.
|
||||
$batches = array_chunk( $pageIds, $config->get( 'UpdateRowsPerQuery' ) );
|
||||
$batches = array_chunk( $pageIds, $config->get( MainConfigNames::UpdateRowsPerQuery ) );
|
||||
foreach ( $batches as $batch ) {
|
||||
$dbw->update( 'page',
|
||||
[ 'page_touched' => $dbw->timestamp( $newTouchedUnix ) ],
|
||||
|
|
@ -160,7 +163,7 @@ class HTMLCacheUpdateJob extends Job {
|
|||
'page',
|
||||
array_merge(
|
||||
[ 'page_namespace', 'page_title' ],
|
||||
$config->get( 'PageLanguageUseDB' ) ? [ 'page_lang' ] : []
|
||||
$config->get( MainConfigNames::PageLanguageUseDB ) ? [ 'page_lang' ] : []
|
||||
),
|
||||
[ 'page_id' => $pageIds, 'page_touched' => $dbw->timestamp( $newTouchedUnix ) ],
|
||||
__METHOD__
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
* @ingroup JobQueue
|
||||
*/
|
||||
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
|
|
@ -72,8 +73,10 @@ class RecentChangesUpdateJob extends Job {
|
|||
}
|
||||
|
||||
protected function purgeExpiredRows() {
|
||||
$rcMaxAge = MediaWikiServices::getInstance()->getMainConfig()->get( 'RCMaxAge' );
|
||||
$updateRowsPerQuery = MediaWikiServices::getInstance()->getMainConfig()->get( 'UpdateRowsPerQuery' );
|
||||
$rcMaxAge = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::RCMaxAge );
|
||||
$updateRowsPerQuery = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::UpdateRowsPerQuery );
|
||||
$dbw = wfGetDB( DB_PRIMARY );
|
||||
$lockKey = $dbw->getDomainID() . ':recentchanges-prune';
|
||||
if ( !$dbw->lock( $lockKey, __METHOD__, 0 ) ) {
|
||||
|
|
@ -117,7 +120,8 @@ class RecentChangesUpdateJob extends Job {
|
|||
}
|
||||
|
||||
protected function updateActiveUsers() {
|
||||
$activeUserDays = MediaWikiServices::getInstance()->getMainConfig()->get( 'ActiveUserDays' );
|
||||
$activeUserDays = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::ActiveUserDays );
|
||||
|
||||
// Users that made edits at least this many days ago are "active"
|
||||
$days = $activeUserDays;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
|
||||
use MediaWiki\Deferred\LinksUpdate\LinksUpdate;
|
||||
use MediaWiki\Logger\LoggerFactory;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Page\PageAssertionException;
|
||||
use MediaWiki\Page\PageIdentity;
|
||||
|
|
@ -139,7 +140,7 @@ class RefreshLinksJob extends Job {
|
|||
// jobs and possibly a recursive RefreshLinks job for the rest of the backlinks
|
||||
$jobs = BacklinkJobUtils::partitionBacklinkJob(
|
||||
$this,
|
||||
$services->getMainConfig()->get( 'UpdateRowsPerJob' ),
|
||||
$services->getMainConfig()->get( MainConfigNames::UpdateRowsPerJob ),
|
||||
1, // job-per-title
|
||||
[ 'params' => $extraParams ]
|
||||
);
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
* @ingroup JobQueue
|
||||
*/
|
||||
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
|
|
@ -35,7 +36,7 @@ class ThumbnailRenderJob extends Job {
|
|||
|
||||
public function run() {
|
||||
$uploadThumbnailRenderMethod = MediaWikiServices::getInstance()
|
||||
->getMainConfig()->get( 'UploadThumbnailRenderMethod' );
|
||||
->getMainConfig()->get( MainConfigNames::UploadThumbnailRenderMethod );
|
||||
|
||||
$transformParams = $this->params['transformParams'];
|
||||
|
||||
|
|
@ -77,8 +78,10 @@ class ThumbnailRenderJob extends Job {
|
|||
*/
|
||||
protected function hitThumbUrl( LocalFile $file, $transformParams ) {
|
||||
$config = MediaWikiServices::getInstance()->getMainConfig();
|
||||
$uploadThumbnailRenderHttpCustomHost = $config->get( 'UploadThumbnailRenderHttpCustomHost' );
|
||||
$uploadThumbnailRenderHttpCustomDomain = $config->get( 'UploadThumbnailRenderHttpCustomDomain' );
|
||||
$uploadThumbnailRenderHttpCustomHost =
|
||||
$config->get( MainConfigNames::UploadThumbnailRenderHttpCustomHost );
|
||||
$uploadThumbnailRenderHttpCustomDomain =
|
||||
$config->get( MainConfigNames::UploadThumbnailRenderHttpCustomDomain );
|
||||
$handler = $file->getHandler();
|
||||
if ( !$handler ) {
|
||||
$this->setLastError( __METHOD__ . ': could not get handler' );
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
*
|
||||
* @file
|
||||
*/
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use Wikimedia\Rdbms\IDatabase;
|
||||
|
||||
|
|
@ -63,7 +64,8 @@ class PurgeJobUtils {
|
|||
return;
|
||||
}
|
||||
|
||||
$batchSize = $services->getMainConfig()->get( 'UpdateRowsPerQuery' );
|
||||
$batchSize =
|
||||
$services->getMainConfig()->get( MainConfigNames::UpdateRowsPerQuery );
|
||||
$ticket = $lbFactory->getEmptyTransactionTicket( $fname );
|
||||
$idBatches = array_chunk( $ids, $batchSize );
|
||||
foreach ( $idBatches as $idBatch ) {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
* @author Luke Welling lwelling@wikimedia.org
|
||||
*/
|
||||
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
||||
|
|
@ -84,8 +85,8 @@ class UserMailer {
|
|||
* @return string
|
||||
*/
|
||||
private static function makeMsgId() {
|
||||
$smtp = MediaWikiServices::getInstance()->getMainConfig()->get( 'SMTP' );
|
||||
$server = MediaWikiServices::getInstance()->getMainConfig()->get( 'Server' );
|
||||
$smtp = MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::SMTP );
|
||||
$server = MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::Server );
|
||||
$domainId = WikiMap::getCurrentWikiDbDomain()->getId();
|
||||
$msgid = uniqid( $domainId . ".", true /** for cygwin */ );
|
||||
if ( is_array( $smtp ) && isset( $smtp['IDHost'] ) && $smtp['IDHost'] ) {
|
||||
|
|
@ -117,7 +118,8 @@ class UserMailer {
|
|||
* @return Status
|
||||
*/
|
||||
public static function send( $to, $from, $subject, $body, $options = [] ) {
|
||||
$allowHTMLEmail = MediaWikiServices::getInstance()->getMainConfig()->get( 'AllowHTMLEmail' );
|
||||
$allowHTMLEmail = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::AllowHTMLEmail );
|
||||
|
||||
if ( !isset( $options['contentType'] ) ) {
|
||||
$options['contentType'] = 'text/plain; charset=UTF-8';
|
||||
|
|
@ -247,9 +249,9 @@ class UserMailer {
|
|||
$options = []
|
||||
) {
|
||||
$mainConfig = MediaWikiServices::getInstance()->getMainConfig();
|
||||
$smtp = $mainConfig->get( 'SMTP' );
|
||||
$enotifMaxRecips = $mainConfig->get( 'EnotifMaxRecips' );
|
||||
$additionalMailParams = $mainConfig->get( 'AdditionalMailParams' );
|
||||
$smtp = $mainConfig->get( MainConfigNames::SMTP );
|
||||
$enotifMaxRecips = $mainConfig->get( MainConfigNames::EnotifMaxRecips );
|
||||
$additionalMailParams = $mainConfig->get( MainConfigNames::AdditionalMailParams );
|
||||
$mime = null;
|
||||
|
||||
$replyto = $options['replyTo'] ?? null;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
|
||||
use MediaWiki\HookContainer\ProtectedHookAccessorTrait;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
|
|
@ -61,7 +62,7 @@ class ImageHistoryList extends ContextSource {
|
|||
$this->img = $imagePage->getDisplayedFile();
|
||||
$this->title = $imagePage->getTitle();
|
||||
$this->imagePage = $imagePage;
|
||||
$this->showThumb = $context->getConfig()->get( 'ShowArchiveThumbnails' ) &&
|
||||
$this->showThumb = $context->getConfig()->get( MainConfigNames::ShowArchiveThumbnails ) &&
|
||||
$this->img->canRender();
|
||||
$this->setContext( $context );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use Wikimedia\Rdbms\IResultWrapper;
|
||||
|
||||
|
|
@ -90,7 +91,7 @@ class ImagePage extends Article {
|
|||
}
|
||||
|
||||
public function view() {
|
||||
$showEXIF = MediaWikiServices::getInstance()->getMainConfig()->get( 'ShowEXIF' );
|
||||
$showEXIF = MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::ShowEXIF );
|
||||
|
||||
// For action=render, include body text only; none of the image extras
|
||||
if ( $this->viewIsRenderAction ) {
|
||||
|
|
@ -332,7 +333,8 @@ class ImagePage extends Article {
|
|||
}
|
||||
|
||||
$config = MediaWikiServices::getInstance()->getMainConfig();
|
||||
$requestLanguage = $request->getVal( 'lang', $config->get( 'LanguageCode' ) );
|
||||
$requestLanguage =
|
||||
$request->getVal( 'lang', $config->get( MainConfigNames::LanguageCode ) );
|
||||
if ( $handler->validateParam( 'lang', $requestLanguage ) ) {
|
||||
return $file->getMatchedLanguage( $requestLanguage );
|
||||
}
|
||||
|
|
@ -342,9 +344,9 @@ class ImagePage extends Article {
|
|||
|
||||
protected function openShowImage() {
|
||||
$mainConfig = MediaWikiServices::getInstance()->getMainConfig();
|
||||
$enableUploads = $mainConfig->get( 'EnableUploads' );
|
||||
$send404Code = $mainConfig->get( 'Send404Code' );
|
||||
$svgMaxSize = $mainConfig->get( 'SVGMaxSize' );
|
||||
$enableUploads = $mainConfig->get( MainConfigNames::EnableUploads );
|
||||
$send404Code = $mainConfig->get( MainConfigNames::Send404Code );
|
||||
$svgMaxSize = $mainConfig->get( MainConfigNames::SVGMaxSize );
|
||||
$this->loadFile();
|
||||
$out = $this->getContext()->getOutput();
|
||||
$user = $this->getContext()->getUser();
|
||||
|
|
@ -526,7 +528,8 @@ class ImagePage extends Article {
|
|||
$thumb2 = '';
|
||||
}
|
||||
|
||||
$script = MediaWikiServices::getInstance()->getMainConfig()->get( 'Script' );
|
||||
$script = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::Script );
|
||||
|
||||
$formParams = [
|
||||
'name' => 'pageselector',
|
||||
|
|
@ -789,7 +792,7 @@ EOT
|
|||
* Add the re-upload link (or message about not being able to re-upload) to the output.
|
||||
*/
|
||||
protected function uploadLinksBox() {
|
||||
if ( !$this->getContext()->getConfig()->get( 'EnableUploads' ) ) {
|
||||
if ( !$this->getContext()->getConfig()->get( MainConfigNames::EnableUploads ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1070,7 +1073,8 @@ EOT
|
|||
* @return string HTML to insert underneath image.
|
||||
*/
|
||||
protected function doRenderLangOpt( array $langChoices, $renderLang ) {
|
||||
$script = MediaWikiServices::getInstance()->getMainConfig()->get( 'Script' );
|
||||
$script =
|
||||
MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::Script );
|
||||
$opts = '';
|
||||
|
||||
$matchedRenderLang = $this->displayImg->getMatchedLanguage( $renderLang );
|
||||
|
|
@ -1142,7 +1146,8 @@ EOT
|
|||
* @phan-return array<int,array{0:int,1:int}>
|
||||
*/
|
||||
protected function getThumbSizes( $origWidth, $origHeight ) {
|
||||
$imageLimits = MediaWikiServices::getInstance()->getMainConfig()->get( 'ImageLimits' );
|
||||
$imageLimits = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::ImageLimits );
|
||||
if ( $this->displayImg->getRepo()->canTransformVia404() ) {
|
||||
$thumbSizes = $imageLimits;
|
||||
// Also include the full sized resolution in the list, so
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ use MediaWiki\Edit\PreparedEdit;
|
|||
use MediaWiki\HookContainer\ProtectedHookAccessorTrait;
|
||||
use MediaWiki\Linker\LinkTarget;
|
||||
use MediaWiki\Logger\LoggerFactory;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Page\DeletePage;
|
||||
use MediaWiki\Page\ExistingPageRecord;
|
||||
|
|
@ -362,7 +363,8 @@ class WikiPage implements Page, IDBAccessObject, PageRecord {
|
|||
* - joins: (array) to include in the `$join_conds` to `IDatabase->select()`
|
||||
*/
|
||||
public static function getQueryInfo() {
|
||||
$pageLanguageUseDB = MediaWikiServices::getInstance()->getMainConfig()->get( 'PageLanguageUseDB' );
|
||||
$pageLanguageUseDB = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::PageLanguageUseDB );
|
||||
|
||||
$ret = [
|
||||
'tables' => [ 'page' ],
|
||||
|
|
@ -966,7 +968,8 @@ class WikiPage implements Page, IDBAccessObject, PageRecord {
|
|||
* @return bool
|
||||
*/
|
||||
public function isCountable( $editInfo = false ) {
|
||||
$articleCountMethod = MediaWikiServices::getInstance()->getMainConfig()->get( 'ArticleCountMethod' );
|
||||
$articleCountMethod = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::ArticleCountMethod );
|
||||
|
||||
// NOTE: Keep in sync with DerivedPageDataUpdater::isCountable.
|
||||
|
||||
|
|
@ -1948,8 +1951,10 @@ class WikiPage implements Page, IDBAccessObject, PageRecord {
|
|||
$tags = [],
|
||||
$undidRevId = 0
|
||||
) {
|
||||
$useNPPatrol = MediaWikiServices::getInstance()->getMainConfig()->get( 'UseNPPatrol' );
|
||||
$useRCPatrol = MediaWikiServices::getInstance()->getMainConfig()->get( 'UseRCPatrol' );
|
||||
$useNPPatrol = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::UseNPPatrol );
|
||||
$useRCPatrol = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::UseRCPatrol );
|
||||
if ( !( $summary instanceof CommentStoreComment ) ) {
|
||||
$summary = CommentStoreComment::newUnsavedComment( trim( $summary ) );
|
||||
}
|
||||
|
|
@ -2670,7 +2675,7 @@ class WikiPage implements Page, IDBAccessObject, PageRecord {
|
|||
*/
|
||||
public function isBatchedDelete( $safetyMargin = 0 ) {
|
||||
$deleteRevisionsBatchSize = MediaWikiServices::getInstance()
|
||||
->getMainConfig()->get( 'DeleteRevisionsBatchSize' );
|
||||
->getMainConfig()->get( MainConfigNames::DeleteRevisionsBatchSize );
|
||||
|
||||
$dbr = wfGetDB( DB_REPLICA );
|
||||
$revCount = $this->getRevisionStore()->countRevisionsByPageId( $dbr, $this->getId() );
|
||||
|
|
@ -2997,7 +3002,8 @@ class WikiPage implements Page, IDBAccessObject, PageRecord {
|
|||
* @param Title $title
|
||||
*/
|
||||
private static function purgeInterwikiCheckKey( Title $title ) {
|
||||
$enableScaryTranscluding = MediaWikiServices::getInstance()->getMainConfig()->get( 'EnableScaryTranscluding' );
|
||||
$enableScaryTranscluding = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::EnableScaryTranscluding );
|
||||
|
||||
if ( !$enableScaryTranscluding ) {
|
||||
return; // @todo: perhaps this wiki is only used as a *source* for content?
|
||||
|
|
@ -3224,7 +3230,8 @@ class WikiPage implements Page, IDBAccessObject, PageRecord {
|
|||
MediaWikiServices::getInstance()->getJobQueueGroup()->lazyPush(
|
||||
RefreshLinksJob::newPrioritized( $this->mTitle, $params )
|
||||
);
|
||||
} elseif ( !$config->get( 'MiserMode' ) && $parserOutput->hasReducedExpiry() ) {
|
||||
} elseif ( !$config->get( MainConfigNames::MiserMode ) &&
|
||||
$parserOutput->hasReducedExpiry() ) {
|
||||
// Assume the output contains "dynamic" time/random based magic words.
|
||||
// Only update pages that expired due to dynamic content and NOT due to edits
|
||||
// to referenced templates/files. When the cache expires due to dynamic content,
|
||||
|
|
@ -3315,7 +3322,8 @@ class WikiPage implements Page, IDBAccessObject, PageRecord {
|
|||
* @return string
|
||||
*/
|
||||
public function getWikiDisplayName() {
|
||||
$sitename = MediaWikiServices::getInstance()->getMainConfig()->get( 'Sitename' );
|
||||
$sitename = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::Sitename );
|
||||
return $sitename;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
* @ingroup Parser
|
||||
*/
|
||||
use MediaWiki\Config\ServiceOptions;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\Parser\ParserOutputFlags;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Wikimedia\Timestamp\ConvertibleTimestamp;
|
||||
|
|
@ -295,17 +296,17 @@ class CoreMagicVariables {
|
|||
case 'currentversion':
|
||||
return SpecialVersion::getVersion();
|
||||
case 'articlepath':
|
||||
return (string)$svcOptions->get( 'ArticlePath' );
|
||||
return (string)$svcOptions->get( MainConfigNames::ArticlePath );
|
||||
case 'sitename':
|
||||
return (string)$svcOptions->get( 'Sitename' );
|
||||
return (string)$svcOptions->get( MainConfigNames::Sitename );
|
||||
case 'server':
|
||||
return (string)$svcOptions->get( 'Server' );
|
||||
return (string)$svcOptions->get( MainConfigNames::Server );
|
||||
case 'servername':
|
||||
return (string)$svcOptions->get( 'ServerName' );
|
||||
return (string)$svcOptions->get( MainConfigNames::ServerName );
|
||||
case 'scriptpath':
|
||||
return (string)$svcOptions->get( 'ScriptPath' );
|
||||
return (string)$svcOptions->get( MainConfigNames::ScriptPath );
|
||||
case 'stylepath':
|
||||
return (string)$svcOptions->get( 'StylePath' );
|
||||
return (string)$svcOptions->get( MainConfigNames::StylePath );
|
||||
case 'directionmark':
|
||||
return $pageLang->getDirMark();
|
||||
case 'contentlanguage':
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ use MediaWiki\Languages\LanguageNameUtils;
|
|||
use MediaWiki\Linker\LinkRenderer;
|
||||
use MediaWiki\Linker\LinkRendererFactory;
|
||||
use MediaWiki\Linker\LinkTarget;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Page\PageIdentity;
|
||||
use MediaWiki\Page\PageReference;
|
||||
|
|
@ -406,7 +407,7 @@ class Parser {
|
|||
'ServerName',
|
||||
'ShowHostnames',
|
||||
'SignatureValidation',
|
||||
'Sitename',
|
||||
MainConfigNames::Sitename,
|
||||
'StylePath',
|
||||
'TranscludeCacheExpiry',
|
||||
'PreprocessorCacheThreshold',
|
||||
|
|
@ -735,7 +736,8 @@ class Parser {
|
|||
}
|
||||
|
||||
# Information on limits, for the benefit of users who try to skirt them
|
||||
if ( MediaWikiServices::getInstance()->getMainConfig()->get( 'EnableParserLimitReporting' ) ) {
|
||||
if ( MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::EnableParserLimitReporting ) ) {
|
||||
$this->makeLimitReport();
|
||||
}
|
||||
|
||||
|
|
@ -2232,9 +2234,9 @@ class Parser {
|
|||
*/
|
||||
public static function getExternalLinkRel( $url = false, LinkTarget $title = null ) {
|
||||
$mainConfig = MediaWikiServices::getInstance()->getMainConfig();
|
||||
$noFollowLinks = $mainConfig->get( 'NoFollowLinks' );
|
||||
$noFollowNsExceptions = $mainConfig->get( 'NoFollowNsExceptions' );
|
||||
$noFollowDomainExceptions = $mainConfig->get( 'NoFollowDomainExceptions' );
|
||||
$noFollowLinks = $mainConfig->get( MainConfigNames::NoFollowLinks );
|
||||
$noFollowNsExceptions = $mainConfig->get( MainConfigNames::NoFollowNsExceptions );
|
||||
$noFollowDomainExceptions = $mainConfig->get( MainConfigNames::NoFollowDomainExceptions );
|
||||
$ns = $title ? $title->getNamespace() : false;
|
||||
if ( $noFollowLinks && !in_array( $ns, $noFollowNsExceptions )
|
||||
&& !wfMatchesDomainList( $url, $noFollowDomainExceptions )
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ use MediaWiki\Json\JsonUnserializableTrait;
|
|||
use MediaWiki\Json\JsonUnserializer;
|
||||
use MediaWiki\Linker\LinkTarget;
|
||||
use MediaWiki\Logger\LoggerFactory;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Page\PageReference;
|
||||
use MediaWiki\Parser\ParserOutputFlags;
|
||||
|
|
@ -1042,8 +1043,8 @@ class ParserOutput extends CacheTime implements ContentMetadataCollector {
|
|||
public function addExternalLink( $url ): void {
|
||||
# We don't register links pointing to our own server, unless... :-)
|
||||
$config = MediaWikiServices::getInstance()->getMainConfig();
|
||||
$server = $config->get( 'Server' );
|
||||
$registerInternalExternals = $config->get( 'RegisterInternalExternals' );
|
||||
$server = $config->get( MainConfigNames::Server );
|
||||
$registerInternalExternals = $config->get( MainConfigNames::RegisterInternalExternals );
|
||||
# Replace unnecessary URL escape codes with the referenced character
|
||||
# This prevents spammers from hiding links from the filters
|
||||
$url = Parser::normalizeLinkUrl( $url );
|
||||
|
|
@ -1952,7 +1953,8 @@ class ParserOutput extends CacheTime implements ContentMetadataCollector {
|
|||
* @return bool
|
||||
*/
|
||||
public function hasReducedExpiry(): bool {
|
||||
$parserCacheExpireTime = MediaWikiServices::getInstance()->getMainConfig()->get( 'ParserCacheExpireTime' );
|
||||
$parserCacheExpireTime = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::ParserCacheExpireTime );
|
||||
|
||||
return $this->getCacheExpiry() < $parserCacheExpireTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ use MediaWiki\Languages\LanguageConverterFactory;
|
|||
use MediaWiki\Languages\LanguageFactory;
|
||||
use MediaWiki\Languages\LanguageNameUtils;
|
||||
use MediaWiki\Logger\LoggerFactory;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\SpecialPage\SpecialPageFactory;
|
||||
use MediaWiki\User\UserOptionsLookup;
|
||||
use MutableConfig;
|
||||
|
|
@ -257,14 +258,14 @@ class SiteConfig extends ISiteConfig {
|
|||
}
|
||||
|
||||
public function galleryOptions(): array {
|
||||
return $this->config->get( 'GalleryOptions' );
|
||||
return $this->config->get( MainConfigNames::GalleryOptions );
|
||||
}
|
||||
|
||||
public function allowedExternalImagePrefixes(): array {
|
||||
if ( $this->config->get( 'AllowExternalImages' ) ) {
|
||||
if ( $this->config->get( MainConfigNames::AllowExternalImages ) ) {
|
||||
return [ '' ];
|
||||
} else {
|
||||
$allowFrom = $this->config->get( 'AllowExternalImagesFrom' );
|
||||
$allowFrom = $this->config->get( MainConfigNames::AllowExternalImagesFrom );
|
||||
return $allowFrom ? (array)$allowFrom : [];
|
||||
}
|
||||
}
|
||||
|
|
@ -277,7 +278,8 @@ class SiteConfig extends ISiteConfig {
|
|||
* path portion.
|
||||
*/
|
||||
private function determineArticlePath(): void {
|
||||
$url = $this->config->get( 'Server' ) . $this->config->get( 'ArticlePath' );
|
||||
$url = $this->config->get( MainConfigNames::Server ) .
|
||||
$this->config->get( MainConfigNames::ArticlePath );
|
||||
|
||||
if ( substr( $url, -2 ) !== '$1' ) {
|
||||
throw new UnexpectedValueException( "Article path '$url' does not have '$1' at the end" );
|
||||
|
|
@ -410,7 +412,7 @@ class SiteConfig extends ISiteConfig {
|
|||
}
|
||||
|
||||
public function interwikiMagic(): bool {
|
||||
return $this->config->get( 'InterwikiMagic' );
|
||||
return $this->config->get( MainConfigNames::InterwikiMagic );
|
||||
}
|
||||
|
||||
public function interwikiMap(): array {
|
||||
|
|
@ -422,8 +424,8 @@ class SiteConfig extends ISiteConfig {
|
|||
|
||||
$getPrefixes = $this->interwikiLookup->getAllPrefixes();
|
||||
$langNames = $this->languageNameUtils->getLanguageNames();
|
||||
$extraLangPrefixes = $this->config->get( 'ExtraInterlanguageLinkPrefixes' );
|
||||
$localInterwikis = $this->config->get( 'LocalInterwikis' );
|
||||
$extraLangPrefixes = $this->config->get( MainConfigNames::ExtraInterlanguageLinkPrefixes );
|
||||
$localInterwikis = $this->config->get( MainConfigNames::LocalInterwikis );
|
||||
|
||||
foreach ( $getPrefixes as $row ) {
|
||||
$prefix = $row['iw_prefix'];
|
||||
|
|
@ -495,7 +497,7 @@ class SiteConfig extends ISiteConfig {
|
|||
}
|
||||
|
||||
public function lang(): string {
|
||||
return $this->config->get( 'LanguageCode' );
|
||||
return $this->config->get( MainConfigNames::LanguageCode );
|
||||
}
|
||||
|
||||
public function mainpage(): string {
|
||||
|
|
@ -536,15 +538,15 @@ class SiteConfig extends ISiteConfig {
|
|||
}
|
||||
|
||||
public function script(): string {
|
||||
return $this->config->get( 'Script' );
|
||||
return $this->config->get( MainConfigNames::Script );
|
||||
}
|
||||
|
||||
public function scriptpath(): string {
|
||||
return $this->config->get( 'ScriptPath' );
|
||||
return $this->config->get( MainConfigNames::ScriptPath );
|
||||
}
|
||||
|
||||
public function server(): string {
|
||||
return $this->config->get( 'Server' );
|
||||
return $this->config->get( MainConfigNames::Server );
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
|
|
@ -561,7 +563,7 @@ class SiteConfig extends ISiteConfig {
|
|||
Utils::escapeHtml( $defaultTitle );
|
||||
$this->exportMetadataHelper(
|
||||
$document,
|
||||
$this->config->get( 'LoadScript' ),
|
||||
$this->config->get( MainConfigNames::LoadScript ),
|
||||
$metadata->getModules(),
|
||||
$metadata->getModuleStyles(),
|
||||
$metadata->getJsConfigVars(),
|
||||
|
|
@ -571,7 +573,7 @@ class SiteConfig extends ISiteConfig {
|
|||
}
|
||||
|
||||
public function timezoneOffset(): int {
|
||||
return $this->config->get( 'LocalTZoffset' );
|
||||
return $this->config->get( MainConfigNames::LocalTZoffset );
|
||||
}
|
||||
|
||||
public function variants(): array {
|
||||
|
|
@ -612,7 +614,7 @@ class SiteConfig extends ISiteConfig {
|
|||
// Even though this looks like Parsoid is supporting per-user thumbsize
|
||||
// options, that is not the case, Parsoid doesn't receive user session state
|
||||
$thumbsize = $this->userOptionsLookup->getDefaultOption( 'thumbsize' );
|
||||
return $this->config->get( 'ThumbLimits' )[$thumbsize];
|
||||
return $this->config->get( MainConfigNames::ThumbLimits )[$thumbsize];
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
|
|
@ -670,7 +672,7 @@ class SiteConfig extends ISiteConfig {
|
|||
|
||||
/** @inheritDoc */
|
||||
public function getMaxTemplateDepth(): int {
|
||||
return (int)$this->config->get( 'MaxTemplateDepth' );
|
||||
return (int)$this->config->get( MainConfigNames::MaxTemplateDepth );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -699,7 +701,8 @@ class SiteConfig extends ISiteConfig {
|
|||
$this->quoteTitleRe( $this->contLang->getNsText( NS_SPECIAL ) )
|
||||
];
|
||||
foreach (
|
||||
$this->contLang->getNamespaceAliases() + $this->config->get( 'NamespaceAliases' )
|
||||
$this->contLang->getNamespaceAliases() +
|
||||
$this->config->get( MainConfigNames::NamespaceAliases )
|
||||
as $name => $ns
|
||||
) {
|
||||
if ( $ns === NS_SPECIAL ) {
|
||||
|
|
@ -719,6 +722,6 @@ class SiteConfig extends ISiteConfig {
|
|||
|
||||
/** @inheritDoc */
|
||||
protected function getProtocols(): array {
|
||||
return $this->config->get( 'UrlProtocols' );
|
||||
return $this->config->get( MainConfigNames::UrlProtocols );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
use MediaWiki\HeaderCallback;
|
||||
use MediaWiki\HookContainer\HookContainer;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\ResourceLoader\HookRunner;
|
||||
use Psr\Log\LoggerAwareInterface;
|
||||
|
|
@ -254,7 +255,7 @@ class ResourceLoader implements LoggerAwareInterface {
|
|||
$this->hookRunner = new HookRunner( $this->hookContainer );
|
||||
|
||||
// Add 'local' source first
|
||||
$this->addSource( 'local', $config->get( 'LoadScript' ) );
|
||||
$this->addSource( 'local', $config->get( MainConfigNames::LoadScript ) );
|
||||
|
||||
// Special module that always exists
|
||||
$this->register( 'startup', [ 'class' => ResourceLoaderStartUpModule::class ] );
|
||||
|
|
@ -369,7 +370,7 @@ class ResourceLoader implements LoggerAwareInterface {
|
|||
public function registerTestModules(): void {
|
||||
global $IP;
|
||||
|
||||
if ( $this->config->get( 'EnableJavaScriptTest' ) !== true ) {
|
||||
if ( $this->config->get( MainConfigNames::EnableJavaScriptTest ) !== true ) {
|
||||
throw new MWException( 'Attempt to register JavaScript test modules '
|
||||
. 'but <code>$wgEnableJavaScriptTest</code> is false. '
|
||||
. 'Edit your <code>LocalSettings.php</code> to enable it.' );
|
||||
|
|
@ -837,7 +838,7 @@ class ResourceLoader implements LoggerAwareInterface {
|
|||
}
|
||||
|
||||
// Use file cache if enabled and available...
|
||||
if ( $this->config->get( 'UseFileCache' ) ) {
|
||||
if ( $this->config->get( MainConfigNames::UseFileCache ) ) {
|
||||
$fileCache = ResourceFileCache::newFromContext( $context );
|
||||
if ( $this->tryRespondFromFileCache( $fileCache, $context, $etag ) ) {
|
||||
return; // output handled
|
||||
|
|
@ -925,7 +926,7 @@ class ResourceLoader implements LoggerAwareInterface {
|
|||
ResourceLoaderContext $context, $etag, $errors, array $extra = []
|
||||
): void {
|
||||
HeaderCallback::warnIfHeadersSent();
|
||||
$rlMaxage = $this->config->get( 'ResourceLoaderMaxage' );
|
||||
$rlMaxage = $this->config->get( MainConfigNames::ResourceLoaderMaxage );
|
||||
// Use a short cache expiry so that updates propagate to clients quickly, if:
|
||||
// - No version specified (shared resources, e.g. stylesheets)
|
||||
// - There were errors (recover quickly)
|
||||
|
|
@ -1017,7 +1018,7 @@ class ResourceLoader implements LoggerAwareInterface {
|
|||
ResourceLoaderContext $context,
|
||||
$etag
|
||||
) {
|
||||
$rlMaxage = $this->config->get( 'ResourceLoaderMaxage' );
|
||||
$rlMaxage = $this->config->get( MainConfigNames::ResourceLoaderMaxage );
|
||||
// Buffer output to catch warnings.
|
||||
ob_start();
|
||||
// Get the maximum age the cache can be
|
||||
|
|
@ -1089,7 +1090,8 @@ class ResourceLoader implements LoggerAwareInterface {
|
|||
* @return string Sanitized text that can be returned to the user
|
||||
*/
|
||||
protected static function formatExceptionNoComment( Throwable $e ) {
|
||||
$showExceptionDetails = MediaWikiServices::getInstance()->getMainConfig()->get( 'ShowExceptionDetails' );
|
||||
$showExceptionDetails = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::ShowExceptionDetails );
|
||||
|
||||
if ( !$showExceptionDetails ) {
|
||||
return MWExceptionHandler::getPublicLogMessage( $e );
|
||||
|
|
@ -1729,7 +1731,8 @@ MESSAGE;
|
|||
public static function inDebugMode() {
|
||||
if ( self::$debugMode === null ) {
|
||||
global $wgRequest;
|
||||
$resourceLoaderDebug = MediaWikiServices::getInstance()->getMainConfig()->get( 'ResourceLoaderDebug' );
|
||||
$resourceLoaderDebug = MediaWikiServices::getInstance()->getMainConfig()->get(
|
||||
MainConfigNames::ResourceLoaderDebug );
|
||||
$str = $wgRequest->getRawVal( 'debug',
|
||||
$wgRequest->getCookie( 'resourceLoaderDebug', '', $resourceLoaderDebug ? 'true' : '' )
|
||||
);
|
||||
|
|
@ -1968,7 +1971,7 @@ MESSAGE;
|
|||
}
|
||||
}
|
||||
|
||||
$illegalFileChars = $conf->get( 'IllegalFileChars' );
|
||||
$illegalFileChars = $conf->get( MainConfigNames::IllegalFileChars );
|
||||
|
||||
// Build list of variables
|
||||
$skin = $context->getSkin();
|
||||
|
|
@ -1977,26 +1980,26 @@ MESSAGE;
|
|||
$vars = [
|
||||
'debug' => $context->getDebug(),
|
||||
'skin' => $skin,
|
||||
'stylepath' => $conf->get( 'StylePath' ),
|
||||
'wgArticlePath' => $conf->get( 'ArticlePath' ),
|
||||
'wgScriptPath' => $conf->get( 'ScriptPath' ),
|
||||
'wgScript' => $conf->get( 'Script' ),
|
||||
'wgSearchType' => $conf->get( 'SearchType' ),
|
||||
'wgVariantArticlePath' => $conf->get( 'VariantArticlePath' ),
|
||||
'wgServer' => $conf->get( 'Server' ),
|
||||
'wgServerName' => $conf->get( 'ServerName' ),
|
||||
'stylepath' => $conf->get( MainConfigNames::StylePath ),
|
||||
'wgArticlePath' => $conf->get( MainConfigNames::ArticlePath ),
|
||||
'wgScriptPath' => $conf->get( MainConfigNames::ScriptPath ),
|
||||
'wgScript' => $conf->get( MainConfigNames::Script ),
|
||||
'wgSearchType' => $conf->get( MainConfigNames::SearchType ),
|
||||
'wgVariantArticlePath' => $conf->get( MainConfigNames::VariantArticlePath ),
|
||||
'wgServer' => $conf->get( MainConfigNames::Server ),
|
||||
'wgServerName' => $conf->get( MainConfigNames::ServerName ),
|
||||
'wgUserLanguage' => $context->getLanguage(),
|
||||
'wgContentLanguage' => $contLang->getCode(),
|
||||
'wgVersion' => MW_VERSION,
|
||||
'wgFormattedNamespaces' => $contLang->getFormattedNamespaces(),
|
||||
'wgNamespaceIds' => $namespaceIds,
|
||||
'wgContentNamespaces' => $nsInfo->getContentNamespaces(),
|
||||
'wgSiteName' => $conf->get( 'Sitename' ),
|
||||
'wgDBname' => $conf->get( 'DBname' ),
|
||||
'wgSiteName' => $conf->get( MainConfigNames::Sitename ),
|
||||
'wgDBname' => $conf->get( MainConfigNames::DBname ),
|
||||
'wgWikiID' => WikiMap::getCurrentWikiId(),
|
||||
'wgCaseSensitiveNamespaces' => $caseSensitiveNamespaces,
|
||||
'wgCommentCodePointLimit' => CommentStore::COMMENT_CHARACTER_LIMIT,
|
||||
'wgExtensionAssetsPath' => $conf->get( 'ExtensionAssetsPath' ),
|
||||
'wgExtensionAssetsPath' => $conf->get( MainConfigNames::ExtensionAssetsPath ),
|
||||
];
|
||||
// End of stable config vars.
|
||||
|
||||
|
|
@ -2007,11 +2010,11 @@ MESSAGE;
|
|||
// @internal For mediawiki.page.watch
|
||||
// Force object to avoid "empty" associative array from
|
||||
// becoming [] instead of {} in JS (T36604)
|
||||
'wgActionPaths' => (object)$conf->get( 'ActionPaths' ),
|
||||
'wgActionPaths' => (object)$conf->get( MainConfigNames::ActionPaths ),
|
||||
// @internal For mediawiki.language
|
||||
'wgTranslateNumerals' => $conf->get( 'TranslateNumerals' ),
|
||||
'wgTranslateNumerals' => $conf->get( MainConfigNames::TranslateNumerals ),
|
||||
// @internal For mediawiki.Title
|
||||
'wgExtraSignatureNamespaces' => $conf->get( 'ExtraSignatureNamespaces' ),
|
||||
'wgExtraSignatureNamespaces' => $conf->get( MainConfigNames::ExtraSignatureNamespaces ),
|
||||
'wgLegalTitleChars' => Title::convertByteClassToUnicodeClass( Title::legalChars() ),
|
||||
'wgIllegalFileChars' => Title::convertByteClassToUnicodeClass( $illegalFileChars ),
|
||||
];
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
*/
|
||||
|
||||
use MediaWiki\Languages\LanguageFallback;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use Wikimedia\Minify\CSSMin;
|
||||
use Wikimedia\RequestTimeout\TimeoutException;
|
||||
|
|
@ -389,7 +390,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
|
|||
public function getScriptURLsForDebug( ResourceLoaderContext $context ) {
|
||||
$rl = $context->getResourceLoader();
|
||||
$config = $this->getConfig();
|
||||
$server = $config->get( 'Server' );
|
||||
$server = $config->get( MainConfigNames::Server );
|
||||
|
||||
$urls = [];
|
||||
foreach ( $this->getScriptFiles( $context ) as $file ) {
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
*/
|
||||
|
||||
use MediaWiki\HookContainer\HookContainer;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\ResourceLoader\HookRunner;
|
||||
use Psr\Log\LoggerAwareInterface;
|
||||
|
|
@ -335,7 +336,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
|
|||
);
|
||||
|
||||
// Expand debug URL in case we are another wiki's module source (T255367)
|
||||
$url = $rl->expandUrl( $this->getConfig()->get( 'Server' ), $url );
|
||||
$url = $rl->expandUrl( $this->getConfig()->get( MainConfigNames::Server ), $url );
|
||||
|
||||
return [ $url ];
|
||||
}
|
||||
|
|
@ -1042,7 +1043,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
|
|||
protected function validateScriptFile( $fileName, $contents ) {
|
||||
$error = null;
|
||||
|
||||
if ( $this->getConfig()->get( 'ResourceLoaderValidateJS' ) ) {
|
||||
if ( $this->getConfig()->get( MainConfigNames::ResourceLoaderValidateJS ) ) {
|
||||
$cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
|
||||
// Cache potentially slow parsing of JavaScript code during the
|
||||
// critical path. This happens lazily when responding to requests
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Permissions\Authority;
|
||||
|
||||
|
|
@ -159,7 +160,9 @@ class SkinTemplate extends Skin {
|
|||
$config = $this->getConfig();
|
||||
|
||||
$footericons = [];
|
||||
foreach ( $config->get( 'FooterIcons' ) as $footerIconsKey => &$footerIconsBlock ) {
|
||||
foreach (
|
||||
$config->get( MainConfigNames::FooterIcons ) as $footerIconsKey => &$footerIconsBlock
|
||||
) {
|
||||
if ( count( $footerIconsBlock ) > 0 ) {
|
||||
$footericons[$footerIconsKey] = [];
|
||||
foreach ( $footerIconsBlock as &$footerIcon ) {
|
||||
|
|
@ -232,9 +235,9 @@ class SkinTemplate extends Skin {
|
|||
$feeds = $this->buildFeedUrls();
|
||||
$tpl->set( 'feeds', count( $feeds ) ? $feeds : false );
|
||||
|
||||
$tpl->set( 'mimetype', $config->get( 'MimeType' ) );
|
||||
$tpl->set( 'mimetype', $config->get( MainConfigNames::MimeType ) );
|
||||
$tpl->set( 'charset', 'UTF-8' );
|
||||
$tpl->set( 'wgScript', $config->get( 'Script' ) );
|
||||
$tpl->set( 'wgScript', $config->get( MainConfigNames::Script ) );
|
||||
$tpl->set( 'skinname', $this->skinname );
|
||||
$tpl->set( 'skinclass', static::class );
|
||||
$tpl->set( 'skin', $this );
|
||||
|
|
@ -250,13 +253,13 @@ class SkinTemplate extends Skin {
|
|||
|
||||
$tpl->set( 'searchtitle', $searchTitle->getPrefixedDBkey() );
|
||||
$tpl->set( 'search', trim( $request->getVal( 'search' ) ) );
|
||||
$tpl->set( 'stylepath', $config->get( 'StylePath' ) );
|
||||
$tpl->set( 'articlepath', $config->get( 'ArticlePath' ) );
|
||||
$tpl->set( 'scriptpath', $config->get( 'ScriptPath' ) );
|
||||
$tpl->set( 'serverurl', $config->get( 'Server' ) );
|
||||
$tpl->set( 'stylepath', $config->get( MainConfigNames::StylePath ) );
|
||||
$tpl->set( 'articlepath', $config->get( MainConfigNames::ArticlePath ) );
|
||||
$tpl->set( 'scriptpath', $config->get( MainConfigNames::ScriptPath ) );
|
||||
$tpl->set( 'serverurl', $config->get( MainConfigNames::Server ) );
|
||||
$logos = ResourceLoaderSkinModule::getAvailableLogos( $config );
|
||||
$tpl->set( 'logopath', $logos['1x'] );
|
||||
$tpl->set( 'sitename', $config->get( 'Sitename' ) );
|
||||
$tpl->set( 'sitename', $config->get( MainConfigNames::Sitename ) );
|
||||
|
||||
$userLang = $this->getLanguage();
|
||||
$userLangCode = $userLang->getHtmlCode();
|
||||
|
|
@ -614,7 +617,7 @@ class SkinTemplate extends Skin {
|
|||
protected function useCombinedLoginLink() {
|
||||
$services = MediaWikiServices::getInstance();
|
||||
$authManager = $services->getAuthManager();
|
||||
$useCombinedLoginLink = $this->getConfig()->get( 'UseCombinedLoginLink' );
|
||||
$useCombinedLoginLink = $this->getConfig()->get( MainConfigNames::UseCombinedLoginLink );
|
||||
if ( !$authManager->canCreateAccounts() || !$authManager->canAuthenticateNow() ) {
|
||||
// don't show combined login/signup link if one of those is actually not available
|
||||
$useCombinedLoginLink = false;
|
||||
|
|
@ -1105,7 +1108,7 @@ class SkinTemplate extends Skin {
|
|||
);
|
||||
|
||||
// Add class identifying the page is temporarily watched, if applicable.
|
||||
if ( $this->getConfig()->get( 'WatchlistExpiry' ) &&
|
||||
if ( $this->getConfig()->get( MainConfigNames::WatchlistExpiry ) &&
|
||||
MediaWikiServices::getInstance()->getWatchlistManager()->isTempWatched( $performer, $title )
|
||||
) {
|
||||
$class .= ' mw-watchlink-temp';
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
*/
|
||||
|
||||
use MediaWiki\Logger\LoggerFactory;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\User\UserIdentity;
|
||||
use OOUI\IconWidget;
|
||||
|
|
@ -602,7 +603,7 @@ abstract class ChangesListSpecialPage extends SpecialPage {
|
|||
$this->considerActionsForDefaultSavedQuery( $subpage );
|
||||
|
||||
// Enable OOUI and module for the clock icon.
|
||||
if ( $this->getConfig()->get( 'WatchlistExpiry' ) ) {
|
||||
if ( $this->getConfig()->get( MainConfigNames::WatchlistExpiry ) ) {
|
||||
$this->getOutput()->enableOOUI();
|
||||
$this->getOutput()->addModules( 'mediawiki.special.changeslist.watchlistexpiry' );
|
||||
}
|
||||
|
|
@ -667,7 +668,7 @@ abstract class ChangesListSpecialPage extends SpecialPage {
|
|||
$this->outputTimeout();
|
||||
}
|
||||
|
||||
if ( $this->getConfig()->get( 'EnableWANCacheReaper' ) ) {
|
||||
if ( $this->getConfig()->get( MainConfigNames::EnableWANCacheReaper ) ) {
|
||||
// Clean up any bad page entries for titles showing up in RC
|
||||
DeferredUpdates::addUpdate( new WANCacheReapUpdate(
|
||||
$this->getDB(),
|
||||
|
|
@ -757,9 +758,9 @@ abstract class ChangesListSpecialPage extends SpecialPage {
|
|||
* @return int[]
|
||||
*/
|
||||
protected function getLinkDays() {
|
||||
$linkDays = $this->getConfig()->get( 'RCLinkDays' );
|
||||
$filterByAge = $this->getConfig()->get( 'RCFilterByAge' );
|
||||
$maxAge = $this->getConfig()->get( 'RCMaxAge' );
|
||||
$linkDays = $this->getConfig()->get( MainConfigNames::RCLinkDays );
|
||||
$filterByAge = $this->getConfig()->get( MainConfigNames::RCFilterByAge );
|
||||
$maxAge = $this->getConfig()->get( MainConfigNames::RCMaxAge );
|
||||
if ( $filterByAge ) {
|
||||
// Trim it to only links which are within $wgRCMaxAge.
|
||||
// Note that we allow one link higher than the max for things like
|
||||
|
|
@ -808,8 +809,9 @@ abstract class ChangesListSpecialPage extends SpecialPage {
|
|||
$out->addJsConfigVars(
|
||||
'StructuredChangeFiltersDisplayConfig',
|
||||
[
|
||||
'maxDays' => (int)$this->getConfig()->get( 'RCMaxAge' ) / ( 24 * 3600 ), // Translate to days
|
||||
'limitArray' => $this->getConfig()->get( 'RCLinkLimits' ),
|
||||
'maxDays' => // Translate to days
|
||||
(int)$this->getConfig()->get( MainConfigNames::RCMaxAge ) / ( 24 * 3600 ),
|
||||
'limitArray' => $this->getConfig()->get( MainConfigNames::RCLinkLimits ),
|
||||
'limitDefault' => $this->getDefaultLimit(),
|
||||
'daysArray' => $this->getLinkDays(),
|
||||
'daysDefault' => $this->getDefaultDays(),
|
||||
|
|
@ -950,7 +952,7 @@ abstract class ChangesListSpecialPage extends SpecialPage {
|
|||
|
||||
$changeTypeGroup = $this->getFilterGroup( 'changeType' );
|
||||
|
||||
if ( $this->getConfig()->get( 'RCWatchCategoryMembership' ) ) {
|
||||
if ( $this->getConfig()->get( MainConfigNames::RCWatchCategoryMembership ) ) {
|
||||
$transformedHideCategorizationDef = $this->transformFilterDefinition(
|
||||
$this->hideCategorizationFilterDefinition
|
||||
);
|
||||
|
|
@ -1263,7 +1265,8 @@ abstract class ChangesListSpecialPage extends SpecialPage {
|
|||
}
|
||||
|
||||
$opts->validateIntBounds( 'limit', 0, 5000 );
|
||||
$opts->validateBounds( 'days', 0, $this->getConfig()->get( 'RCMaxAge' ) / ( 3600 * 24 ) );
|
||||
$opts->validateBounds( 'days', 0,
|
||||
$this->getConfig()->get( MainConfigNames::RCMaxAge ) / ( 3600 * 24 ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1622,7 +1625,7 @@ abstract class ChangesListSpecialPage extends SpecialPage {
|
|||
# The legend showing what the letters and stuff mean
|
||||
$legend = Html::openElement( 'dl' ) . "\n";
|
||||
# Iterates through them and gets the messages for both letter and tooltip
|
||||
$legendItems = $context->getConfig()->get( 'RecentChangesFlags' );
|
||||
$legendItems = $context->getConfig()->get( MainConfigNames::RecentChangesFlags );
|
||||
if ( !( $user->useRCPatrol() || $user->useNPPatrol() ) ) {
|
||||
unset( $legendItems['unpatrolled'] );
|
||||
}
|
||||
|
|
@ -1650,7 +1653,7 @@ abstract class ChangesListSpecialPage extends SpecialPage {
|
|||
$context->msg( 'recentchanges-label-plusminus' )->text()
|
||||
) . "\n";
|
||||
// Watchlist expiry clock icon.
|
||||
if ( $context->getConfig()->get( 'WatchlistExpiry' ) ) {
|
||||
if ( $context->getConfig()->get( MainConfigNames::WatchlistExpiry ) ) {
|
||||
$widget = new IconWidget( [
|
||||
'icon' => 'clock',
|
||||
'classes' => [ 'mw-changesList-watchlistExpiry' ],
|
||||
|
|
@ -1771,12 +1774,14 @@ abstract class ChangesListSpecialPage extends SpecialPage {
|
|||
}
|
||||
$secondsPerDay = 86400;
|
||||
$config = $this->getConfig();
|
||||
$learnerCutoff = $now - $config->get( 'LearnerMemberSince' ) * $secondsPerDay;
|
||||
$experiencedUserCutoff = $now - $config->get( 'ExperiencedUserMemberSince' ) * $secondsPerDay;
|
||||
$learnerCutoff =
|
||||
$now - $config->get( MainConfigNames::LearnerMemberSince ) * $secondsPerDay;
|
||||
$experiencedUserCutoff =
|
||||
$now - $config->get( MainConfigNames::ExperiencedUserMemberSince ) * $secondsPerDay;
|
||||
|
||||
$aboveNewcomer = $dbr->makeList(
|
||||
[
|
||||
'user_editcount >= ' . intval( $config->get( 'LearnerEdits' ) ),
|
||||
'user_editcount >= ' . intval( $config->get( MainConfigNames::LearnerEdits ) ),
|
||||
$dbr->makeList( [
|
||||
'user_registration IS NULL',
|
||||
'user_registration <= ' . $dbr->addQuotes( $dbr->timestamp( $learnerCutoff ) ),
|
||||
|
|
@ -1787,7 +1792,7 @@ abstract class ChangesListSpecialPage extends SpecialPage {
|
|||
|
||||
$aboveLearner = $dbr->makeList(
|
||||
[
|
||||
'user_editcount >= ' . intval( $config->get( 'ExperiencedUserEdits' ) ),
|
||||
'user_editcount >= ' . intval( $config->get( MainConfigNames::ExperiencedUserEdits ) ),
|
||||
$dbr->makeList( [
|
||||
'user_registration IS NULL',
|
||||
'user_registration <= ' .
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ use MediaWiki\Auth\AuthenticationResponse;
|
|||
use MediaWiki\Auth\AuthManager;
|
||||
use MediaWiki\Auth\PasswordAuthenticationRequest;
|
||||
use MediaWiki\Logger\LoggerFactory;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Session\SessionManager;
|
||||
use Wikimedia\ScopedCallback;
|
||||
|
|
@ -110,7 +111,7 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage {
|
|||
$this->mAction = $request->getRawVal( 'action' );
|
||||
$this->mFromHTTP = $request->getBool( 'fromhttp', false )
|
||||
|| $request->getBool( 'wpFromhttp', false );
|
||||
$this->mStickHTTPS = $this->getConfig()->get( 'ForceHTTPS' )
|
||||
$this->mStickHTTPS = $this->getConfig()->get( MainConfigNames::ForceHTTPS )
|
||||
|| ( !$this->mFromHTTP && $request->getProtocol() === 'https' )
|
||||
|| $request->getBool( 'wpForceHttps', false );
|
||||
$this->mLanguage = $request->getText( 'uselang' );
|
||||
|
|
@ -157,7 +158,8 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage {
|
|||
'returnto' => $this->mReturnTo,
|
||||
'returntoquery' => $this->mReturnToQuery,
|
||||
'uselang' => $this->mLanguage ?: null,
|
||||
'fromhttp' => $this->getConfig()->get( 'SecureLogin' ) && $this->mFromHTTP ? '1' : null,
|
||||
'fromhttp' => $this->getConfig()->get( MainConfigNames::SecureLogin ) &&
|
||||
$this->mFromHTTP ? '1' : null,
|
||||
]
|
||||
);
|
||||
|
||||
|
|
@ -194,7 +196,7 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage {
|
|||
'returnto' => $this->mReturnTo ?: null,
|
||||
'returntoquery' => $this->mReturnToQuery ?: null,
|
||||
];
|
||||
if ( $this->getConfig()->get( 'SecureLogin' ) && !$this->isSignup() ) {
|
||||
if ( $this->getConfig()->get( MainConfigNames::SecureLogin ) && !$this->isSignup() ) {
|
||||
$params['fromhttp'] = $this->mFromHTTP ? '1' : null;
|
||||
}
|
||||
return $params;
|
||||
|
|
@ -277,7 +279,7 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage {
|
|||
: 'warning' ) => $this->mEntryError,
|
||||
] + $this->getRequest()->getQueryValues();
|
||||
$url = $title->getFullURL( $query, false, PROTO_HTTPS );
|
||||
if ( $this->getConfig()->get( 'SecureLogin' ) && !$this->mFromHTTP ) {
|
||||
if ( $this->getConfig()->get( MainConfigNames::SecureLogin ) && !$this->mFromHTTP ) {
|
||||
// Avoid infinite redirect
|
||||
$url = wfAppendQuery( $url, 'fromhttp=1' );
|
||||
$this->getOutput()->redirect( $url );
|
||||
|
|
@ -584,7 +586,8 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage {
|
|||
protected function getPageHtml( $formHtml ) {
|
||||
$loginPrompt = $this->isSignup() ? '' : Html::rawElement( 'div',
|
||||
[ 'id' => 'userloginprompt' ], $this->msg( 'loginprompt' )->parseAsBlock() );
|
||||
$languageLinks = $this->getConfig()->get( 'LoginLanguageSelector' ) ? $this->makeLanguageSelector() : '';
|
||||
$languageLinks = $this->getConfig()->get( MainConfigNames::LoginLanguageSelector )
|
||||
? $this->makeLanguageSelector() : '';
|
||||
$signupStartMsg = $this->msg( 'signupstart' );
|
||||
$signupStart = ( $this->isSignup() && !$signupStartMsg->isDisabled() )
|
||||
? Html::rawElement( 'div', [ 'id' => 'signupstart' ], $signupStartMsg->parseAsBlock() ) : '';
|
||||
|
|
@ -677,7 +680,8 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage {
|
|||
$form->addHiddenField( 'force', $this->securityLevel );
|
||||
$form->addHiddenField( $this->getTokenName(), $this->getToken()->toString() );
|
||||
$config = $this->getConfig();
|
||||
if ( $config->get( 'SecureLogin' ) && !$config->get( 'ForceHTTPS' ) ) {
|
||||
if ( $config->get( MainConfigNames::SecureLogin ) &&
|
||||
!$config->get( MainConfigNames::ForceHTTPS ) ) {
|
||||
// If using HTTPS coming from HTTP, then the 'fromhttp' parameter must be preserved
|
||||
if ( !$this->isSignup() ) {
|
||||
$form->addHiddenField( 'wpForceHttps', (int)$this->mStickHTTPS );
|
||||
|
|
@ -797,18 +801,19 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage {
|
|||
] + $hideIf,
|
||||
'email' => [
|
||||
'type' => 'email',
|
||||
'label-message' => $config->get( 'EmailConfirmToEdit' ) ? 'createacct-emailrequired'
|
||||
: 'createacct-emailoptional',
|
||||
'label-message' => $config->get( MainConfigNames::EmailConfirmToEdit )
|
||||
? 'createacct-emailrequired' : 'createacct-emailoptional',
|
||||
'id' => 'wpEmail',
|
||||
'cssclass' => 'loginText',
|
||||
'size' => '20',
|
||||
'autocomplete' => 'email',
|
||||
// FIXME will break non-standard providers
|
||||
'required' => $config->get( 'EmailConfirmToEdit' ),
|
||||
'required' => $config->get( MainConfigNames::EmailConfirmToEdit ),
|
||||
'validation-callback' => function ( $value, $alldata ) {
|
||||
// AuthManager will check most of these, but that will make the auth
|
||||
// session fail and this won't, so nicer to do it this way
|
||||
if ( !$value && $this->getConfig()->get( 'EmailConfirmToEdit' ) ) {
|
||||
if ( !$value &&
|
||||
$this->getConfig()->get( MainConfigNames::EmailConfirmToEdit ) ) {
|
||||
// no point in allowing registration without email when email is
|
||||
// required to edit
|
||||
return $this->msg( 'noemailtitle' );
|
||||
|
|
@ -1063,7 +1068,7 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage {
|
|||
*/
|
||||
protected function hasSessionCookie() {
|
||||
$config = $this->getConfig();
|
||||
return $config->get( 'DisableCookieCheck' ) || (
|
||||
return $config->get( MainConfigNames::DisableCookieCheck ) || (
|
||||
$config->get( 'InitialSessionId' ) &&
|
||||
$this->getRequest()->getSession()->getId() === (string)$config->get( 'InitialSessionId' )
|
||||
);
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
use MediaWiki\Cache\LinkBatchFactory;
|
||||
use MediaWiki\Linker\LinkTarget;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use Wikimedia\Rdbms\DBError;
|
||||
use Wikimedia\Rdbms\IDatabase;
|
||||
|
|
@ -155,7 +156,7 @@ abstract class QueryPage extends SpecialPage {
|
|||
* @return string[]
|
||||
*/
|
||||
public static function getDisabledQueryPages( Config $config ) {
|
||||
$disableQueryPageUpdate = $config->get( 'DisableQueryPageUpdate' );
|
||||
$disableQueryPageUpdate = $config->get( MainConfigNames::DisableQueryPageUpdate );
|
||||
|
||||
if ( !is_array( $disableQueryPageUpdate ) ) {
|
||||
return [];
|
||||
|
|
@ -273,7 +274,7 @@ abstract class QueryPage extends SpecialPage {
|
|||
* @return bool
|
||||
*/
|
||||
public function isExpensive() {
|
||||
return $this->getConfig()->get( 'DisableQueryPages' );
|
||||
return $this->getConfig()->get( MainConfigNames::DisableQueryPages );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -296,7 +297,7 @@ abstract class QueryPage extends SpecialPage {
|
|||
* @return bool
|
||||
*/
|
||||
public function isCached() {
|
||||
return $this->isExpensive() && $this->getConfig()->get( 'MiserMode' );
|
||||
return $this->isExpensive() && $this->getConfig()->get( MainConfigNames::MiserMode );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -630,7 +631,7 @@ abstract class QueryPage extends SpecialPage {
|
|||
protected function getLimitOffset() {
|
||||
list( $limit, $offset ) = $this->getRequest()
|
||||
->getLimitOffsetForUser( $this->getUser() );
|
||||
if ( $this->getConfig()->get( 'MiserMode' ) ) {
|
||||
if ( $this->getConfig()->get( MainConfigNames::MiserMode ) ) {
|
||||
$maxResults = $this->getMaxResults();
|
||||
// Can't display more than max results on a page
|
||||
$limit = min( $limit, $maxResults );
|
||||
|
|
@ -650,7 +651,7 @@ abstract class QueryPage extends SpecialPage {
|
|||
*/
|
||||
protected function getDBLimit( $uiLimit, $uiOffset ) {
|
||||
$maxResults = $this->getMaxResults();
|
||||
if ( $this->getConfig()->get( 'MiserMode' ) ) {
|
||||
if ( $this->getConfig()->get( MainConfigNames::MiserMode ) ) {
|
||||
$limit = min( $uiLimit + 1, $maxResults - $uiOffset );
|
||||
return max( $limit, 0 );
|
||||
} else {
|
||||
|
|
@ -670,7 +671,7 @@ abstract class QueryPage extends SpecialPage {
|
|||
*/
|
||||
protected function getMaxResults() {
|
||||
// Max of 10000, unless we store more than 10000 in query cache.
|
||||
return max( $this->getConfig()->get( 'QueryCacheLimit' ), 10000 );
|
||||
return max( $this->getConfig()->get( MainConfigNames::QueryCacheLimit ), 10000 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -709,7 +710,8 @@ abstract class QueryPage extends SpecialPage {
|
|||
// Fetch the timestamp of this update
|
||||
$ts = $this->getCachedTimestamp();
|
||||
$lang = $this->getLanguage();
|
||||
$maxResults = $lang->formatNum( $this->getConfig()->get( 'QueryCacheLimit' ) );
|
||||
$maxResults = $lang->formatNum( $this->getConfig()->get(
|
||||
MainConfigNames::QueryCacheLimit ) );
|
||||
|
||||
if ( $ts ) {
|
||||
$user = $this->getUser();
|
||||
|
|
@ -759,7 +761,7 @@ abstract class QueryPage extends SpecialPage {
|
|||
min( $this->numRows, $this->limit ), // do not show the one extra row, if exist
|
||||
$this->offset + 1, ( min( $this->numRows, $this->limit ) + $this->offset ) )->parseAsBlock() );
|
||||
// Disable the "next" link when we reach the end
|
||||
$miserMaxResults = $this->getConfig()->get( 'MiserMode' )
|
||||
$miserMaxResults = $this->getConfig()->get( MainConfigNames::MiserMode )
|
||||
&& ( $this->offset + $this->limit >= $this->getMaxResults() );
|
||||
$atEnd = ( $this->numRows <= $this->limit ) || $miserMaxResults;
|
||||
$paging = $this->buildPrevNextNavigation( $this->offset,
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ use MediaWiki\Auth\AuthManager;
|
|||
use MediaWiki\HookContainer\HookContainer;
|
||||
use MediaWiki\HookContainer\HookRunner;
|
||||
use MediaWiki\Linker\LinkRenderer;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Navigation\PrevNextNavigationRenderer;
|
||||
use MediaWiki\Permissions\Authority;
|
||||
|
|
@ -271,7 +272,7 @@ class SpecialPage implements MessageLocalizer {
|
|||
* false to use the parent page's cache settings
|
||||
*/
|
||||
public function maxIncludeCacheTime() {
|
||||
return $this->getConfig()->get( 'MiserMode' ) ? $this->getCacheTTL() : 0;
|
||||
return $this->getConfig()->get( MainConfigNames::MiserMode ) ? $this->getCacheTTL() : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -644,7 +645,7 @@ class SpecialPage implements MessageLocalizer {
|
|||
$out->setArticleRelated( false );
|
||||
$out->setRobotPolicy( $this->getRobotPolicy() );
|
||||
$out->setPageTitle( $this->getDescription() );
|
||||
if ( $this->getConfig()->get( 'UseMediaWikiUIEverywhere' ) ) {
|
||||
if ( $this->getConfig()->get( MainConfigNames::UseMediaWikiUIEverywhere ) ) {
|
||||
$out->addModuleStyles( [
|
||||
'mediawiki.ui.input',
|
||||
'mediawiki.ui.radio',
|
||||
|
|
@ -953,7 +954,7 @@ class SpecialPage implements MessageLocalizer {
|
|||
protected function addFeedLinks( $params ) {
|
||||
$feedTemplate = wfScript( 'api' );
|
||||
|
||||
foreach ( $this->getConfig()->get( 'FeedClasses' ) as $format => $class ) {
|
||||
foreach ( $this->getConfig()->get( MainConfigNames::FeedClasses ) as $format => $class ) {
|
||||
$theseParams = $params + [ 'feedformat' => $format ];
|
||||
$url = wfAppendQuery( $feedTemplate, $theseParams );
|
||||
$this->getOutput()->addFeedLink( $format, $url );
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ use MediaWiki\Config\ServiceOptions;
|
|||
use MediaWiki\HookContainer\HookContainer;
|
||||
use MediaWiki\HookContainer\HookRunner;
|
||||
use MediaWiki\Linker\LinkRenderer;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\Page\PageReference;
|
||||
use Profiler;
|
||||
use RequestContext;
|
||||
|
|
@ -1340,7 +1341,7 @@ class SpecialPageFactory {
|
|||
|
||||
if ( !$including ) {
|
||||
// Narrow DB query expectations for this HTTP request
|
||||
$trxLimits = $context->getConfig()->get( 'TrxProfilerLimits' );
|
||||
$trxLimits = $context->getConfig()->get( MainConfigNames::TrxProfilerLimits );
|
||||
$trxProfiler = Profiler::instance()->getTransactionProfiler();
|
||||
if ( $context->getRequest()->wasPosted() && !$page->doesWrites() ) {
|
||||
$trxProfiler->setExpectations( $trxLimits['POST-nonwrite'], __METHOD__ );
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
use MediaWiki\Export\WikiExporterFactory;
|
||||
use MediaWiki\Logger\LoggerFactory;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use Wikimedia\Rdbms\ILoadBalancer;
|
||||
|
||||
/**
|
||||
|
|
@ -97,7 +98,8 @@ class SpecialExport extends SpecialPage {
|
|||
}
|
||||
}
|
||||
}
|
||||
} elseif ( $request->getCheck( 'addns' ) && $config->get( 'ExportFromNamespaces' ) ) {
|
||||
} elseif ( $request->getCheck( 'addns' ) &&
|
||||
$config->get( MainConfigNames::ExportFromNamespaces ) ) {
|
||||
$page = $request->getText( 'pages' );
|
||||
$nsindex = $request->getText( 'nsindex', '' );
|
||||
|
||||
|
|
@ -110,7 +112,8 @@ class SpecialExport extends SpecialPage {
|
|||
$page .= "\n" . implode( "\n", $nspages );
|
||||
}
|
||||
}
|
||||
} elseif ( $request->getCheck( 'exportall' ) && $config->get( 'ExportAllowAll' ) ) {
|
||||
} elseif ( $request->getCheck( 'exportall' ) &&
|
||||
$config->get( MainConfigNames::ExportAllowAll ) ) {
|
||||
$this->doExport = true;
|
||||
$exportall = true;
|
||||
|
||||
|
|
@ -140,7 +143,7 @@ class SpecialExport extends SpecialPage {
|
|||
$offset = null;
|
||||
}
|
||||
|
||||
$maxHistory = $config->get( 'ExportMaxHistory' );
|
||||
$maxHistory = $config->get( MainConfigNames::ExportMaxHistory );
|
||||
$limit = $request->getInt( 'limit' );
|
||||
$dir = $request->getVal( 'dir' );
|
||||
$history = [
|
||||
|
|
@ -185,13 +188,13 @@ class SpecialExport extends SpecialPage {
|
|||
}
|
||||
}
|
||||
|
||||
if ( !$config->get( 'ExportAllowHistory' ) ) {
|
||||
if ( !$config->get( MainConfigNames::ExportAllowHistory ) ) {
|
||||
// Override
|
||||
$history = WikiExporter::CURRENT;
|
||||
}
|
||||
|
||||
$list_authors = $request->getCheck( 'listauthors' );
|
||||
if ( !$this->curonly || !$config->get( 'ExportAllowListContributors' ) ) {
|
||||
if ( !$this->curonly || !$config->get( MainConfigNames::ExportAllowListContributors ) ) {
|
||||
$list_authors = false;
|
||||
}
|
||||
|
||||
|
|
@ -206,7 +209,8 @@ class SpecialExport extends SpecialPage {
|
|||
|
||||
if ( $request->getCheck( 'wpDownload' ) ) {
|
||||
// Provide a sensible filename suggestion
|
||||
$filename = urlencode( $config->get( 'Sitename' ) . '-' . wfTimestampNow() . '.xml' );
|
||||
$filename = urlencode( $config->get( MainConfigNames::Sitename ) . '-' .
|
||||
wfTimestampNow() . '.xml' );
|
||||
$request->response()->header( "Content-disposition: attachment;filename={$filename}" );
|
||||
}
|
||||
|
||||
|
|
@ -225,7 +229,7 @@ class SpecialExport extends SpecialPage {
|
|||
} else {
|
||||
$categoryName = '';
|
||||
}
|
||||
$canExportAll = $config->get( 'ExportAllowAll' );
|
||||
$canExportAll = $config->get( MainConfigNames::ExportAllowAll );
|
||||
$hideIf = $canExportAll ? [ 'hide-if' => [ '===', 'exportall', '1' ] ] : [];
|
||||
|
||||
$formDescriptor = [
|
||||
|
|
@ -241,7 +245,7 @@ class SpecialExport extends SpecialPage {
|
|||
'buttondefault' => $this->msg( 'export-addcat' )->text(),
|
||||
] + $hideIf,
|
||||
];
|
||||
if ( $config->get( 'ExportFromNamespaces' ) ) {
|
||||
if ( $config->get( MainConfigNames::ExportFromNamespaces ) ) {
|
||||
$formDescriptor += [
|
||||
'nsindex' => [
|
||||
'type' => 'namespaceselectwithbutton',
|
||||
|
|
@ -281,7 +285,7 @@ class SpecialExport extends SpecialPage {
|
|||
] + $hideIf,
|
||||
];
|
||||
|
||||
if ( $config->get( 'ExportAllowHistory' ) ) {
|
||||
if ( $config->get( MainConfigNames::ExportAllowHistory ) ) {
|
||||
$formDescriptor += [
|
||||
'curonly' => [
|
||||
'type' => 'check',
|
||||
|
|
@ -305,7 +309,8 @@ class SpecialExport extends SpecialPage {
|
|||
],
|
||||
];
|
||||
|
||||
if ( $config->get( 'ExportMaxLinkDepth' ) || $this->userCanOverrideExportDepth() ) {
|
||||
if ( $config->get( MainConfigNames::ExportMaxLinkDepth ) ||
|
||||
$this->userCanOverrideExportDepth() ) {
|
||||
$formDescriptor += [
|
||||
'pagelink-depth' => [
|
||||
'type' => 'text',
|
||||
|
|
@ -328,7 +333,7 @@ class SpecialExport extends SpecialPage {
|
|||
],
|
||||
];
|
||||
|
||||
if ( $config->get( 'ExportAllowListContributors' ) ) {
|
||||
if ( $config->get( MainConfigNames::ExportAllowListContributors ) ) {
|
||||
$formDescriptor += [
|
||||
'listauthors' => [
|
||||
'type' => 'check',
|
||||
|
|
@ -438,7 +443,7 @@ class SpecialExport extends SpecialPage {
|
|||
* @return string[]
|
||||
*/
|
||||
protected function getPagesFromCategory( $title ) {
|
||||
$maxPages = $this->getConfig()->get( 'ExportPagelistLimit' );
|
||||
$maxPages = $this->getConfig()->get( MainConfigNames::ExportPagelistLimit );
|
||||
|
||||
$name = $title->getDBkey();
|
||||
|
||||
|
|
@ -465,7 +470,7 @@ class SpecialExport extends SpecialPage {
|
|||
* @return string[]
|
||||
*/
|
||||
protected function getPagesFromNamespace( $nsindex ) {
|
||||
$maxPages = $this->getConfig()->get( 'ExportPagelistLimit' );
|
||||
$maxPages = $this->getConfig()->get( MainConfigNames::ExportPagelistLimit );
|
||||
|
||||
$dbr = $this->loadBalancer->getConnectionRef( ILoadBalancer::DB_REPLICA );
|
||||
$res = $dbr->select(
|
||||
|
|
@ -525,7 +530,7 @@ class SpecialExport extends SpecialPage {
|
|||
}
|
||||
|
||||
if ( !$this->userCanOverrideExportDepth() ) {
|
||||
$maxLinkDepth = $this->getConfig()->get( 'ExportMaxLinkDepth' );
|
||||
$maxLinkDepth = $this->getConfig()->get( MainConfigNames::ExportMaxLinkDepth );
|
||||
if ( $depth > $maxLinkDepth ) {
|
||||
return $maxLinkDepth;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
use MediaWiki\Cache\LinkBatchFactory;
|
||||
use MediaWiki\Content\IContentHandlerFactory;
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\Permissions\GroupPermissionsLookup;
|
||||
use MediaWiki\Revision\MutableRevisionRecord;
|
||||
use MediaWiki\Revision\RevisionLookup;
|
||||
|
|
@ -550,13 +551,13 @@ class SpecialNewpages extends IncludableSpecialPage {
|
|||
* @param string $type
|
||||
*/
|
||||
protected function feed( $type ) {
|
||||
if ( !$this->getConfig()->get( 'Feed' ) ) {
|
||||
if ( !$this->getConfig()->get( MainConfigNames::Feed ) ) {
|
||||
$this->getOutput()->addWikiMsg( 'feed-unavailable' );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$feedClasses = $this->getConfig()->get( 'FeedClasses' );
|
||||
$feedClasses = $this->getConfig()->get( MainConfigNames::FeedClasses );
|
||||
if ( !isset( $feedClasses[$type] ) ) {
|
||||
$this->getOutput()->addWikiMsg( 'feed-invalid' );
|
||||
|
||||
|
|
@ -571,7 +572,7 @@ class SpecialNewpages extends IncludableSpecialPage {
|
|||
|
||||
$pager = $this->getNewPagesPager();
|
||||
$limit = $this->opts->getValue( 'limit' );
|
||||
$pager->mLimit = min( $limit, $this->getConfig()->get( 'FeedLimit' ) );
|
||||
$pager->mLimit = min( $limit, $this->getConfig()->get( MainConfigNames::FeedLimit ) );
|
||||
|
||||
$feed->outHeader();
|
||||
if ( $pager->getNumRows() > 0 ) {
|
||||
|
|
@ -584,8 +585,8 @@ class SpecialNewpages extends IncludableSpecialPage {
|
|||
|
||||
protected function feedTitle() {
|
||||
$desc = $this->getDescription();
|
||||
$code = $this->getConfig()->get( 'LanguageCode' );
|
||||
$sitename = $this->getConfig()->get( 'Sitename' );
|
||||
$code = $this->getConfig()->get( MainConfigNames::LanguageCode );
|
||||
$sitename = $this->getConfig()->get( MainConfigNames::Sitename );
|
||||
|
||||
return "$sitename - $desc [$code]";
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue