aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--includes/ServiceWiring.php14
-rw-r--r--includes/Storage/BlobStoreFactory.php20
-rw-r--r--includes/Storage/EditResultBuilder.php5
-rw-r--r--includes/Storage/EditResultCache.php5
-rw-r--r--includes/Storage/PageUpdater.php11
-rw-r--r--includes/Storage/PageUpdaterFactory.php23
-rw-r--r--includes/Storage/RevertedTagUpdate.php7
-rw-r--r--includes/TemplateParser.php3
-rw-r--r--includes/auth/AbstractPasswordPrimaryAuthenticationProvider.php10
-rw-r--r--includes/auth/AuthManager.php18
-rw-r--r--includes/auth/EmailNotificationSecondaryAuthenticationProvider.php5
-rw-r--r--includes/auth/LocalPasswordPrimaryAuthenticationProvider.php5
-rw-r--r--includes/content/AbstractContent.php4
-rw-r--r--includes/content/JavaScriptContentHandler.php4
-rw-r--r--includes/content/TextContent.php4
-rw-r--r--includes/content/TextContentHandler.php4
-rw-r--r--includes/db/MWLBFactory.php89
-rw-r--r--includes/diff/DifferenceEngine.php9
-rw-r--r--includes/export/WikiExporter.php4
-rw-r--r--includes/export/XmlDumpWriter.php5
-rw-r--r--includes/gallery/ImageGalleryBase.php5
-rw-r--r--includes/gallery/TraditionalImageGallery.php4
-rw-r--r--includes/htmlform/HTMLForm.php15
-rw-r--r--includes/htmlform/fields/HTMLButtonField.php4
-rw-r--r--includes/htmlform/fields/HTMLCheckField.php3
-rw-r--r--includes/htmlform/fields/HTMLCheckMatrix.php4
-rw-r--r--includes/htmlform/fields/HTMLMultiSelectField.php4
-rw-r--r--includes/htmlform/fields/HTMLRadioField.php3
-rw-r--r--includes/htmlform/fields/HTMLSelectLanguageField.php6
-rw-r--r--includes/http/HttpRequestFactory.php46
-rw-r--r--includes/jobqueue/JobQueueGroupFactory.php17
-rw-r--r--includes/jobqueue/JobRunner.php24
-rw-r--r--includes/language/Language.php35
-rw-r--r--includes/language/LanguageConverter.php12
-rw-r--r--includes/language/LanguageNameUtils.php9
-rw-r--r--includes/language/Message.php7
-rw-r--r--includes/linker/LinksMigration.php3
-rw-r--r--includes/objectcache/ObjectCache.php11
-rw-r--r--includes/page/DeletePage.php20
-rw-r--r--includes/page/PageStore.php5
-rw-r--r--includes/page/RollbackPage.php12
-rw-r--r--includes/preferences/DefaultPreferencesFactory.php141
-rw-r--r--includes/preferences/SignatureValidator.php10
-rw-r--r--includes/site/Site.php4
-rw-r--r--includes/skins/BaseTemplate.php13
-rw-r--r--includes/skins/Skin.php69
-rw-r--r--includes/skins/SkinFallback.php9
-rw-r--r--includes/skins/components/SkinComponentSearch.php5
-rw-r--r--includes/specialpage/SpecialPageFactory.php29
-rw-r--r--includes/title/NamespaceInfo.php23
50 files changed, 447 insertions, 354 deletions
diff --git a/includes/ServiceWiring.php b/includes/ServiceWiring.php
index 72f38edf4384..71d4b4d53971 100644
--- a/includes/ServiceWiring.php
+++ b/includes/ServiceWiring.php
@@ -1823,7 +1823,7 @@ return [
'TempUserConfig' => static function ( MediaWikiServices $services ): RealTempUserConfig {
return new RealTempUserConfig(
- $services->getMainConfig()->get( 'AutoCreateTempUser' )
+ $services->getMainConfig()->get( MainConfigNames::AutoCreateTempUser )
);
},
@@ -1835,7 +1835,7 @@ return [
$services->getAuthManager(),
// This is supposed to match ThrottlePreAuthenticationProvider
new Throttler(
- $services->getMainConfig()->get( 'AccountCreationThrottle' ),
+ $services->getMainConfig()->get( MainConfigNames::AccountCreationThrottle ),
[
'type' => 'acctcreate',
'cache' => $services->getLocalServerObjectCache()
@@ -1894,12 +1894,12 @@ return [
'UrlUtils' => static function ( MediaWikiServices $services ): UrlUtils {
$config = $services->getMainConfig();
return new UrlUtils( [
- UrlUtils::SERVER => $config->get( 'Server' ),
- UrlUtils::CANONICAL_SERVER => $config->get( 'CanonicalServer' ),
- UrlUtils::INTERNAL_SERVER => $config->get( 'InternalServer' ),
+ UrlUtils::SERVER => $config->get( MainConfigNames::Server ),
+ UrlUtils::CANONICAL_SERVER => $config->get( MainConfigNames::CanonicalServer ),
+ UrlUtils::INTERNAL_SERVER => $config->get( MainConfigNames::InternalServer ),
UrlUtils::FALLBACK_PROTOCOL => RequestContext::getMain()->getRequest()->getProtocol(),
- UrlUtils::HTTPS_PORT => $config->get( 'HttpsPort' ),
- UrlUtils::VALID_PROTOCOLS => $config->get( 'UrlProtocols' ),
+ UrlUtils::HTTPS_PORT => $config->get( MainConfigNames::HttpsPort ),
+ UrlUtils::VALID_PROTOCOLS => $config->get( MainConfigNames::UrlProtocols ),
] );
},
diff --git a/includes/Storage/BlobStoreFactory.php b/includes/Storage/BlobStoreFactory.php
index b72cfffa21a6..285c78c60e62 100644
--- a/includes/Storage/BlobStoreFactory.php
+++ b/includes/Storage/BlobStoreFactory.php
@@ -22,6 +22,7 @@ namespace MediaWiki\Storage;
use ExternalStoreAccess;
use MediaWiki\Config\ServiceOptions;
+use MediaWiki\MainConfigNames;
use WANObjectCache;
use Wikimedia\Rdbms\ILBFactory;
@@ -58,10 +59,10 @@ class BlobStoreFactory {
* @internal For use by ServiceWiring
*/
public const CONSTRUCTOR_OPTIONS = [
- 'CompressRevisions',
- 'DefaultExternalStore',
- 'LegacyEncoding',
- 'RevisionCacheExpiry',
+ MainConfigNames::CompressRevisions,
+ MainConfigNames::DefaultExternalStore,
+ MainConfigNames::LegacyEncoding,
+ MainConfigNames::RevisionCacheExpiry,
];
public function __construct(
@@ -105,12 +106,13 @@ class BlobStoreFactory {
$dbDomain
);
- $store->setCompressBlobs( $this->options->get( 'CompressRevisions' ) );
- $store->setCacheExpiry( $this->options->get( 'RevisionCacheExpiry' ) );
- $store->setUseExternalStore( $this->options->get( 'DefaultExternalStore' ) !== false );
+ $store->setCompressBlobs( $this->options->get( MainConfigNames::CompressRevisions ) );
+ $store->setCacheExpiry( $this->options->get( MainConfigNames::RevisionCacheExpiry ) );
+ $store->setUseExternalStore(
+ $this->options->get( MainConfigNames::DefaultExternalStore ) !== false );
- if ( $this->options->get( 'LegacyEncoding' ) ) {
- $store->setLegacyEncoding( $this->options->get( 'LegacyEncoding' ) );
+ if ( $this->options->get( MainConfigNames::LegacyEncoding ) ) {
+ $store->setLegacyEncoding( $this->options->get( MainConfigNames::LegacyEncoding ) );
}
return $store;
diff --git a/includes/Storage/EditResultBuilder.php b/includes/Storage/EditResultBuilder.php
index 840ce34035d6..015bb6518337 100644
--- a/includes/Storage/EditResultBuilder.php
+++ b/includes/Storage/EditResultBuilder.php
@@ -25,6 +25,7 @@
namespace MediaWiki\Storage;
use MediaWiki\Config\ServiceOptions;
+use MediaWiki\MainConfigNames;
use MediaWiki\Revision\RevisionRecord;
use MediaWiki\Revision\RevisionStore;
use Wikimedia\Assert\Assert;
@@ -38,7 +39,7 @@ use Wikimedia\Assert\Assert;
class EditResultBuilder {
public const CONSTRUCTOR_OPTIONS = [
- 'ManualRevertSearchRadius',
+ MainConfigNames::ManualRevertSearchRadius,
];
/**
@@ -215,7 +216,7 @@ class EditResultBuilder {
* If successful, mutates the builder accordingly.
*/
private function detectManualRevert() {
- $searchRadius = $this->options->get( 'ManualRevertSearchRadius' );
+ $searchRadius = $this->options->get( MainConfigNames::ManualRevertSearchRadius );
if ( !$searchRadius ||
// we already marked this as a revert
$this->revertMethod !== null ||
diff --git a/includes/Storage/EditResultCache.php b/includes/Storage/EditResultCache.php
index 2d94acdce484..08e163656527 100644
--- a/includes/Storage/EditResultCache.php
+++ b/includes/Storage/EditResultCache.php
@@ -25,6 +25,7 @@ namespace MediaWiki\Storage;
use BagOStuff;
use FormatJson;
use MediaWiki\Config\ServiceOptions;
+use MediaWiki\MainConfigNames;
use Wikimedia\Rdbms\ILoadBalancer;
/**
@@ -42,7 +43,7 @@ use Wikimedia\Rdbms\ILoadBalancer;
class EditResultCache {
public const CONSTRUCTOR_OPTIONS = [
- 'RCMaxAge'
+ MainConfigNames::RCMaxAge,
];
private const CACHE_KEY_PREFIX = 'EditResult';
@@ -87,7 +88,7 @@ class EditResultCache {
$this->makeKey( $revisionId ),
FormatJson::encode( $editResult ),
// Patrol flags are not stored for longer than $wgRCMaxAge
- $this->options->get( 'RCMaxAge' )
+ $this->options->get( MainConfigNames::RCMaxAge )
);
}
diff --git a/includes/Storage/PageUpdater.php b/includes/Storage/PageUpdater.php
index e6dcda5d83a3..dbc32e79770e 100644
--- a/includes/Storage/PageUpdater.php
+++ b/includes/Storage/PageUpdater.php
@@ -38,6 +38,7 @@ use MediaWiki\Content\IContentHandlerFactory;
use MediaWiki\Content\ValidationParams;
use MediaWiki\HookContainer\HookContainer;
use MediaWiki\HookContainer\HookRunner;
+use MediaWiki\MainConfigNames;
use MediaWiki\Page\PageIdentity;
use MediaWiki\Revision\MutableRevisionRecord;
use MediaWiki\Revision\RevisionAccessException;
@@ -86,8 +87,8 @@ class PageUpdater {
* @internal
*/
public const CONSTRUCTOR_OPTIONS = [
- 'ManualRevertSearchRadius',
- 'UseRCPatrol',
+ MainConfigNames::ManualRevertSearchRadius,
+ MainConfigNames::UseRCPatrol,
];
/**
@@ -264,8 +265,8 @@ class PageUpdater {
new ServiceOptions(
EditResultBuilder::CONSTRUCTOR_OPTIONS,
[
- 'ManualRevertSearchRadius' =>
- $serviceOptions->get( 'ManualRevertSearchRadius' )
+ MainConfigNames::ManualRevertSearchRadius =>
+ $serviceOptions->get( MainConfigNames::ManualRevertSearchRadius )
]
)
);
@@ -1611,7 +1612,7 @@ class PageUpdater {
// Should the reverted tag update be scheduled right away?
// The revert is approved if either patrolling is disabled or the
// edit is patrolled or autopatrolled.
- $approved = !$this->serviceOptions->get( 'UseRCPatrol' ) ||
+ $approved = !$this->serviceOptions->get( MainConfigNames::UseRCPatrol ) ||
$this->rcPatrolStatus === RecentChange::PRC_PATROLLED ||
$this->rcPatrolStatus === RecentChange::PRC_AUTOPATROLLED;
diff --git a/includes/Storage/PageUpdaterFactory.php b/includes/Storage/PageUpdaterFactory.php
index ea218cdb6dd3..aa5cbd00bbe2 100644
--- a/includes/Storage/PageUpdaterFactory.php
+++ b/includes/Storage/PageUpdaterFactory.php
@@ -28,6 +28,7 @@ use MediaWiki\Config\ServiceOptions;
use MediaWiki\Content\IContentHandlerFactory;
use MediaWiki\Content\Transform\ContentTransformer;
use MediaWiki\HookContainer\HookContainer;
+use MediaWiki\MainConfigNames;
use MediaWiki\Page\PageIdentity;
use MediaWiki\Page\WikiPageFactory;
use MediaWiki\Permissions\PermissionManager;
@@ -61,12 +62,12 @@ class PageUpdaterFactory {
* @internal
*/
public const CONSTRUCTOR_OPTIONS = [
- 'ArticleCountMethod',
- 'RCWatchCategoryMembership',
- 'PageCreationLog',
- 'UseAutomaticEditSummaries',
- 'ManualRevertSearchRadius',
- 'UseRCPatrol',
+ MainConfigNames::ArticleCountMethod,
+ MainConfigNames::RCWatchCategoryMembership,
+ MainConfigNames::PageCreationLog,
+ MainConfigNames::UseAutomaticEditSummaries,
+ MainConfigNames::ManualRevertSearchRadius,
+ MainConfigNames::UseRCPatrol,
];
/** @var RevisionStore */
@@ -285,9 +286,10 @@ class PageUpdaterFactory {
$this->softwareTags
);
- $pageUpdater->setUsePageCreationLog( $this->options->get( 'PageCreationLog' ) );
+ $pageUpdater->setUsePageCreationLog(
+ $this->options->get( MainConfigNames::PageCreationLog ) );
$pageUpdater->setUseAutomaticEditSummaries(
- $this->options->get( 'UseAutomaticEditSummaries' )
+ $this->options->get( MainConfigNames::UseAutomaticEditSummaries )
);
return $pageUpdater;
@@ -324,9 +326,10 @@ class PageUpdaterFactory {
);
$derivedDataUpdater->setLogger( $this->logger );
- $derivedDataUpdater->setArticleCountMethod( $this->options->get( 'ArticleCountMethod' ) );
+ $derivedDataUpdater->setArticleCountMethod(
+ $this->options->get( MainConfigNames::ArticleCountMethod ) );
$derivedDataUpdater->setRcWatchCategoryMembership(
- $this->options->get( 'RCWatchCategoryMembership' )
+ $this->options->get( MainConfigNames::RCWatchCategoryMembership )
);
return $derivedDataUpdater;
diff --git a/includes/Storage/RevertedTagUpdate.php b/includes/Storage/RevertedTagUpdate.php
index dd39e63fd8fc..137682304724 100644
--- a/includes/Storage/RevertedTagUpdate.php
+++ b/includes/Storage/RevertedTagUpdate.php
@@ -26,6 +26,7 @@ use ChangeTags;
use DeferrableUpdate;
use FormatJson;
use MediaWiki\Config\ServiceOptions;
+use MediaWiki\MainConfigNames;
use MediaWiki\Revision\RevisionRecord;
use MediaWiki\Revision\RevisionStore;
use Psr\Log\LoggerInterface;
@@ -43,7 +44,7 @@ class RevertedTagUpdate implements DeferrableUpdate {
/**
* @internal
*/
- public const CONSTRUCTOR_OPTIONS = [ 'RevertedTagMaxDepth' ];
+ public const CONSTRUCTOR_OPTIONS = [ MainConfigNames::RevertedTagMaxDepth ];
/** @var RevisionStore */
private $revisionStore;
@@ -119,7 +120,7 @@ class RevertedTagUpdate implements DeferrableUpdate {
return;
}
- $maxDepth = $this->options->get( 'RevertedTagMaxDepth' );
+ $maxDepth = $this->options->get( MainConfigNames::RevertedTagMaxDepth );
$extraParams = $this->getTagExtraParams();
$revertedRevisionIds = $this->revisionStore->getRevisionIdsBetween(
$this->getOldestRevertedRevision()->getPageId(),
@@ -174,7 +175,7 @@ class RevertedTagUpdate implements DeferrableUpdate {
* @return bool
*/
private function shouldExecute(): bool {
- $maxDepth = $this->options->get( 'RevertedTagMaxDepth' );
+ $maxDepth = $this->options->get( MainConfigNames::RevertedTagMaxDepth );
if ( !in_array( ChangeTags::TAG_REVERTED, $this->softwareTags ) || $maxDepth <= 0 ) {
return false;
}
diff --git a/includes/TemplateParser.php b/includes/TemplateParser.php
index 5e88f448d154..5bd0f7bf41ff 100644
--- a/includes/TemplateParser.php
+++ b/includes/TemplateParser.php
@@ -1,6 +1,7 @@
<?php
use LightnCandy\LightnCandy;
+use MediaWiki\MainConfigNames;
use MediaWiki\MediaWikiServices;
/**
@@ -114,7 +115,7 @@ class TemplateParser {
// Fetch a secret key for building a keyed hash of the PHP code.
// Note that this may be called before MediaWiki is fully initialized.
$secretKey = MediaWikiServices::hasInstance()
- ? MediaWikiServices::getInstance()->getMainConfig()->get( 'SecretKey' )
+ ? MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::SecretKey )
: null;
if ( $secretKey ) {
diff --git a/includes/auth/AbstractPasswordPrimaryAuthenticationProvider.php b/includes/auth/AbstractPasswordPrimaryAuthenticationProvider.php
index 816712620e03..fea716b4cf7b 100644
--- a/includes/auth/AbstractPasswordPrimaryAuthenticationProvider.php
+++ b/includes/auth/AbstractPasswordPrimaryAuthenticationProvider.php
@@ -21,6 +21,7 @@
namespace MediaWiki\Auth;
+use MediaWiki\MainConfigNames;
use Password;
use PasswordFactory;
use Status;
@@ -56,8 +57,8 @@ abstract class AbstractPasswordPrimaryAuthenticationProvider
protected function getPasswordFactory() {
if ( $this->passwordFactory === null ) {
$this->passwordFactory = new PasswordFactory(
- $this->config->get( 'PasswordConfig' ),
- $this->config->get( 'PasswordDefault' )
+ $this->config->get( MainConfigNames::PasswordConfig ),
+ $this->config->get( MainConfigNames::PasswordDefault )
);
}
return $this->passwordFactory;
@@ -122,7 +123,8 @@ abstract class AbstractPasswordPrimaryAuthenticationProvider
protected function setPasswordResetFlag( $username, Status $status, $data = null ) {
$reset = $this->getPasswordResetData( $username, $data );
- if ( !$reset && $this->config->get( 'InvalidPasswordReset' ) && !$status->isGood() ) {
+ if ( !$reset && $this->config->get( MainConfigNames::InvalidPasswordReset ) &&
+ !$status->isGood() ) {
$hard = $status->getValue()['forceChange'] ?? false;
if ( $hard || !empty( $status->getValue()['suggestChangeOnLogin'] ) ) {
@@ -158,7 +160,7 @@ abstract class AbstractPasswordPrimaryAuthenticationProvider
* @return string|null
*/
protected function getNewPasswordExpiry( $username ) {
- $days = $this->config->get( 'PasswordExpirationDays' );
+ $days = $this->config->get( MainConfigNames::PasswordExpirationDays );
$expires = $days ? wfTimestamp( TS_MW, time() + $days * 86400 ) : null;
// Give extensions a chance to force an expiration
diff --git a/includes/auth/AuthManager.php b/includes/auth/AuthManager.php
index 5c05cac586ab..2241a6abb49b 100644
--- a/includes/auth/AuthManager.php
+++ b/includes/auth/AuthManager.php
@@ -29,6 +29,7 @@ use MediaWiki\Block\BlockManager;
use MediaWiki\HookContainer\HookContainer;
use MediaWiki\HookContainer\HookRunner;
use MediaWiki\Languages\LanguageConverterFactory;
+use MediaWiki\MainConfigNames;
use MediaWiki\Permissions\Authority;
use MediaWiki\Permissions\PermissionStatus;
use MediaWiki\User\BotPasswordStore;
@@ -776,7 +777,7 @@ class AuthManager implements LoggerAwareInterface {
'user' => $user->getName(),
'clientip' => $this->request->getIP(),
] );
- $rememberMeConfig = $this->config->get( 'RememberMe' );
+ $rememberMeConfig = $this->config->get( MainConfigNames::RememberMe );
if ( $rememberMeConfig === RememberMeAuthenticationRequest::ALWAYS_REMEMBER ) {
$rememberMe = true;
} elseif ( $rememberMeConfig === RememberMeAuthenticationRequest::NEVER_REMEMBER ) {
@@ -836,7 +837,7 @@ class AuthManager implements LoggerAwareInterface {
$timeSinceLogin = max( 0, time() - $last );
}
- $thresholds = $this->config->get( 'ReauthenticateTime' );
+ $thresholds = $this->config->get( MainConfigNames::ReauthenticateTime );
if ( isset( $thresholds[$operation] ) ) {
$threshold = $thresholds[$operation];
} elseif ( isset( $thresholds['default'] ) ) {
@@ -851,7 +852,8 @@ class AuthManager implements LoggerAwareInterface {
} else {
$timeSinceLogin = -1;
- $pass = $this->config->get( 'AllowSecuritySensitiveOperationIfCannotReauthenticate' );
+ $pass = $this->config->get(
+ MainConfigNames::AllowSecuritySensitiveOperationIfCannotReauthenticate );
if ( isset( $pass[$operation] ) ) {
$status = $pass[$operation] ? self::SEC_OK : self::SEC_FAIL;
} elseif ( isset( $pass['default'] ) ) {
@@ -1526,7 +1528,7 @@ class AuthManager implements LoggerAwareInterface {
$logSubtype = $provider->finishAccountCreation( $user, $creator, $state['primaryResponse'] );
// Log the creation
- if ( $this->config->get( 'NewUserLog' ) ) {
+ if ( $this->config->get( MainConfigNames::NewUserLog ) ) {
$isAnon = $creator->isAnon();
$logEntry = new \ManualLogEntry(
'newusers',
@@ -1853,7 +1855,7 @@ class AuthManager implements LoggerAwareInterface {
} );
// Log the creation
- if ( $this->config->get( 'NewUserLog' ) && $log ) {
+ if ( $this->config->get( MainConfigNames::NewUserLog ) && $log ) {
$logEntry = new \ManualLogEntry( 'newusers', 'autocreate' );
$logEntry->setPerformer( $user );
$logEntry->setTarget( $user->getUserPage() );
@@ -2226,7 +2228,8 @@ class AuthManager implements LoggerAwareInterface {
// AuthManager has its own req for some actions
switch ( $providerAction ) {
case self::ACTION_LOGIN:
- $reqs[] = new RememberMeAuthenticationRequest( $this->config->get( 'RememberMe' ) );
+ $reqs[] = new RememberMeAuthenticationRequest(
+ $this->config->get( MainConfigNames::RememberMe ) );
break;
case self::ACTION_CREATE:
@@ -2436,7 +2439,8 @@ class AuthManager implements LoggerAwareInterface {
* @return array
*/
private function getConfiguration() {
- return $this->config->get( 'AuthManagerConfig' ) ?: $this->config->get( 'AuthManagerAutoConfig' );
+ return $this->config->get( MainConfigNames::AuthManagerConfig )
+ ?: $this->config->get( MainConfigNames::AuthManagerAutoConfig );
}
/**
diff --git a/includes/auth/EmailNotificationSecondaryAuthenticationProvider.php b/includes/auth/EmailNotificationSecondaryAuthenticationProvider.php
index 414d4de55407..2525b5a2f61c 100644
--- a/includes/auth/EmailNotificationSecondaryAuthenticationProvider.php
+++ b/includes/auth/EmailNotificationSecondaryAuthenticationProvider.php
@@ -2,6 +2,7 @@
namespace MediaWiki\Auth;
+use MediaWiki\MainConfigNames;
use Wikimedia\Rdbms\ILoadBalancer;
/**
@@ -34,8 +35,8 @@ class EmailNotificationSecondaryAuthenticationProvider
protected function postInitSetup() {
if ( $this->sendConfirmationEmail === null ) {
- $this->sendConfirmationEmail = $this->config->get( 'EnableEmail' )
- && $this->config->get( 'EmailAuthentication' );
+ $this->sendConfirmationEmail = $this->config->get( MainConfigNames::EnableEmail )
+ && $this->config->get( MainConfigNames::EmailAuthentication );
}
}
diff --git a/includes/auth/LocalPasswordPrimaryAuthenticationProvider.php b/includes/auth/LocalPasswordPrimaryAuthenticationProvider.php
index 948c790349c3..ad6f130b7495 100644
--- a/includes/auth/LocalPasswordPrimaryAuthenticationProvider.php
+++ b/includes/auth/LocalPasswordPrimaryAuthenticationProvider.php
@@ -21,6 +21,7 @@
namespace MediaWiki\Auth;
+use MediaWiki\MainConfigNames;
use MediaWiki\User\UserRigorOptions;
use User;
use Wikimedia\Rdbms\ILoadBalancer;
@@ -67,7 +68,7 @@ class LocalPasswordPrimaryAuthenticationProvider
return null;
}
- $grace = $this->config->get( 'PasswordExpireGrace' );
+ $grace = $this->config->get( MainConfigNames::PasswordExpireGrace );
if ( (int)$expiration + $grace < $now ) {
$data = [
'hard' => true,
@@ -132,7 +133,7 @@ class LocalPasswordPrimaryAuthenticationProvider
$pwhash = $this->getPassword( $row->user_password );
if ( !$pwhash->verify( $req->password ) ) {
- if ( $this->config->get( 'LegacyEncoding' ) ) {
+ if ( $this->config->get( MainConfigNames::LegacyEncoding ) ) {
// Some wikis were converted from ISO 8859-1 to UTF-8, the passwords can't be converted
// Check for this with iconv
$cp1252Password = iconv( 'UTF-8', 'WINDOWS-1252//TRANSLIT', $req->password );
diff --git a/includes/content/AbstractContent.php b/includes/content/AbstractContent.php
index 68ce351ce2a0..d271c1ebf73d 100644
--- a/includes/content/AbstractContent.php
+++ b/includes/content/AbstractContent.php
@@ -31,6 +31,7 @@ use MediaWiki\Content\Renderer\ContentParseParams;
use MediaWiki\Content\Transform\PreloadTransformParamsValue;
use MediaWiki\Content\Transform\PreSaveTransformParamsValue;
use MediaWiki\Content\ValidationParams;
+use MediaWiki\MainConfigNames;
use MediaWiki\MediaWikiServices;
/**
@@ -276,7 +277,8 @@ abstract class AbstractContent implements Content {
* @see Content::getRedirectChain
*/
public function getRedirectChain() {
- $maxRedirects = MediaWikiServices::getInstance()->getMainConfig()->get( 'MaxRedirects' );
+ $maxRedirects = MediaWikiServices::getInstance()->getMainConfig()->get(
+ MainConfigNames::MaxRedirects );
$title = $this->getRedirectTarget();
if ( $title === null ) {
return null;
diff --git a/includes/content/JavaScriptContentHandler.php b/includes/content/JavaScriptContentHandler.php
index 8c6f9102040f..6f1340d67c74 100644
--- a/includes/content/JavaScriptContentHandler.php
+++ b/includes/content/JavaScriptContentHandler.php
@@ -20,6 +20,7 @@
use MediaWiki\Content\Renderer\ContentParseParams;
use MediaWiki\Content\Transform\PreSaveTransformParams;
+use MediaWiki\MainConfigNames;
use MediaWiki\MediaWikiServices;
/**
@@ -124,7 +125,8 @@ class JavaScriptContentHandler extends CodeContentHandler {
ContentParseParams $cpoParams,
ParserOutput &$output
) {
- $textModelsToParse = MediaWikiServices::getInstance()->getMainConfig()->get( 'TextModelsToParse' );
+ $textModelsToParse = MediaWikiServices::getInstance()->getMainConfig()->get(
+ MainConfigNames::TextModelsToParse );
'@phan-var TextContent $content';
if ( in_array( $content->getModel(), $textModelsToParse ) ) {
// parse just to get links etc into the database, HTML is replaced below.
diff --git a/includes/content/TextContent.php b/includes/content/TextContent.php
index a8e9e437d41b..031df7511d58 100644
--- a/includes/content/TextContent.php
+++ b/includes/content/TextContent.php
@@ -25,6 +25,7 @@
* @author Daniel Kinzler
*/
+use MediaWiki\MainConfigNames;
use MediaWiki\MediaWikiServices;
/**
@@ -116,7 +117,8 @@ class TextContent extends AbstractContent {
* @return bool
*/
public function isCountable( $hasLinks = null ) {
- $articleCountMethod = MediaWikiServices::getInstance()->getMainConfig()->get( 'ArticleCountMethod' );
+ $articleCountMethod = MediaWikiServices::getInstance()->getMainConfig()->get(
+ MainConfigNames::ArticleCountMethod );
if ( $this->isRedirect() ) {
return false;
diff --git a/includes/content/TextContentHandler.php b/includes/content/TextContentHandler.php
index 2a546434e1e6..d95df2ee1a11 100644
--- a/includes/content/TextContentHandler.php
+++ b/includes/content/TextContentHandler.php
@@ -25,6 +25,7 @@
use MediaWiki\Content\Renderer\ContentParseParams;
use MediaWiki\Content\Transform\PreSaveTransformParams;
+use MediaWiki\MainConfigNames;
use MediaWiki\MediaWikiServices;
/**
@@ -213,7 +214,8 @@ class TextContentHandler extends ContentHandler {
ContentParseParams $cpoParams,
ParserOutput &$output
) {
- $textModelsToParse = MediaWikiServices::getInstance()->getMainConfig()->get( 'TextModelsToParse' );
+ $textModelsToParse = MediaWikiServices::getInstance()->getMainConfig()->get(
+ MainConfigNames::TextModelsToParse );
'@phan-var TextContent $content';
if ( in_array( $content->getModel(), $textModelsToParse ) ) {
// parse just to get links etc into the database, HTML is replaced below.
diff --git a/includes/db/MWLBFactory.php b/includes/db/MWLBFactory.php
index 741e2c1b9a9a..549a558ebe67 100644
--- a/includes/db/MWLBFactory.php
+++ b/includes/db/MWLBFactory.php
@@ -23,6 +23,7 @@
use MediaWiki\Config\ServiceOptions;
use MediaWiki\Logger\LoggerFactory;
+use MediaWiki\MainConfigNames;
use Wikimedia\Rdbms\ChronologyProtector;
use Wikimedia\Rdbms\DatabaseDomain;
use Wikimedia\Rdbms\IDatabase;
@@ -46,24 +47,24 @@ abstract class MWLBFactory {
*/
public const APPLY_DEFAULT_CONFIG_OPTIONS = [
'CommandLineMode',
- 'DBcompress',
- 'DBDefaultGroup',
- 'DBmwschema',
- 'DBname',
- 'DBpassword',
- 'DBport',
- 'DBprefix',
- 'DBserver',
- 'DBservers',
- 'DBssl',
- 'DBtype',
- 'DBuser',
- 'DebugDumpSql',
- 'DebugLogFile',
- 'DebugToolbar',
- 'ExternalServers',
- 'SQLiteDataDir',
- 'SQLMode',
+ MainConfigNames::DBcompress,
+ MainConfigNames::DBDefaultGroup,
+ MainConfigNames::DBmwschema,
+ MainConfigNames::DBname,
+ MainConfigNames::DBpassword,
+ MainConfigNames::DBport,
+ MainConfigNames::DBprefix,
+ MainConfigNames::DBserver,
+ MainConfigNames::DBservers,
+ MainConfigNames::DBssl,
+ MainConfigNames::DBtype,
+ MainConfigNames::DBuser,
+ MainConfigNames::DebugDumpSql,
+ MainConfigNames::DebugLogFile,
+ MainConfigNames::DebugToolbar,
+ MainConfigNames::ExternalServers,
+ MainConfigNames::SQLiteDataDir,
+ MainConfigNames::SQLMode,
];
/**
@@ -92,9 +93,9 @@ abstract class MWLBFactory {
$lbConf += [
'localDomain' => new DatabaseDomain(
- $options->get( 'DBname' ),
- $options->get( 'DBmwschema' ),
- $options->get( 'DBprefix' )
+ $options->get( MainConfigNames::DBname ),
+ $options->get( MainConfigNames::DBmwschema ),
+ $options->get( MainConfigNames::DBprefix )
),
'profiler' => static function ( $section ) {
return Profiler::instance()->scopedProfileIn( $section );
@@ -108,7 +109,7 @@ abstract class MWLBFactory {
'deprecationLogger' => [ static::class, 'logDeprecation' ],
'cliMode' => $options->get( 'CommandLineMode' ),
'readOnlyReason' => $readOnlyMode->getReason(),
- 'defaultGroup' => $options->get( 'DBDefaultGroup' ),
+ 'defaultGroup' => $options->get( MainConfigNames::DBDefaultGroup ),
'criticalSectionProvider' => $csProvider
];
@@ -119,48 +120,48 @@ abstract class MWLBFactory {
if ( $lbConf['class'] === Wikimedia\Rdbms\LBFactorySimple::class ) {
if ( isset( $lbConf['servers'] ) ) {
// Server array is already explicitly configured
- } elseif ( is_array( $options->get( 'DBservers' ) ) ) {
+ } elseif ( is_array( $options->get( MainConfigNames::DBservers ) ) ) {
$lbConf['servers'] = [];
- foreach ( $options->get( 'DBservers' ) as $i => $server ) {
+ foreach ( $options->get( MainConfigNames::DBservers ) as $i => $server ) {
$lbConf['servers'][$i] = self::initServerInfo( $server, $options );
}
} else {
$server = self::initServerInfo(
[
- 'host' => $options->get( 'DBserver' ),
- 'user' => $options->get( 'DBuser' ),
- 'password' => $options->get( 'DBpassword' ),
- 'dbname' => $options->get( 'DBname' ),
- 'type' => $options->get( 'DBtype' ),
+ 'host' => $options->get( MainConfigNames::DBserver ),
+ 'user' => $options->get( MainConfigNames::DBuser ),
+ 'password' => $options->get( MainConfigNames::DBpassword ),
+ 'dbname' => $options->get( MainConfigNames::DBname ),
+ 'type' => $options->get( MainConfigNames::DBtype ),
'load' => 1
],
$options
);
- $server['flags'] |= $options->get( 'DBssl' ) ? DBO_SSL : 0;
- $server['flags'] |= $options->get( 'DBcompress' ) ? DBO_COMPRESS : 0;
+ $server['flags'] |= $options->get( MainConfigNames::DBssl ) ? DBO_SSL : 0;
+ $server['flags'] |= $options->get( MainConfigNames::DBcompress ) ? DBO_COMPRESS : 0;
$lbConf['servers'] = [ $server ];
}
if ( !isset( $lbConf['externalClusters'] ) ) {
- $lbConf['externalClusters'] = $options->get( 'ExternalServers' );
+ $lbConf['externalClusters'] = $options->get( MainConfigNames::ExternalServers );
}
$serversCheck = $lbConf['servers'];
} elseif ( $lbConf['class'] === Wikimedia\Rdbms\LBFactoryMulti::class ) {
if ( isset( $lbConf['serverTemplate'] ) ) {
if ( in_array( $lbConf['serverTemplate']['type'], $typesWithSchema, true ) ) {
- $lbConf['serverTemplate']['schema'] = $options->get( 'DBmwschema' );
+ $lbConf['serverTemplate']['schema'] = $options->get( MainConfigNames::DBmwschema );
}
- $lbConf['serverTemplate']['sqlMode'] = $options->get( 'SQLMode' );
+ $lbConf['serverTemplate']['sqlMode'] = $options->get( MainConfigNames::SQLMode );
$serversCheck = [ $lbConf['serverTemplate'] ];
}
}
self::assertValidServerConfigs(
$serversCheck,
- $options->get( 'DBname' ),
- $options->get( 'DBprefix' )
+ $options->get( MainConfigNames::DBname ),
+ $options->get( MainConfigNames::DBprefix )
);
$lbConf['cpStash'] = $cpStash;
@@ -198,29 +199,29 @@ abstract class MWLBFactory {
}
}
$server += [
- 'dbDirectory' => $options->get( 'SQLiteDataDir' ),
+ 'dbDirectory' => $options->get( MainConfigNames::SQLiteDataDir ),
'trxMode' => $isHttpRead ? 'DEFERRED' : 'IMMEDIATE'
];
} elseif ( $server['type'] === 'postgres' ) {
- $server += [ 'port' => $options->get( 'DBport' ) ];
+ $server += [ 'port' => $options->get( MainConfigNames::DBport ) ];
}
if ( in_array( $server['type'], self::getDbTypesWithSchemas(), true ) ) {
- $server += [ 'schema' => $options->get( 'DBmwschema' ) ];
+ $server += [ 'schema' => $options->get( MainConfigNames::DBmwschema ) ];
}
$flags = $server['flags'] ?? DBO_DEFAULT;
- if ( $options->get( 'DebugDumpSql' )
- || $options->get( 'DebugLogFile' )
- || $options->get( 'DebugToolbar' )
+ if ( $options->get( MainConfigNames::DebugDumpSql )
+ || $options->get( MainConfigNames::DebugLogFile )
+ || $options->get( MainConfigNames::DebugToolbar )
) {
$flags |= DBO_DEBUG;
}
$server['flags'] = $flags;
$server += [
- 'tablePrefix' => $options->get( 'DBprefix' ),
- 'sqlMode' => $options->get( 'SQLMode' ),
+ 'tablePrefix' => $options->get( MainConfigNames::DBprefix ),
+ 'sqlMode' => $options->get( MainConfigNames::SQLMode ),
];
return $server;
diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php
index 28789fe28188..c672d8904d7d 100644
--- a/includes/diff/DifferenceEngine.php
+++ b/includes/diff/DifferenceEngine.php
@@ -24,6 +24,7 @@
use MediaWiki\Content\IContentHandlerFactory;
use MediaWiki\HookContainer\HookRunner;
use MediaWiki\Linker\LinkRenderer;
+use MediaWiki\MainConfigNames;
use MediaWiki\MediaWikiServices;
use MediaWiki\Page\WikiPageFactory;
use MediaWiki\Permissions\Authority;
@@ -896,7 +897,7 @@ class DifferenceEngine extends ContextSource {
// Prepare a change patrol link, if applicable
if (
// Is patrolling enabled and the user allowed to?
- $config->get( 'UseRCPatrol' ) &&
+ $config->get( MainConfigNames::UseRCPatrol ) &&
$this->mNewPage &&
$this->getAuthority()->probablyCan( 'patrol', $this->mNewPage ) &&
// Only do this if the revision isn't more than 6 hours older
@@ -1430,9 +1431,9 @@ class DifferenceEngine extends ContextSource {
*/
public static function getEngine() {
$diffEngine = MediaWikiServices::getInstance()->getMainConfig()
- ->get( 'DiffEngine' );
+ ->get( MainConfigNames::DiffEngine );
$externalDiffEngine = MediaWikiServices::getInstance()->getMainConfig()
- ->get( 'ExternalDiffEngine' );
+ ->get( MainConfigNames::ExternalDiffEngine );
if ( $diffEngine === null ) {
$engines = [ 'external', 'wikidiff2', 'php' ];
@@ -1516,7 +1517,7 @@ class DifferenceEngine extends ContextSource {
return '';
}
$data = [ $generator ];
- if ( $this->getConfig()->get( 'ShowHostnames' ) ) {
+ if ( $this->getConfig()->get( MainConfigNames::ShowHostnames ) ) {
$data[] = wfHostname();
}
$data[] = wfTimestamp( TS_DB );
diff --git a/includes/export/WikiExporter.php b/includes/export/WikiExporter.php
index aaf6960498d4..c05e77337caa 100644
--- a/includes/export/WikiExporter.php
+++ b/includes/export/WikiExporter.php
@@ -29,6 +29,7 @@
use MediaWiki\HookContainer\HookContainer;
use MediaWiki\HookContainer\HookRunner;
+use MediaWiki\MainConfigNames;
use MediaWiki\MediaWikiServices;
use MediaWiki\Page\PageIdentity;
use MediaWiki\Revision\RevisionAccessException;
@@ -96,7 +97,8 @@ class WikiExporter {
* @return string
*/
public static function schemaVersion() {
- return MediaWikiServices::getInstance()->getMainConfig()->get( 'XmlDumpSchemaVersion' );
+ return MediaWikiServices::getInstance()->getMainConfig()->get(
+ MainConfigNames::XmlDumpSchemaVersion );
}
/**
diff --git a/includes/export/XmlDumpWriter.php b/includes/export/XmlDumpWriter.php
index 045d5cc599b2..9b89d1e312a0 100644
--- a/includes/export/XmlDumpWriter.php
+++ b/includes/export/XmlDumpWriter.php
@@ -173,7 +173,7 @@ class XmlDumpWriter {
* @return string
*/
private function dbname() {
- $dbname = MediaWikiServices::getInstance()->getMainConfig()->get( 'DBname' );
+ $dbname = MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::DBname );
return Xml::element( 'dbname', [], $dbname );
}
@@ -195,7 +195,8 @@ class XmlDumpWriter {
* @return string
*/
private function caseSetting() {
- $capitalLinks = MediaWikiServices::getInstance()->getMainConfig()->get( 'CapitalLinks' );
+ $capitalLinks = MediaWikiServices::getInstance()->getMainConfig()->get(
+ MainConfigNames::CapitalLinks );
// "case-insensitive" option is reserved for future
$sensitivity = $capitalLinks ? 'first-letter' : 'case-sensitive';
return Xml::element( 'case', [], $sensitivity );
diff --git a/includes/gallery/ImageGalleryBase.php b/includes/gallery/ImageGalleryBase.php
index 2025749aa5ca..578b56eaf14d 100644
--- a/includes/gallery/ImageGalleryBase.php
+++ b/includes/gallery/ImageGalleryBase.php
@@ -20,6 +20,7 @@
* @file
*/
+use MediaWiki\MainConfigNames;
use MediaWiki\MediaWikiServices;
/**
@@ -119,7 +120,7 @@ abstract class ImageGalleryBase extends ContextSource {
$context = RequestContext::getMainAndWarn( __METHOD__ );
}
if ( !$mode ) {
- $galleryOptions = $context->getConfig()->get( 'GalleryOptions' );
+ $galleryOptions = $context->getConfig()->get( MainConfigNames::GalleryOptions );
$mode = $galleryOptions['mode'];
}
@@ -166,7 +167,7 @@ abstract class ImageGalleryBase extends ContextSource {
$this->setContext( $context );
}
- $galleryOptions = $this->getConfig()->get( 'GalleryOptions' );
+ $galleryOptions = $this->getConfig()->get( MainConfigNames::GalleryOptions );
$this->mImages = [];
$this->mShowBytes = $galleryOptions['showBytes'];
$this->mShowDimensions = $galleryOptions['showDimensions'];
diff --git a/includes/gallery/TraditionalImageGallery.php b/includes/gallery/TraditionalImageGallery.php
index 6f144df73206..9bd915c48f99 100644
--- a/includes/gallery/TraditionalImageGallery.php
+++ b/includes/gallery/TraditionalImageGallery.php
@@ -1,6 +1,7 @@
<?php
use MediaWiki\Linker\LinkRenderer;
+use MediaWiki\MainConfigNames;
use MediaWiki\MediaWikiServices;
/**
@@ -79,7 +80,8 @@ class TraditionalImageGallery extends ImageGalleryBase {
}
$lang = $this->getRenderLang();
- $enableLegacyMediaDOM = $this->getConfig()->get( 'ParserEnableLegacyMediaDOM' );
+ $enableLegacyMediaDOM =
+ $this->getConfig()->get( MainConfigNames::ParserEnableLegacyMediaDOM );
# Output each image...
foreach ( $this->mImages as [ $nt, $text, $alt, $link, $handlerOpts, $loading ] ) {
diff --git a/includes/htmlform/HTMLForm.php b/includes/htmlform/HTMLForm.php
index 2a369a3ca4c9..3ce75d5326e0 100644
--- a/includes/htmlform/HTMLForm.php
+++ b/includes/htmlform/HTMLForm.php
@@ -23,6 +23,7 @@
use MediaWiki\HookContainer\ProtectedHookAccessorTrait;
use MediaWiki\Linker\LinkTarget;
+use MediaWiki\MainConfigNames;
use MediaWiki\Page\PageReference;
/**
@@ -375,7 +376,7 @@ class HTMLForm extends ContextSource {
// Evil hack for mobile :(
if (
- !$this->getConfig()->get( 'HTMLFormAllowTableFormat' )
+ !$this->getConfig()->get( MainConfigNames::HTMLFormAllowTableFormat )
&& $this->displayFormat === 'table'
) {
$this->displayFormat = 'div';
@@ -477,7 +478,8 @@ class HTMLForm extends ContextSource {
}
// Evil hack for mobile :(
- if ( !$this->getConfig()->get( 'HTMLFormAllowTableFormat' ) && $format === 'table' ) {
+ if ( !$this->getConfig()->get( MainConfigNames::HTMLFormAllowTableFormat ) &&
+ $format === 'table' ) {
$format = 'div';
}
@@ -1362,7 +1364,7 @@ class HTMLForm extends ContextSource {
) . "\n";
}
if ( $this->getMethod() === 'post' ||
- $this->getAction() === $this->getConfig()->get( 'Script' )
+ $this->getAction() === $this->getConfig()->get( MainConfigNames::Script )
) {
$html .= Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) . "\n";
}
@@ -1381,7 +1383,8 @@ class HTMLForm extends ContextSource {
*/
public function getButtons() {
$buttons = '';
- $useMediaWikiUIEverywhere = $this->getConfig()->get( 'UseMediaWikiUIEverywhere' );
+ $useMediaWikiUIEverywhere =
+ $this->getConfig()->get( MainConfigNames::UseMediaWikiUIEverywhere );
if ( $this->mShowSubmit ) {
$attribs = [];
@@ -2128,14 +2131,14 @@ class HTMLForm extends ContextSource {
return $this->mAction;
}
- $articlePath = $this->getConfig()->get( 'ArticlePath' );
+ $articlePath = $this->getConfig()->get( MainConfigNames::ArticlePath );
// Check whether we are in GET mode and the ArticlePath contains a "?"
// meaning that getLocalURL() would return something like "index.php?title=...".
// As browser remove the query string before submitting GET forms,
// it means that the title would be lost. In such case use script path instead
// and put title in an hidden field (see getHiddenFields()).
if ( strpos( $articlePath, '?' ) !== false && $this->getMethod() === 'get' ) {
- return $this->getConfig()->get( 'Script' );
+ return $this->getConfig()->get( MainConfigNames::Script );
}
return $this->getTitle()->getLocalURL();
diff --git a/includes/htmlform/fields/HTMLButtonField.php b/includes/htmlform/fields/HTMLButtonField.php
index 5aec32388cd9..28af0dffd0e1 100644
--- a/includes/htmlform/fields/HTMLButtonField.php
+++ b/includes/htmlform/fields/HTMLButtonField.php
@@ -1,5 +1,7 @@
<?php
+use MediaWiki\MainConfigNames;
+
/**
* Adds a generic button inline to the form. Does not do anything, you must add
* click handling code in JavaScript. Use a HTMLSubmitField if you merely
@@ -67,7 +69,7 @@ class HTMLButtonField extends HTMLFormField {
$flags = '';
$prefix = 'mw-htmlform-';
if ( $this->mParent instanceof VFormHTMLForm ||
- $this->mParent->getConfig()->get( 'UseMediaWikiUIEverywhere' )
+ $this->mParent->getConfig()->get( MainConfigNames::UseMediaWikiUIEverywhere )
) {
$prefix = 'mw-ui-';
// add mw-ui-button separately, so the descriptor doesn't need to set it
diff --git a/includes/htmlform/fields/HTMLCheckField.php b/includes/htmlform/fields/HTMLCheckField.php
index e4266b27eb69..203d926e3e4c 100644
--- a/includes/htmlform/fields/HTMLCheckField.php
+++ b/includes/htmlform/fields/HTMLCheckField.php
@@ -1,5 +1,6 @@
<?php
+use MediaWiki\MainConfigNames;
use MediaWiki\MediaWikiServices;
/**
@@ -15,7 +16,7 @@ class HTMLCheckField extends HTMLFormField {
*/
public function getInputHTML( $value ) {
$useMediaWikiUIEverywhere = MediaWikiServices::getInstance()
- ->getMainConfig()->get( 'UseMediaWikiUIEverywhere' );
+ ->getMainConfig()->get( MainConfigNames::UseMediaWikiUIEverywhere );
if ( !empty( $this->mParams['invert'] ) ) {
$value = !$value;
diff --git a/includes/htmlform/fields/HTMLCheckMatrix.php b/includes/htmlform/fields/HTMLCheckMatrix.php
index e95371b39052..71143d9c4eac 100644
--- a/includes/htmlform/fields/HTMLCheckMatrix.php
+++ b/includes/htmlform/fields/HTMLCheckMatrix.php
@@ -1,5 +1,7 @@
<?php
+use MediaWiki\MainConfigNames;
+
/**
* A checkbox matrix
* Operates similarly to HTMLMultiSelectField, but instead of using an array of
@@ -177,7 +179,7 @@ class HTMLCheckMatrix extends HTMLFormField implements HTMLNestedFilterable {
protected function getOneCheckboxHTML( $checked, $attribs ) {
$checkbox = Xml::check( "{$this->mName}[]", $checked, $attribs );
- if ( $this->mParent->getConfig()->get( 'UseMediaWikiUIEverywhere' ) ) {
+ if ( $this->mParent->getConfig()->get( MainConfigNames::UseMediaWikiUIEverywhere ) ) {
$checkbox = Html::openElement( 'div', [ 'class' => 'mw-ui-checkbox' ] ) .
$checkbox .
Html::element( 'label', [ 'for' => $attribs['id'] ] ) .
diff --git a/includes/htmlform/fields/HTMLMultiSelectField.php b/includes/htmlform/fields/HTMLMultiSelectField.php
index e54049585642..78d98b8940a2 100644
--- a/includes/htmlform/fields/HTMLMultiSelectField.php
+++ b/includes/htmlform/fields/HTMLMultiSelectField.php
@@ -1,5 +1,7 @@
<?php
+use MediaWiki\MainConfigNames;
+
/**
* Multi-select field
*
@@ -142,7 +144,7 @@ class HTMLMultiSelectField extends HTMLFormField implements HTMLNestedFilterable
[ 'for' => $attribs['id'] ],
$label
);
- if ( $this->mParent->getConfig()->get( 'UseMediaWikiUIEverywhere' ) ) {
+ if ( $this->mParent->getConfig()->get( MainConfigNames::UseMediaWikiUIEverywhere ) ) {
$checkbox = Html::openElement( 'div', [ 'class' => 'mw-ui-checkbox' ] ) .
$checkbox .
Html::closeElement( 'div' );
diff --git a/includes/htmlform/fields/HTMLRadioField.php b/includes/htmlform/fields/HTMLRadioField.php
index a6cbaef7924d..aaae08949bb0 100644
--- a/includes/htmlform/fields/HTMLRadioField.php
+++ b/includes/htmlform/fields/HTMLRadioField.php
@@ -1,5 +1,6 @@
<?php
+use MediaWiki\MainConfigNames;
use MediaWiki\MediaWikiServices;
/**
@@ -80,7 +81,7 @@ class HTMLRadioField extends HTMLFormField {
public function formatOptions( $options, $value ) {
$useMediaWikiUIEverywhere = MediaWikiServices::getInstance()
- ->getMainConfig()->get( 'UseMediaWikiUIEverywhere' );
+ ->getMainConfig()->get( MainConfigNames::UseMediaWikiUIEverywhere );
$html = '';
diff --git a/includes/htmlform/fields/HTMLSelectLanguageField.php b/includes/htmlform/fields/HTMLSelectLanguageField.php
index ada214591386..c4be70790c7c 100644
--- a/includes/htmlform/fields/HTMLSelectLanguageField.php
+++ b/includes/htmlform/fields/HTMLSelectLanguageField.php
@@ -1,5 +1,6 @@
<?php
+use MediaWiki\MainConfigNames;
use MediaWiki\MediaWikiServices;
/**
@@ -18,9 +19,10 @@ class HTMLSelectLanguageField extends HTMLSelectField {
if ( $this->mParent instanceof HTMLForm ) {
$config = $this->mParent->getConfig();
- $languageCode = $config->get( 'LanguageCode' );
+ $languageCode = $config->get( MainConfigNames::LanguageCode );
} else {
- $languageCode = MediaWikiServices::getInstance()->getMainConfig()->get( 'LanguageCode' );
+ $languageCode = MediaWikiServices::getInstance()->getMainConfig()->get(
+ MainConfigNames::LanguageCode );
}
$languages = MediaWikiServices::getInstance()
diff --git a/includes/http/HttpRequestFactory.php b/includes/http/HttpRequestFactory.php
index 102f1991b643..18220898b872 100644
--- a/includes/http/HttpRequestFactory.php
+++ b/includes/http/HttpRequestFactory.php
@@ -23,6 +23,7 @@ use GuzzleHttp\Client;
use GuzzleHttpRequest;
use MediaWiki\Config\ServiceOptions;
use MediaWiki\Logger\LoggerFactory;
+use MediaWiki\MainConfigNames;
use MultiHttpClient;
use MWHttpRequest;
use Profiler;
@@ -42,12 +43,12 @@ class HttpRequestFactory {
* @internal For use by ServiceWiring
*/
public const CONSTRUCTOR_OPTIONS = [
- 'HTTPTimeout',
- 'HTTPConnectTimeout',
- 'HTTPMaxTimeout',
- 'HTTPMaxConnectTimeout',
- 'LocalVirtualHosts',
- 'LocalHTTPProxy',
+ MainConfigNames::HTTPTimeout,
+ MainConfigNames::HTTPConnectTimeout,
+ MainConfigNames::HTTPMaxTimeout,
+ MainConfigNames::HTTPMaxConnectTimeout,
+ MainConfigNames::LocalVirtualHosts,
+ MainConfigNames::LocalHTTPProxy,
];
public function __construct( ServiceOptions $options, LoggerInterface $logger ) {
@@ -98,14 +99,14 @@ class HttpRequestFactory {
$options['timeout'] = $this->normalizeTimeout(
$options['timeout'] ?? null,
$options['maxTimeout'] ?? null,
- $this->options->get( 'HTTPTimeout' ),
- $this->options->get( 'HTTPMaxTimeout' ) ?: INF
+ $this->options->get( MainConfigNames::HTTPTimeout ),
+ $this->options->get( MainConfigNames::HTTPMaxTimeout ) ?: INF
);
$options['connectTimeout'] = $this->normalizeTimeout(
$options['connectTimeout'] ?? null,
$options['maxConnectTimeout'] ?? null,
- $this->options->get( 'HTTPConnectTimeout' ),
- $this->options->get( 'HTTPMaxConnectTimeout' ) ?: INF
+ $this->options->get( MainConfigNames::HTTPConnectTimeout ),
+ $this->options->get( MainConfigNames::HTTPMaxConnectTimeout ) ?: INF
);
return new GuzzleHttpRequest( $url, $options, $caller, Profiler::instance() );
@@ -231,22 +232,23 @@ class HttpRequestFactory {
$options['reqTimeout'] = $this->normalizeTimeout(
$options['reqTimeout'] ?? $options['timeout'] ?? null,
$options['maxReqTimeout'] ?? $options['maxTimeout'] ?? null,
- $this->options->get( 'HTTPTimeout' ),
- $this->options->get( 'HTTPMaxTimeout' ) ?: INF
+ $this->options->get( MainConfigNames::HTTPTimeout ),
+ $this->options->get( MainConfigNames::HTTPMaxTimeout ) ?: INF
);
$options['connTimeout'] = $this->normalizeTimeout(
$options['connTimeout'] ?? $options['connectTimeout'] ?? null,
$options['maxConnTimeout'] ?? $options['maxConnectTimeout'] ?? null,
- $this->options->get( 'HTTPConnectTimeout' ),
- $this->options->get( 'HTTPMaxConnectTimeout' ) ?: INF
+ $this->options->get( MainConfigNames::HTTPConnectTimeout ),
+ $this->options->get( MainConfigNames::HTTPMaxConnectTimeout ) ?: INF
);
$options += [
- 'maxReqTimeout' => $this->options->get( 'HTTPMaxTimeout' ) ?: INF,
- 'maxConnTimeout' => $this->options->get( 'HTTPMaxConnectTimeout' ) ?: INF,
+ 'maxReqTimeout' => $this->options->get( MainConfigNames::HTTPMaxTimeout ) ?: INF,
+ 'maxConnTimeout' =>
+ $this->options->get( MainConfigNames::HTTPMaxConnectTimeout ) ?: INF,
'userAgent' => $this->getUserAgent(),
'logger' => $this->logger,
- 'localProxy' => $this->options->get( 'LocalHTTPProxy' ),
- 'localVirtualHosts' => $this->options->get( 'LocalVirtualHosts' ),
+ 'localProxy' => $this->options->get( MainConfigNames::LocalHTTPProxy ),
+ 'localVirtualHosts' => $this->options->get( MainConfigNames::LocalVirtualHosts ),
];
return new MultiHttpClient( $options );
}
@@ -268,15 +270,15 @@ class HttpRequestFactory {
$config['timeout'] = $this->normalizeTimeout(
$config['timeout'] ?? null,
$config['maxTimeout'] ?? null,
- $this->options->get( 'HTTPTimeout' ),
- $this->options->get( 'HTTPMaxTimeout' ) ?: INF
+ $this->options->get( MainConfigNames::HTTPTimeout ),
+ $this->options->get( MainConfigNames::HTTPMaxTimeout ) ?: INF
);
$config['connect_timeout'] = $this->normalizeTimeout(
$config['connect_timeout'] ?? null,
$config['maxConnectTimeout'] ?? null,
- $this->options->get( 'HTTPConnectTimeout' ),
- $this->options->get( 'HTTPMaxConnectTimeout' ) ?: INF
+ $this->options->get( MainConfigNames::HTTPConnectTimeout ),
+ $this->options->get( MainConfigNames::HTTPMaxConnectTimeout ) ?: INF
);
if ( !isset( $config['headers']['User-Agent'] ) ) {
diff --git a/includes/jobqueue/JobQueueGroupFactory.php b/includes/jobqueue/JobQueueGroupFactory.php
index 019315b0e233..470e8b1a7632 100644
--- a/includes/jobqueue/JobQueueGroupFactory.php
+++ b/includes/jobqueue/JobQueueGroupFactory.php
@@ -24,6 +24,7 @@ use ConfiguredReadOnlyMode;
use IBufferingStatsdDataFactory;
use JobQueueGroup;
use MediaWiki\Config\ServiceOptions;
+use MediaWiki\MainConfigNames;
use WANObjectCache;
use WikiMap;
use Wikimedia\UUID\GlobalIdGenerator;
@@ -39,10 +40,10 @@ class JobQueueGroupFactory {
* @internal For use by ServiceWiring
*/
public const CONSTRUCTOR_OPTIONS = [
- 'JobClasses',
- 'JobTypeConf',
- 'JobTypesExcludedFromDefaultQueue',
- 'LocalDatabases',
+ MainConfigNames::JobClasses,
+ MainConfigNames::JobTypeConf,
+ MainConfigNames::JobTypesExcludedFromDefaultQueue,
+ MainConfigNames::LocalDatabases,
];
/** @var JobQueueGroup[] */
@@ -103,7 +104,7 @@ class JobQueueGroupFactory {
$wikiId = WikiMap::getWikiIdFromDbDomain( $domain );
if (
!WikiMap::isCurrentWikiDbDomain( $domain ) &&
- !in_array( $wikiId, $this->options->get( 'LocalDatabases' ) )
+ !in_array( $wikiId, $this->options->get( MainConfigNames::LocalDatabases ) )
) {
$invalidDomain = true;
} else {
@@ -114,9 +115,9 @@ class JobQueueGroupFactory {
$domain,
$this->readOnlyMode,
$invalidDomain,
- $this->options->get( 'JobClasses' ),
- $this->options->get( 'JobTypeConf' ),
- $this->options->get( 'JobTypesExcludedFromDefaultQueue' ),
+ $this->options->get( MainConfigNames::JobClasses ),
+ $this->options->get( MainConfigNames::JobTypeConf ),
+ $this->options->get( MainConfigNames::JobTypesExcludedFromDefaultQueue ),
$this->statsdDataFactory,
$this->wanCache,
$this->globalIdGenerator
diff --git a/includes/jobqueue/JobRunner.php b/includes/jobqueue/JobRunner.php
index 6cfba0ab3c7c..d93f37a9cf81 100644
--- a/includes/jobqueue/JobRunner.php
+++ b/includes/jobqueue/JobRunner.php
@@ -24,6 +24,7 @@
use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
use MediaWiki\Config\ServiceOptions;
use MediaWiki\Logger\LoggerFactory;
+use MediaWiki\MainConfigNames;
use MediaWiki\MediaWikiServices;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerInterface;
@@ -45,11 +46,11 @@ class JobRunner implements LoggerAwareInterface {
* @internal For use by ServiceWiring
*/
public const CONSTRUCTOR_OPTIONS = [
- 'JobBackoffThrottling',
- 'JobClasses',
- 'JobSerialCommitThreshold',
- 'MaxJobDBWriteDuration',
- 'TrxProfilerLimits'
+ MainConfigNames::JobBackoffThrottling,
+ MainConfigNames::JobClasses,
+ MainConfigNames::JobSerialCommitThreshold,
+ MainConfigNames::MaxJobDBWriteDuration,
+ MainConfigNames::TrxProfilerLimits,
];
/** @var ServiceOptions */
@@ -173,8 +174,8 @@ class JobRunner implements LoggerAwareInterface {
$maxTime = $options['maxTime'] ?? false;
$throttle = $options['throttle'] ?? true;
- $jobClasses = $this->options->get( 'JobClasses' );
- $profilerLimits = $this->options->get( 'TrxProfilerLimits' );
+ $jobClasses = $this->options->get( MainConfigNames::JobClasses );
+ $profilerLimits = $this->options->get( MainConfigNames::TrxProfilerLimits );
$response = [ 'jobs' => [], 'reached' => 'none-ready' ];
@@ -476,7 +477,7 @@ class JobRunner implements LoggerAwareInterface {
* @see $wgJobBackoffThrottling
*/
private function getBackoffTimeToWait( RunnableJob $job ) {
- $throttling = $this->options->get( 'JobBackoffThrottling' );
+ $throttling = $this->options->get( MainConfigNames::JobBackoffThrottling );
if ( !isset( $throttling[$job->getType()] ) || $job instanceof DuplicateJob ) {
return 0; // not throttled
@@ -634,7 +635,7 @@ class JobRunner implements LoggerAwareInterface {
* @throws DBError
*/
private function commitPrimaryChanges( RunnableJob $job, $fnameTrxOwner ) {
- $syncThreshold = $this->options->get( 'JobSerialCommitThreshold' );
+ $syncThreshold = $this->options->get( MainConfigNames::JobSerialCommitThreshold );
$time = false;
$lb = $this->lbFactory->getMainLB();
@@ -659,7 +660,8 @@ class JobRunner implements LoggerAwareInterface {
$this->lbFactory->commitPrimaryChanges(
$fnameTrxOwner,
// Abort if any transaction was too big
- [ 'maxWriteDuration' => $this->options->get( 'MaxJobDBWriteDuration' ) ]
+ [ 'maxWriteDuration' =>
+ $this->options->get( MainConfigNames::MaxJobDBWriteDuration ) ]
);
return;
@@ -695,7 +697,7 @@ class JobRunner implements LoggerAwareInterface {
$this->lbFactory->commitPrimaryChanges(
$fnameTrxOwner,
// Abort if any transaction was too big
- [ 'maxWriteDuration' => $this->options->get( 'MaxJobDBWriteDuration' ) ]
+ [ 'maxWriteDuration' => $this->options->get( MainConfigNames::MaxJobDBWriteDuration ) ]
);
ScopedCallback::consume( $unlocker );
}
diff --git a/includes/language/Language.php b/includes/language/Language.php
index 385db4bfbc15..42b51b2f89b0 100644
--- a/includes/language/Language.php
+++ b/includes/language/Language.php
@@ -29,6 +29,7 @@ use MediaWiki\Languages\LanguageConverterFactory;
use MediaWiki\Languages\LanguageFallback;
use MediaWiki\Languages\LanguageNameUtils;
use MediaWiki\Logger\LoggerFactory;
+use MediaWiki\MainConfigNames;
use MediaWiki\MediaWikiServices;
use MediaWiki\User\UserIdentity;
use Wikimedia\Assert\Assert;
@@ -508,9 +509,9 @@ class Language {
*/
public function getNamespaces() {
if ( $this->namespaceNames === null ) {
- $metaNamespace = $this->config->get( 'MetaNamespace' );
- $metaNamespaceTalk = $this->config->get( 'MetaNamespaceTalk' );
- $extraNamespaces = $this->config->get( 'ExtraNamespaces' );
+ $metaNamespace = $this->config->get( MainConfigNames::MetaNamespace );
+ $metaNamespaceTalk = $this->config->get( MainConfigNames::MetaNamespaceTalk );
+ $extraNamespaces = $this->config->get( MainConfigNames::ExtraNamespaces );
$validNamespaces = MediaWikiServices::getInstance()->getNamespaceInfo()->
getCanonicalNamespaces();
@@ -621,7 +622,7 @@ class Language {
* @since 1.18
*/
public function getGenderNsText( $index, $gender ) {
- $extraGenderNamespaces = $this->config->get( 'ExtraGenderNamespaces' );
+ $extraGenderNamespaces = $this->config->get( MainConfigNames::ExtraGenderNamespaces );
$ns = $extraGenderNamespaces +
(array)$this->localisationCache->getItem( $this->mCode, 'namespaceGenderAliases' );
@@ -636,8 +637,8 @@ class Language {
* @since 1.18
*/
public function needsGenderDistinction() {
- $extraGenderNamespaces = $this->config->get( 'ExtraGenderNamespaces' );
- $extraNamespaces = $this->config->get( 'ExtraNamespaces' );
+ $extraGenderNamespaces = $this->config->get( MainConfigNames::ExtraGenderNamespaces );
+ $extraNamespaces = $this->config->get( MainConfigNames::ExtraNamespaces );
if ( count( $extraGenderNamespaces ) > 0 ) {
// $wgExtraGenderNamespaces overrides everything
return true;
@@ -685,7 +686,7 @@ class Language {
}
}
- $extraGenderNamespaces = $this->config->get( 'ExtraGenderNamespaces' );
+ $extraGenderNamespaces = $this->config->get( MainConfigNames::ExtraGenderNamespaces );
$genders = $extraGenderNamespaces + (array)$this->localisationCache
->getItem( $this->mCode, 'namespaceGenderAliases' );
foreach ( $genders as $index => $forms ) {
@@ -709,7 +710,8 @@ class Language {
// In the case of conflicts between $wgNamespaceAliases and other sources
// of aliasing, $wgNamespaceAliases wins.
- $this->namespaceAliases = $this->config->get( 'NamespaceAliases' ) + $this->namespaceAliases;
+ $this->namespaceAliases = $this->config->get( MainConfigNames::NamespaceAliases ) +
+ $this->namespaceAliases;
# Filter out aliases to namespaces that don't exist, e.g. from extensions
# that aren't loaded here but are included in the l10n cache.
@@ -802,7 +804,7 @@ class Language {
public function getDefaultDateFormat() {
$df = $this->localisationCache->getItem( $this->mCode, 'defaultDateFormat' );
if ( $df === 'dmy or mdy' ) {
- return $this->config->get( 'AmericanDates' ) ? 'mdy' : 'dmy';
+ return $this->config->get( MainConfigNames::AmericanDates ) ? 'mdy' : 'dmy';
} else {
return $df;
}
@@ -2075,7 +2077,7 @@ class Language {
* @return string
*/
public function userAdjust( $ts, $tz = false ) {
- $localTZoffset = $this->config->get( 'LocalTZoffset' );
+ $localTZoffset = $this->config->get( MainConfigNames::LocalTZoffset );
if ( $tz === false ) {
$optionsLookup = MediaWikiServices::getInstance()->getUserOptionsLookup();
$tz = $optionsLookup->getOption(
@@ -2688,7 +2690,8 @@ class Language {
* @return string
*/
protected function mbUpperChar( $char ) {
- $overrideUcfirstCharacters = $this->config->get( 'OverrideUcfirstCharacters' );
+ $overrideUcfirstCharacters =
+ $this->config->get( MainConfigNames::OverrideUcfirstCharacters );
return $overrideUcfirstCharacters[$char] ?? mb_strtoupper( $char );
}
@@ -2972,7 +2975,7 @@ class Language {
* @return string
*/
public function normalize( $s ) {
- $allUnicodeFixes = $this->config->get( 'AllUnicodeFixes' );
+ $allUnicodeFixes = $this->config->get( MainConfigNames::AllUnicodeFixes );
$s = UtfNormal\Validator::cleanUp( $s );
// Optimization: This is disabled by default to avoid negative performance impact.
@@ -3209,7 +3212,7 @@ class Language {
private function formatNumInternal(
string $number, bool $noTranslate, bool $noSeparators
): string {
- $translateNumerals = $this->config->get( 'TranslateNumerals' );
+ $translateNumerals = $this->config->get( MainConfigNames::TranslateNumerals );
if ( $number === '' ) {
return $number;
@@ -3851,7 +3854,7 @@ class Language {
* @return string
*/
public function convertGrammar( $word, $case ) {
- $grammarForms = $this->config->get( 'GrammarForms' );
+ $grammarForms = $this->config->get( MainConfigNames::GrammarForms );
if ( isset( $grammarForms[$this->getCode()][$case][$word] ) ) {
return $grammarForms[$this->getCode()][$case][$word];
}
@@ -3902,7 +3905,7 @@ class Language {
* @since 1.20
*/
public function getGrammarForms() {
- $grammarForms = $this->config->get( 'GrammarForms' );
+ $grammarForms = $this->config->get( MainConfigNames::GrammarForms );
if ( isset( $grammarForms[$this->getCode()] )
&& is_array( $grammarForms[$this->getCode()] )
) {
@@ -4534,7 +4537,7 @@ class Language {
return $talk;
}
- $talk = str_replace( '$1', $this->config->get( 'MetaNamespace' ), $talk );
+ $talk = str_replace( '$1', $this->config->get( MainConfigNames::MetaNamespace ), $talk );
# Allow grammar transformations
# Allowing full message-style parsing would make simple requests
diff --git a/includes/language/LanguageConverter.php b/includes/language/LanguageConverter.php
index 7bfab4b8de0a..2c81cf6deca1 100644
--- a/includes/language/LanguageConverter.php
+++ b/includes/language/LanguageConverter.php
@@ -24,6 +24,7 @@
use MediaWiki\Linker\LinkTarget;
use MediaWiki\Logger\LoggerFactory;
+use MediaWiki\MainConfigNames;
use MediaWiki\MediaWikiServices;
use MediaWiki\Page\PageReference;
use MediaWiki\Revision\RevisionRecord;
@@ -254,7 +255,8 @@ abstract class LanguageConverter implements ILanguageConverter {
* @return string[] Contains all valid variants
*/
final public function getVariants() {
- $disabledVariants = MediaWikiServices::getInstance()->getMainConfig()->get( 'DisabledVariants' );
+ $disabledVariants = MediaWikiServices::getInstance()->getMainConfig()->get(
+ MainConfigNames::DisabledVariants );
return array_diff( $this->getLanguageVariants(), $disabledVariants );
}
@@ -286,7 +288,8 @@ abstract class LanguageConverter implements ILanguageConverter {
* @return string The preferred language code
*/
public function getPreferredVariant() {
- $defaultLanguageVariant = MediaWikiServices::getInstance()->getMainConfig()->get( 'DefaultLanguageVariant' );
+ $defaultLanguageVariant = MediaWikiServices::getInstance()->getMainConfig()->get(
+ MainConfigNames::DefaultLanguageVariant );
$req = $this->getURLVariant();
@@ -324,7 +327,8 @@ abstract class LanguageConverter implements ILanguageConverter {
* @return string The default variant code
*/
public function getDefaultVariant() {
- $defaultLanguageVariant = MediaWikiServices::getInstance()->getMainConfig()->get( 'DefaultLanguageVariant' );
+ $defaultLanguageVariant = MediaWikiServices::getInstance()->getMainConfig()->get(
+ MainConfigNames::DefaultLanguageVariant );
$req = $this->getURLVariant();
@@ -1092,7 +1096,7 @@ abstract class LanguageConverter implements ILanguageConverter {
*/
protected function loadTables( $fromCache = true ) {
$languageConverterCacheType = MediaWikiServices::getInstance()
- ->getMainConfig()->get( 'LanguageConverterCacheType' );
+ ->getMainConfig()->get( MainConfigNames::LanguageConverterCacheType );
if ( $this->mTablesLoaded ) {
return;
diff --git a/includes/language/LanguageNameUtils.php b/includes/language/LanguageNameUtils.php
index c7549f36d354..d02b9c9ac1a9 100644
--- a/includes/language/LanguageNameUtils.php
+++ b/includes/language/LanguageNameUtils.php
@@ -29,6 +29,7 @@ use HashBagOStuff;
use MediaWiki\Config\ServiceOptions;
use MediaWiki\HookContainer\HookContainer;
use MediaWiki\HookContainer\HookRunner;
+use MediaWiki\MainConfigNames;
use MediaWikiTitleCodec;
use MWException;
@@ -80,8 +81,8 @@ class LanguageNameUtils {
* @internal For use by ServiceWiring
*/
public const CONSTRUCTOR_OPTIONS = [
- 'ExtraLanguageNames',
- 'UsePigLatinVariant',
+ MainConfigNames::ExtraLanguageNames,
+ MainConfigNames::UsePigLatinVariant,
];
/** @var HookRunner */
@@ -221,8 +222,8 @@ class LanguageNameUtils {
$this->hookRunner->onLanguageGetTranslatedLanguageNames( $names, $inLanguage );
}
- $mwNames = $this->options->get( 'ExtraLanguageNames' ) + Data\Names::$names;
- if ( $this->options->get( 'UsePigLatinVariant' ) ) {
+ $mwNames = $this->options->get( MainConfigNames::ExtraLanguageNames ) + Data\Names::$names;
+ if ( $this->options->get( MainConfigNames::UsePigLatinVariant ) ) {
// Pig Latin (for variant development)
$mwNames['en-x-piglatin'] = 'Igpay Atinlay';
}
diff --git a/includes/language/Message.php b/includes/language/Message.php
index 7cafcbc8d30f..7af2a4309aef 100644
--- a/includes/language/Message.php
+++ b/includes/language/Message.php
@@ -20,6 +20,7 @@
*/
use MediaWiki\Logger\LoggerFactory;
+use MediaWiki\MainConfigNames;
use MediaWiki\MediaWikiServices;
use MediaWiki\Message\UserGroupMembershipParam;
use MediaWiki\Page\PageReference;
@@ -477,7 +478,8 @@ class Message implements MessageSpecifier, Serializable {
* @since 1.26
*/
public function getTitle() {
- $forceUIMsgAsContentMsg = MediaWikiServices::getInstance()->getMainConfig()->get( 'ForceUIMsgAsContentMsg' );
+ $forceUIMsgAsContentMsg = MediaWikiServices::getInstance()->getMainConfig()->get(
+ MainConfigNames::ForceUIMsgAsContentMsg );
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
$lang = $this->getLanguage();
@@ -865,7 +867,8 @@ class Message implements MessageSpecifier, Serializable {
* @return Message $this
*/
public function inContentLanguage() {
- $forceUIMsgAsContentMsg = MediaWikiServices::getInstance()->getMainConfig()->get( 'ForceUIMsgAsContentMsg' );
+ $forceUIMsgAsContentMsg = MediaWikiServices::getInstance()->getMainConfig()->get(
+ MainConfigNames::ForceUIMsgAsContentMsg );
if ( in_array( $this->key, (array)$forceUIMsgAsContentMsg ) ) {
return $this;
}
diff --git a/includes/linker/LinksMigration.php b/includes/linker/LinksMigration.php
index b2972e06ffb3..bbd44d698623 100644
--- a/includes/linker/LinksMigration.php
+++ b/includes/linker/LinksMigration.php
@@ -22,6 +22,7 @@ namespace MediaWiki\Linker;
use Config;
use InvalidArgumentException;
+use MediaWiki\MainConfigNames;
/**
* Service for compat reading of links tables
@@ -38,7 +39,7 @@ class LinksMigration {
public static $mapping = [
'templatelinks' => [
- 'config' => 'TemplateLinksSchemaMigrationStage',
+ 'config' => MainConfigNames::TemplateLinksSchemaMigrationStage,
'page_id' => 'tl_from',
'ns' => 'tl_namespace',
'title' => 'tl_title',
diff --git a/includes/objectcache/ObjectCache.php b/includes/objectcache/ObjectCache.php
index d4109d4a9c60..770b619a4fbd 100644
--- a/includes/objectcache/ObjectCache.php
+++ b/includes/objectcache/ObjectCache.php
@@ -22,6 +22,7 @@
*/
use MediaWiki\Logger\LoggerFactory;
+use MediaWiki\MainConfigNames;
use MediaWiki\MediaWikiServices;
/**
@@ -174,7 +175,7 @@ class ObjectCache {
if ( isset( $params['servers'] ) ) {
foreach ( $params['servers'] as &$server ) {
if ( $server['type'] === 'sqlite' && !isset( $server['dbDirectory'] ) ) {
- $server['dbDirectory'] = $conf->get( 'SQLiteDataDir' );
+ $server['dbDirectory'] = $conf->get( MainConfigNames::SQLiteDataDir );
}
}
} elseif ( !isset( $params['localKeyLB'] ) ) {
@@ -184,15 +185,15 @@ class ObjectCache {
}
];
}
- $params += [ 'writeBatchSize' => $conf->get( 'UpdateRowsPerQuery' ) ];
+ $params += [ 'writeBatchSize' => $conf->get( MainConfigNames::UpdateRowsPerQuery ) ];
}
// Do b/c logic for MemcachedBagOStuff
if ( is_subclass_of( $class, MemcachedBagOStuff::class ) ) {
$params += [
- 'servers' => $conf->get( 'MemCachedServers' ),
- 'persistent' => $conf->get( 'MemCachedPersistent' ),
- 'timeout' => $conf->get( 'MemCachedTimeout' ),
+ 'servers' => $conf->get( MainConfigNames::MemCachedServers ),
+ 'persistent' => $conf->get( MainConfigNames::MemCachedPersistent ),
+ 'timeout' => $conf->get( MainConfigNames::MemCachedTimeout ),
];
}
diff --git a/includes/page/DeletePage.php b/includes/page/DeletePage.php
index 4b3e8c7b0db4..3067f09438dd 100644
--- a/includes/page/DeletePage.php
+++ b/includes/page/DeletePage.php
@@ -21,6 +21,7 @@ use MediaWiki\Deferred\LinksUpdate\LinksUpdate;
use MediaWiki\HookContainer\HookContainer;
use MediaWiki\HookContainer\HookRunner;
use MediaWiki\Logger\LoggerFactory;
+use MediaWiki\MainConfigNames;
use MediaWiki\Permissions\Authority;
use MediaWiki\Permissions\PermissionStatus;
use MediaWiki\Revision\RevisionRecord;
@@ -53,9 +54,9 @@ class DeletePage {
* @internal For use by PageCommandFactory
*/
public const CONSTRUCTOR_OPTIONS = [
- 'DeleteRevisionsBatchSize',
- 'ActorTableSchemaMigrationStage',
- 'DeleteRevisionsLimit',
+ MainConfigNames::DeleteRevisionsBatchSize,
+ MainConfigNames::ActorTableSchemaMigrationStage,
+ MainConfigNames::DeleteRevisionsLimit,
];
/**
@@ -395,7 +396,7 @@ class DeletePage {
if ( !$this->deleter->isAllowed( 'bigdelete' ) && $this->isBigDeletion() ) {
$status->fatal(
'delete-toomanyrevisions',
- Message::numParam( $this->options->get( 'DeleteRevisionsLimit' ) )
+ Message::numParam( $this->options->get( MainConfigNames::DeleteRevisionsLimit ) )
);
}
if ( $this->tags ) {
@@ -408,7 +409,7 @@ class DeletePage {
* @return bool
*/
private function isBigDeletion(): bool {
- $revLimit = $this->options->get( 'DeleteRevisionsLimit' );
+ $revLimit = $this->options->get( MainConfigNames::DeleteRevisionsLimit );
if ( !$revLimit ) {
return false;
}
@@ -439,7 +440,7 @@ class DeletePage {
$revCount = $this->revisionStore->countRevisionsByPageId( $dbr, $this->page->getId() );
$revCount += $safetyMargin;
- if ( $revCount >= $this->options->get( 'DeleteRevisionsBatchSize' ) ) {
+ if ( $revCount >= $this->options->get( MainConfigNames::DeleteRevisionsBatchSize ) ) {
return true;
} elseif ( !$this->associatedTalk ) {
return false;
@@ -448,7 +449,7 @@ class DeletePage {
$talkRevCount = $this->revisionStore->countRevisionsByPageId( $dbr, $this->associatedTalk->getId() );
$talkRevCount += $safetyMargin;
- return $talkRevCount >= $this->options->get( 'DeleteRevisionsBatchSize' );
+ return $talkRevCount >= $this->options->get( MainConfigNames::DeleteRevisionsBatchSize );
}
/**
@@ -763,7 +764,7 @@ class DeletePage {
$revQuery['joins']
);
- $deleteBatchSize = $this->options->get( 'DeleteRevisionsBatchSize' );
+ $deleteBatchSize = $this->options->get( MainConfigNames::DeleteRevisionsBatchSize );
// Get as many of the page revisions as we are allowed to. The +1 lets us recognize the
// unusual case where there were exactly $deleteBatchSize revisions remaining.
$res = $dbw->select(
@@ -820,7 +821,8 @@ class DeletePage {
$dbw->delete( 'revision', [ 'rev_id' => $revids ], __METHOD__ );
$dbw->delete( 'revision_comment_temp', [ 'revcomment_rev' => $revids ], __METHOD__ );
- if ( $this->options->get( 'ActorTableSchemaMigrationStage' ) & SCHEMA_COMPAT_WRITE_TEMP ) {
+ if ( $this->options->get( MainConfigNames::ActorTableSchemaMigrationStage )
+ & SCHEMA_COMPAT_WRITE_TEMP ) {
$dbw->delete( 'revision_actor_temp', [ 'revactor_rev' => $revids ], __METHOD__ );
}
diff --git a/includes/page/PageStore.php b/includes/page/PageStore.php
index 9032d3785789..feeb144b942f 100644
--- a/includes/page/PageStore.php
+++ b/includes/page/PageStore.php
@@ -12,6 +12,7 @@ use MalformedTitleException;
use MediaWiki\Config\ServiceOptions;
use MediaWiki\DAO\WikiAwareEntity;
use MediaWiki\Linker\LinkTarget;
+use MediaWiki\MainConfigNames;
use NamespaceInfo;
use NullStatsdDataFactory;
use stdClass;
@@ -51,7 +52,7 @@ class PageStore implements PageLookup {
* @internal for use by service wiring
*/
public const CONSTRUCTOR_OPTIONS = [
- 'PageLanguageUseDB',
+ MainConfigNames::PageLanguageUseDB,
];
/**
@@ -376,7 +377,7 @@ class PageStore implements PageLookup {
'page_content_model'
];
- if ( $this->options->get( 'PageLanguageUseDB' ) ) {
+ if ( $this->options->get( MainConfigNames::PageLanguageUseDB ) ) {
$fields[] = 'page_lang';
}
diff --git a/includes/page/RollbackPage.php b/includes/page/RollbackPage.php
index 23678bf92fca..afda015d22f7 100644
--- a/includes/page/RollbackPage.php
+++ b/includes/page/RollbackPage.php
@@ -26,6 +26,7 @@ use ManualLogEntry;
use MediaWiki\Config\ServiceOptions;
use MediaWiki\HookContainer\HookContainer;
use MediaWiki\HookContainer\HookRunner;
+use MediaWiki\MainConfigNames;
use MediaWiki\Message\Converter;
use MediaWiki\Permissions\Authority;
use MediaWiki\Permissions\PermissionStatus;
@@ -59,8 +60,8 @@ class RollbackPage {
* @var array
*/
public const CONSTRUCTOR_OPTIONS = [
- 'UseRCPatrol',
- 'DisableAnonTalk',
+ MainConfigNames::UseRCPatrol,
+ MainConfigNames::DisableAnonTalk,
];
/** @var ServiceOptions */
@@ -358,7 +359,7 @@ class RollbackPage {
// TODO: this logic should not be in the storage layer, it's here for compatibility
// with 1.31 behavior. Applying the 'autopatrol' right should be done in the same
// place the 'bot' right is handled, which is currently in EditPage::attemptSave.
- if ( $this->options->get( 'UseRCPatrol' ) &&
+ if ( $this->options->get( MainConfigNames::UseRCPatrol ) &&
$this->performer->authorizeWrite( 'autopatrol', $this->page )
) {
$updater->setRcPatrolStatus( RecentChange::PRC_AUTOPATROLLED );
@@ -445,7 +446,7 @@ class RollbackPage {
$set['rc_bot'] = 1;
}
- if ( $this->options->get( 'UseRCPatrol' ) ) {
+ if ( $this->options->get( MainConfigNames::UseRCPatrol ) ) {
// Mark all reverted edits as patrolled
$set['rc_patrolled'] = RecentChange::PRC_AUTOPATROLLED;
}
@@ -478,7 +479,8 @@ class RollbackPage {
if ( $this->summary === '' ) {
if ( !$currentEditorForPublic ) { // no public user name
$summary = MessageValue::new( 'revertpage-nouser' );
- } elseif ( $this->options->get( 'DisableAnonTalk' ) && !$currentEditorForPublic->isRegistered() ) {
+ } elseif ( $this->options->get( MainConfigNames::DisableAnonTalk ) &&
+ !$currentEditorForPublic->isRegistered() ) {
$summary = MessageValue::new( 'revertpage-anon' );
} else {
$summary = MessageValue::new( 'revertpage' );
diff --git a/includes/preferences/DefaultPreferencesFactory.php b/includes/preferences/DefaultPreferencesFactory.php
index 892bd653c1d4..6841d9a707e0 100644
--- a/includes/preferences/DefaultPreferencesFactory.php
+++ b/includes/preferences/DefaultPreferencesFactory.php
@@ -39,6 +39,7 @@ use MediaWiki\HookContainer\HookRunner;
use MediaWiki\Languages\LanguageConverterFactory;
use MediaWiki\Languages\LanguageNameUtils;
use MediaWiki\Linker\LinkRenderer;
+use MediaWiki\MainConfigNames;
use MediaWiki\MediaWikiServices;
use MediaWiki\Permissions\PermissionManager;
use MediaWiki\User\UserGroupManager;
@@ -120,34 +121,34 @@ class DefaultPreferencesFactory implements PreferencesFactory {
* @internal For use by ServiceWiring
*/
public const CONSTRUCTOR_OPTIONS = [
- 'AllowRequiringEmailForResets',
- 'AllowUserCss',
- 'AllowUserCssPrefs',
- 'AllowUserJs',
- 'DefaultSkin',
- 'EmailAuthentication',
- 'EmailConfirmToEdit',
- 'EnableEmail',
- 'EnableUserEmail',
- 'EnableUserEmailMuteList',
- 'EnotifMinorEdits',
- 'EnotifRevealEditorAddress',
- 'EnotifUserTalk',
- 'EnotifWatchlist',
- 'ForceHTTPS',
- 'HiddenPrefs',
- 'ImageLimits',
- 'LanguageCode',
- 'LocalTZoffset',
- 'MaxSigChars',
- 'RCMaxAge',
- 'RCShowWatchingUsers',
- 'RCWatchCategoryMembership',
- 'SearchMatchRedirectPreference',
- 'SecureLogin',
- 'ScriptPath',
- 'SignatureValidation',
- 'ThumbLimits',
+ MainConfigNames::AllowRequiringEmailForResets,
+ MainConfigNames::AllowUserCss,
+ MainConfigNames::AllowUserCssPrefs,
+ MainConfigNames::AllowUserJs,
+ MainConfigNames::DefaultSkin,
+ MainConfigNames::EmailAuthentication,
+ MainConfigNames::EmailConfirmToEdit,
+ MainConfigNames::EnableEmail,
+ MainConfigNames::EnableUserEmail,
+ MainConfigNames::EnableUserEmailMuteList,
+ MainConfigNames::EnotifMinorEdits,
+ MainConfigNames::EnotifRevealEditorAddress,
+ MainConfigNames::EnotifUserTalk,
+ MainConfigNames::EnotifWatchlist,
+ MainConfigNames::ForceHTTPS,
+ MainConfigNames::HiddenPrefs,
+ MainConfigNames::ImageLimits,
+ MainConfigNames::LanguageCode,
+ MainConfigNames::LocalTZoffset,
+ MainConfigNames::MaxSigChars,
+ MainConfigNames::RCMaxAge,
+ MainConfigNames::RCShowWatchingUsers,
+ MainConfigNames::RCWatchCategoryMembership,
+ MainConfigNames::SearchMatchRedirectPreference,
+ MainConfigNames::SecureLogin,
+ MainConfigNames::ScriptPath,
+ MainConfigNames::SignatureValidation,
+ MainConfigNames::ThumbLimits,
];
/**
@@ -310,7 +311,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
*/
private function loadPreferenceValues( User $user, IContextSource $context, &$defaultPreferences ) {
// Remove preferences that wikis don't want to use
- foreach ( $this->options->get( 'HiddenPrefs' ) as $pref ) {
+ foreach ( $this->options->get( MainConfigNames::HiddenPrefs ) as $pref ) {
unset( $defaultPreferences[$pref] );
}
@@ -527,7 +528,8 @@ class DefaultPreferencesFactory implements PreferencesFactory {
] ),
'label-message' => 'yourpassword',
// email password reset feature only works for users that have an email set up
- 'help' => $this->options->get( 'AllowRequiringEmailForResets' ) && $user->getEmail()
+ 'help' => $this->options->get( MainConfigNames::AllowRequiringEmailForResets ) &&
+ $user->getEmail()
? $context->msg( 'prefs-help-yourpassword',
'[[#mw-prefsection-personal-email|{{int:prefs-email}}]]' )->parse()
: '',
@@ -535,8 +537,8 @@ class DefaultPreferencesFactory implements PreferencesFactory {
];
}
// Only show prefershttps if secure login is turned on
- if ( !$this->options->get( 'ForceHTTPS' )
- && $this->options->get( 'SecureLogin' )
+ if ( !$this->options->get( MainConfigNames::ForceHTTPS )
+ && $this->options->get( MainConfigNames::SecureLogin )
) {
$defaultPreferences['prefershttps'] = [
'type' => 'toggle',
@@ -553,7 +555,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
'default' => HTML::Element(
'a',
[
- 'href' => $this->options->get( 'ScriptPath' ) .
+ 'href' => $this->options->get( MainConfigNames::ScriptPath ) .
'/api.php?action=query&meta=userinfo&uiprop=*',
],
$context->msg( 'prefs-user-downloaddata-info' )->text()
@@ -566,7 +568,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
LanguageNameUtils::AUTONYMS,
LanguageNameUtils::SUPPORTED
);
- $languageCode = $this->options->get( 'LanguageCode' );
+ $languageCode = $this->options->get( MainConfigNames::LanguageCode );
if ( !array_key_exists( $languageCode, $languages ) ) {
$languages[$languageCode] = $languageCode;
// Sort the array again
@@ -662,7 +664,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
->newSignatureValidator( $user, $context, $parserOpts );
$signatureErrors = $validator->validateSignature( $signature );
if ( $signatureErrors ) {
- $sigValidation = $this->options->get( 'SignatureValidation' );
+ $sigValidation = $this->options->get( MainConfigNames::SignatureValidation );
$oldsigHTML .= '<p><strong>' .
// Messages used here:
// * prefs-signature-invalid-warning
@@ -702,7 +704,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
];
$defaultPreferences['nickname'] = [
'type' => $this->authManager->allowsPropertyChange( 'nickname' ) ? 'text' : 'info',
- 'maxlength' => $this->options->get( 'MaxSigChars' ),
+ 'maxlength' => $this->options->get( MainConfigNames::MaxSigChars ),
'label-message' => 'yournick',
'validation-callback' => function ( $signature, $alldata, HTMLForm $form ) {
return $this->validateSignature( $signature, $alldata, $form );
@@ -721,14 +723,14 @@ class DefaultPreferencesFactory implements PreferencesFactory {
];
// Email preferences
- if ( $this->options->get( 'EnableEmail' ) ) {
+ if ( $this->options->get( MainConfigNames::EnableEmail ) ) {
if ( $canViewPrivateInfo ) {
$helpMessages = [];
- $helpMessages[] = $this->options->get( 'EmailConfirmToEdit' )
+ $helpMessages[] = $this->options->get( MainConfigNames::EmailConfirmToEdit )
? 'prefs-help-email-required'
: 'prefs-help-email';
- if ( $this->options->get( 'EnableUserEmail' ) ) {
+ if ( $this->options->get( MainConfigNames::EnableUserEmail ) ) {
// additional messages when users can send email to each other
$helpMessages[] = 'prefs-help-email-others';
}
@@ -759,7 +761,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
$disableEmailPrefs = false;
- if ( $this->options->get( 'AllowRequiringEmailForResets' ) ) {
+ if ( $this->options->get( MainConfigNames::AllowRequiringEmailForResets ) ) {
$defaultPreferences['requireemail'] = [
'type' => 'toggle',
'label-message' => 'tog-requireemail',
@@ -769,7 +771,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
];
}
- if ( $this->options->get( 'EmailAuthentication' ) ) {
+ if ( $this->options->get( MainConfigNames::EmailAuthentication ) ) {
if ( $user->getEmail() ) {
if ( $user->getEmailAuthenticationTimestamp() ) {
// date and time are separate parameters to facilitate localisation.
@@ -811,7 +813,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
}
}
- if ( $this->options->get( 'EnableUserEmail' ) &&
+ if ( $this->options->get( MainConfigNames::EnableUserEmail ) &&
$user->isAllowed( 'sendemail' )
) {
$defaultPreferences['disablemail'] = [
@@ -839,7 +841,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
'disabled' => $disableEmailPrefs,
];
- if ( $this->options->get( 'EnableUserEmailMuteList' ) ) {
+ if ( $this->options->get( MainConfigNames::EnableUserEmailMuteList ) ) {
$defaultPreferences['email-blacklist'] = [
'type' => 'usersmultiselect',
'label-message' => 'email-mutelist-label',
@@ -850,7 +852,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
}
}
- if ( $this->options->get( 'EnotifWatchlist' ) ) {
+ if ( $this->options->get( MainConfigNames::EnotifWatchlist ) ) {
$defaultPreferences['enotifwatchlistpages'] = [
'type' => 'toggle',
'section' => 'personal/email',
@@ -858,7 +860,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
'disabled' => $disableEmailPrefs,
];
}
- if ( $this->options->get( 'EnotifUserTalk' ) ) {
+ if ( $this->options->get( MainConfigNames::EnotifUserTalk ) ) {
$defaultPreferences['enotifusertalkpages'] = [
'type' => 'toggle',
'section' => 'personal/email',
@@ -866,9 +868,9 @@ class DefaultPreferencesFactory implements PreferencesFactory {
'disabled' => $disableEmailPrefs,
];
}
- if ( $this->options->get( 'EnotifUserTalk' ) ||
- $this->options->get( 'EnotifWatchlist' ) ) {
- if ( $this->options->get( 'EnotifMinorEdits' ) ) {
+ if ( $this->options->get( MainConfigNames::EnotifUserTalk ) ||
+ $this->options->get( MainConfigNames::EnotifWatchlist ) ) {
+ if ( $this->options->get( MainConfigNames::EnotifMinorEdits ) ) {
$defaultPreferences['enotifminoredits'] = [
'type' => 'toggle',
'section' => 'personal/email',
@@ -877,7 +879,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
];
}
- if ( $this->options->get( 'EnotifRevealEditorAddress' ) ) {
+ if ( $this->options->get( MainConfigNames::EnotifRevealEditorAddress ) ) {
$defaultPreferences['enotifrevealaddr'] = [
'type' => 'toggle',
'section' => 'personal/email',
@@ -913,8 +915,8 @@ class DefaultPreferencesFactory implements PreferencesFactory {
];
}
- $allowUserCss = $this->options->get( 'AllowUserCss' );
- $allowUserJs = $this->options->get( 'AllowUserJs' );
+ $allowUserCss = $this->options->get( MainConfigNames::AllowUserCss );
+ $allowUserJs = $this->options->get( MainConfigNames::AllowUserJs );
// Create links to user CSS/JS pages for all skins.
// This code is basically copied from generateSkinOptions().
// @todo Refactor this and the similar code in generateSkinOptions().
@@ -1069,7 +1071,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
];
// Page Rendering
- if ( $this->options->get( 'AllowUserCssPrefs' ) ) {
+ if ( $this->options->get( MainConfigNames::AllowUserCssPrefs ) ) {
$defaultPreferences['underline'] = [
'type' => 'select',
'options' => [
@@ -1114,7 +1116,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
'label-message' => 'tog-editondblclick',
];
- if ( $this->options->get( 'AllowUserCssPrefs' ) ) {
+ if ( $this->options->get( MainConfigNames::AllowUserCssPrefs ) ) {
$defaultPreferences['editfont'] = [
'type' => 'select',
'section' => 'editing/editor',
@@ -1169,7 +1171,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
* @param array &$defaultPreferences
*/
protected function rcPreferences( User $user, MessageLocalizer $l10n, &$defaultPreferences ) {
- $rcMaxAge = $this->options->get( 'RCMaxAge' );
+ $rcMaxAge = $this->options->get( MainConfigNames::RCMaxAge );
$rcMax = ceil( $rcMaxAge / ( 3600 * 24 ) );
$defaultPreferences['rcdays'] = [
'type' => 'float',
@@ -1224,7 +1226,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
'type' => 'api',
];
- if ( $this->options->get( 'RCWatchCategoryMembership' ) ) {
+ if ( $this->options->get( MainConfigNames::RCWatchCategoryMembership ) ) {
$defaultPreferences['hidecategorization'] = [
'type' => 'toggle',
'label-message' => 'tog-hidecategorization',
@@ -1248,7 +1250,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
];
}
- if ( $this->options->get( 'RCShowWatchingUsers' ) ) {
+ if ( $this->options->get( MainConfigNames::RCShowWatchingUsers ) ) {
$defaultPreferences['shownumberswatching'] = [
'type' => 'toggle',
'section' => 'rc/advancedrc',
@@ -1272,7 +1274,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
protected function watchlistPreferences(
User $user, IContextSource $context, &$defaultPreferences
) {
- $watchlistdaysMax = ceil( $this->options->get( 'RCMaxAge' ) / ( 3600 * 24 ) );
+ $watchlistdaysMax = ceil( $this->options->get( MainConfigNames::RCMaxAge ) / ( 3600 * 24 ) );
if ( $user->isAllowed( 'editmywatchlist' ) ) {
$editWatchlistLinks = '';
@@ -1364,7 +1366,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
'label-message' => 'tog-watchlistunwatchlinks',
];
- if ( $this->options->get( 'RCWatchCategoryMembership' ) ) {
+ if ( $this->options->get( MainConfigNames::RCWatchCategoryMembership ) ) {
$defaultPreferences['watchlisthidecategorization'] = [
'type' => 'toggle',
'section' => 'watchlist/changeswatchlist',
@@ -1453,7 +1455,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
];
}
- if ( $this->options->get( 'SearchMatchRedirectPreference' ) ) {
+ if ( $this->options->get( MainConfigNames::SearchMatchRedirectPreference ) ) {
$defaultPreferences['search-match-redirect'] = [
'type' => 'toggle',
'section' => 'searchoptions/searchmisc',
@@ -1554,16 +1556,17 @@ class DefaultPreferencesFactory implements PreferencesFactory {
}
}
- $preferredSkins = MediaWikiServices::getInstance()->getMainConfig()->get( 'SkinsPreferred' );
+ $preferredSkins = MediaWikiServices::getInstance()->getMainConfig()->get(
+ MainConfigNames::SkinsPreferred );
// Sort by the internal name, so that the ordering is the same for each display language,
// especially if some skin names are translated to use a different alphabet and some are not.
uksort( $validSkinNames, function ( $a, $b ) use ( $currentUserSkin, $preferredSkins ) {
return $this->sortSkinNames( $a, $b, $currentUserSkin, $preferredSkins );
} );
- $defaultSkin = $this->options->get( 'DefaultSkin' );
- $allowUserCss = $this->options->get( 'AllowUserCss' );
- $allowUserJs = $this->options->get( 'AllowUserJs' );
+ $defaultSkin = $this->options->get( MainConfigNames::DefaultSkin );
+ $allowUserCss = $this->options->get( MainConfigNames::AllowUserCss );
+ $allowUserJs = $this->options->get( MainConfigNames::AllowUserJs );
$foundDefault = false;
foreach ( $validSkinNames as $skinkey => $sn ) {
$linkTools = [];
@@ -1649,7 +1652,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
$ret = [];
$pixels = $l10n->msg( 'unit-pixel' )->text();
- foreach ( $this->options->get( 'ImageLimits' ) as $index => $limits ) {
+ foreach ( $this->options->get( MainConfigNames::ImageLimits ) as $index => $limits ) {
// Note: A left-to-right marker (U+200E) is inserted, see T144386
$display = "{$limits[0]}\u{200E}×{$limits[1]}$pixels";
$ret[$display] = $index;
@@ -1666,7 +1669,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
$ret = [];
$pixels = $l10n->msg( 'unit-pixel' )->text();
- foreach ( $this->options->get( 'ThumbLimits' ) as $index => $size ) {
+ foreach ( $this->options->get( MainConfigNames::ThumbLimits ) as $index => $size ) {
$display = $size . $pixels;
$ret[$display] = $index;
}
@@ -1681,8 +1684,8 @@ class DefaultPreferencesFactory implements PreferencesFactory {
* @return bool|string|string[]
*/
protected function validateSignature( $signature, $alldata, HTMLForm $form ) {
- $sigValidation = $this->options->get( 'SignatureValidation' );
- $maxSigChars = $this->options->get( 'MaxSigChars' );
+ $sigValidation = $this->options->get( MainConfigNames::SignatureValidation );
+ $maxSigChars = $this->options->get( MainConfigNames::MaxSigChars );
if ( mb_strlen( $signature ) > $maxSigChars ) {
return $form->msg( 'badsiglength' )->numParams( $maxSigChars )->escaped();
}
@@ -1823,7 +1826,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
protected function getTimezoneOptions( IContextSource $context ) {
$opt = [];
- $localTZoffset = $this->options->get( 'LocalTZoffset' );
+ $localTZoffset = $this->options->get( MainConfigNames::LocalTZoffset );
$timeZoneList = $this->getTimeZoneList( $context->getLanguage() );
$timestamp = MWTimestamp::getLocalInstance();
@@ -1870,7 +1873,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
*/
protected function saveFormData( $formData, PreferencesFormOOUI $form, array $formDescriptor ) {
$user = $form->getModifiedUser();
- $hiddenPrefs = $this->options->get( 'HiddenPrefs' );
+ $hiddenPrefs = $this->options->get( MainConfigNames::HiddenPrefs );
$result = true;
if ( !$user->isAllowedAny( 'editmyprivateinfo', 'editmyoptions' )
diff --git a/includes/preferences/SignatureValidator.php b/includes/preferences/SignatureValidator.php
index 8fd7bcb12f86..f6c4cd674e78 100644
--- a/includes/preferences/SignatureValidator.php
+++ b/includes/preferences/SignatureValidator.php
@@ -22,6 +22,7 @@ namespace MediaWiki\Preferences;
use Html;
use MediaWiki\Config\ServiceOptions;
+use MediaWiki\MainConfigNames;
use MediaWiki\Parser\ParserOutputFlags;
use MediaWiki\SpecialPage\SpecialPageFactory;
use MediaWiki\User\UserIdentity;
@@ -41,8 +42,8 @@ class SignatureValidator {
/** @var array Made public for use in services */
public const CONSTRUCTOR_OPTIONS = [
- 'SignatureAllowedLintErrors',
- 'VirtualRestConfig',
+ MainConfigNames::SignatureAllowedLintErrors,
+ MainConfigNames::VirtualRestConfig,
];
/** @var UserIdentity */
@@ -118,7 +119,8 @@ class SignatureValidator {
$lintErrors = $this->checkLintErrors( $signature );
if ( $lintErrors ) {
- $allowedLintErrors = $this->serviceOptions->get( 'SignatureAllowedLintErrors' );
+ $allowedLintErrors = $this->serviceOptions->get(
+ MainConfigNames::SignatureAllowedLintErrors );
$messages = '';
foreach ( $lintErrors as $error ) {
@@ -248,7 +250,7 @@ class SignatureValidator {
// This request is not cached, but that's okay, because $signature is short (other code checks
// the length against $wgMaxSigChars).
- $vrsConfig = $this->serviceOptions->get( 'VirtualRestConfig' );
+ $vrsConfig = $this->serviceOptions->get( MainConfigNames::VirtualRestConfig );
if ( isset( $vrsConfig['modules']['parsoid'] ) ) {
$params = $vrsConfig['modules']['parsoid'];
if ( isset( $vrsConfig['global'] ) ) {
diff --git a/includes/site/Site.php b/includes/site/Site.php
index 77259f6d4690..5c640613fc69 100644
--- a/includes/site/Site.php
+++ b/includes/site/Site.php
@@ -1,5 +1,6 @@
<?php
+use MediaWiki\MainConfigNames;
use MediaWiki\MediaWikiServices;
use MediaWiki\Site\MediaWikiPageNameNormalizer;
@@ -654,7 +655,8 @@ class Site implements Serializable {
* @return Site
*/
public static function newForType( $siteType ) {
- $siteTypes = MediaWikiServices::getInstance()->getMainConfig()->get( 'SiteTypes' );
+ $siteTypes = MediaWikiServices::getInstance()->getMainConfig()->get(
+ MainConfigNames::SiteTypes );
if ( array_key_exists( $siteType, $siteTypes ) ) {
return new $siteTypes[$siteType]();
diff --git a/includes/skins/BaseTemplate.php b/includes/skins/BaseTemplate.php
index 898b026a47f4..7478a3c4b29e 100644
--- a/includes/skins/BaseTemplate.php
+++ b/includes/skins/BaseTemplate.php
@@ -18,6 +18,7 @@
* @file
*/
+use MediaWiki\MainConfigNames;
use Wikimedia\WrappedString;
use Wikimedia\WrappedStringList;
@@ -40,18 +41,18 @@ abstract class BaseTemplate extends QuickTemplate {
*/
public static function getCopyrightIconHTML( Config $config, Skin $skin ): string {
$out = '';
- $footerIcons = $config->get( 'FooterIcons' );
+ $footerIcons = $config->get( MainConfigNames::FooterIcons );
$copyright = $footerIcons['copyright']['copyright'] ?? null;
// T291325: $wgFooterIcons['copyright']['copyright'] can return an array.
if ( $copyright !== null ) {
$out = $skin->makeFooterIcon( $copyright );
- } elseif ( $config->get( 'RightsIcon' ) ) {
- $icon = htmlspecialchars( $config->get( 'RightsIcon' ), ENT_COMPAT );
- $url = $config->get( 'RightsUrl' );
+ } elseif ( $config->get( MainConfigNames::RightsIcon ) ) {
+ $icon = htmlspecialchars( $config->get( MainConfigNames::RightsIcon ), ENT_COMPAT );
+ $url = $config->get( MainConfigNames::RightsUrl );
if ( $url ) {
$out .= '<a href="' . htmlspecialchars( $url, ENT_COMPAT ) . '">';
}
- $text = htmlspecialchars( $config->get( 'RightsText' ), ENT_COMPAT );
+ $text = htmlspecialchars( $config->get( MainConfigNames::RightsText ), ENT_COMPAT );
$out .= "<img src=\"$icon\" alt=\"$text\" width=\"88\" height=\"31\" />";
if ( $url ) {
$out .= '</a>';
@@ -66,7 +67,7 @@ abstract class BaseTemplate extends QuickTemplate {
* @return string of HTML
*/
public static function getPoweredByHTML( Config $config ): string {
- $resourceBasePath = $config->get( 'ResourceBasePath' );
+ $resourceBasePath = $config->get( MainConfigNames::ResourceBasePath );
$url1 = htmlspecialchars(
"$resourceBasePath/resources/assets/poweredby_mediawiki_88x31.png"
);
diff --git a/includes/skins/Skin.php b/includes/skins/Skin.php
index bbfede2ae7ac..fd470a0e2b09 100644
--- a/includes/skins/Skin.php
+++ b/includes/skins/Skin.php
@@ -21,6 +21,7 @@
*/
use MediaWiki\HookContainer\ProtectedHookAccessorTrait;
+use MediaWiki\MainConfigNames;
use MediaWiki\MediaWikiServices;
use MediaWiki\Revision\RevisionLookup;
use MediaWiki\Revision\RevisionStore;
@@ -297,7 +298,7 @@ abstract class Skin extends ContextSource {
* @param OutputPage $out
*/
public function initPage( OutputPage $out ) {
- $skinMetaTags = $this->getConfig()->get( 'SkinMetaTags' );
+ $skinMetaTags = $this->getConfig()->get( MainConfigNames::SkinMetaTags );
$this->preloadExistence();
if ( $this->isResponsive() ) {
@@ -437,7 +438,7 @@ abstract class Skin extends ContextSource {
}
// Footer links (used by SkinTemplate::prepareQuickTemplate)
- if ( $this->getConfig()->get( 'FooterLinkCacheExpiry' ) <= 0 ) {
+ if ( $this->getConfig()->get( MainConfigNames::FooterLinkCacheExpiry ) <= 0 ) {
$titles = array_merge(
$titles,
array_filter( [
@@ -886,15 +887,16 @@ abstract class Skin extends ContextSource {
$config = $this->getConfig();
- if ( $config->get( 'RightsPage' ) ) {
- $title = Title::newFromText( $config->get( 'RightsPage' ) );
- $link = $linkRenderer->makeKnownLink(
- $title, new HtmlArmor( $config->get( 'RightsText' ) ?: $title->getText() )
+ if ( $config->get( MainConfigNames::RightsPage ) ) {
+ $title = Title::newFromText( $config->get( MainConfigNames::RightsPage ) );
+ $link = $linkRenderer->makeKnownLink( $title,
+ new HtmlArmor( $config->get( MainConfigNames::RightsText ) ?: $title->getText() )
);
- } elseif ( $config->get( 'RightsUrl' ) ) {
- $link = Linker::makeExternalLink( $config->get( 'RightsUrl' ), $config->get( 'RightsText' ) );
- } elseif ( $config->get( 'RightsText' ) ) {
- $link = $config->get( 'RightsText' );
+ } elseif ( $config->get( MainConfigNames::RightsUrl ) ) {
+ $link = Linker::makeExternalLink( $config->get( MainConfigNames::RightsUrl ),
+ $config->get( MainConfigNames::RightsText ) );
+ } elseif ( $config->get( MainConfigNames::RightsText ) ) {
+ $link = $config->get( MainConfigNames::RightsText );
} else {
# Give up now
return '';
@@ -982,8 +984,10 @@ abstract class Skin extends ContextSource {
$html = htmlspecialchars( $icon['alt'] ?? '' );
}
if ( $url ) {
- $html = Html::rawElement( 'a',
- [ 'href' => $url, 'target' => $this->getConfig()->get( 'ExternalLinkTarget' ) ],
+ $html = Html::rawElement( 'a', [
+ 'href' => $url,
+ 'target' => $this->getConfig()->get( MainConfigNames::ExternalLinkTarget ),
+ ],
$html );
}
}
@@ -1058,10 +1062,10 @@ abstract class Skin extends ContextSource {
$wanCache = $services->getMainWANObjectCache();
$config = $this->getConfig();
- return ( $config->get( 'FooterLinkCacheExpiry' ) > 0 )
+ return ( $config->get( MainConfigNames::FooterLinkCacheExpiry ) > 0 )
? $wanCache->getWithSetCallback(
$wanCache->makeKey( 'footer-links' ),
- $config->get( 'FooterLinkCacheExpiry' ),
+ $config->get( MainConfigNames::FooterLinkCacheExpiry ),
$callback,
[
'checkKeys' => [
@@ -1205,7 +1209,7 @@ abstract class Skin extends ContextSource {
* @since 1.35
*/
public function mapInterwikiToLanguage( $code ) {
- $map = $this->getConfig()->get( 'InterlanguageLinkCodeMap' );
+ $map = $this->getConfig()->get( MainConfigNames::InterlanguageLinkCodeMap );
return $map[ $code ] ?? $code;
}
@@ -1218,7 +1222,7 @@ abstract class Skin extends ContextSource {
* @return array
*/
public function getLanguages() {
- if ( $this->getConfig()->get( 'HideInterlanguageLinks' ) ) {
+ if ( $this->getConfig()->get( MainConfigNames::HideInterlanguageLinks ) ) {
return [];
}
if ( $this->languageLinks === null ) {
@@ -1320,7 +1324,7 @@ abstract class Skin extends ContextSource {
$out = $this->getOutput();
$title = $this->getTitle();
$thispage = $title->getPrefixedDBkey();
- $uploadNavigationUrl = $this->getConfig()->get( 'UploadNavigationUrl' );
+ $uploadNavigationUrl = $this->getConfig()->get( MainConfigNames::UploadNavigationUrl );
$nav_urls = [];
$nav_urls['mainpage'] = [ 'href' => self::makeMainPageUrl() ];
@@ -1413,7 +1417,8 @@ abstract class Skin extends ContextSource {
}
if ( $user->isRegistered() ) {
- if ( $this->getUser()->isRegistered() && $this->getConfig()->get( 'EnableSpecialMute' ) ) {
+ if ( $this->getUser()->isRegistered() &&
+ $this->getConfig()->get( MainConfigNames::EnableSpecialMute ) ) {
$nav_urls['mute'] = [
'text' => $this->msg( 'mute-preferences' )->text(),
'href' => self::makeSpecialUrlSubpage( 'Mute', $rootUser )
@@ -1423,7 +1428,8 @@ abstract class Skin extends ContextSource {
$sur = new UserrightsPage;
$sur->setContext( $this->getContext() );
$canChange = $sur->userCanChangeRights( $user );
- $delimiter = $this->getConfig()->get( 'UserrightsInterwikiDelimiter' );
+ $delimiter = $this->getConfig()->get(
+ MainConfigNames::UserrightsInterwikiDelimiter );
if ( str_contains( $rootUser, $delimiter ) ) {
// Username contains interwiki delimiter, link it via the
// #{userid} syntax. (T260222)
@@ -1509,10 +1515,10 @@ abstract class Skin extends ContextSource {
$config = $this->getConfig();
$languageCode = $this->getLanguage()->getCode();
- $sidebar = $config->get( 'EnableSidebarCache' )
+ $sidebar = $config->get( MainConfigNames::EnableSidebarCache )
? $wanCache->getWithSetCallback(
$wanCache->makeKey( 'sidebar', $languageCode ),
- $config->get( 'SidebarCacheExpiry' ),
+ $config->get( MainConfigNames::SidebarCacheExpiry ),
$callback,
[
'checkKeys' => [
@@ -1563,7 +1569,7 @@ abstract class Skin extends ContextSource {
$heading = '';
$config = $this->getConfig();
- $messageTitle = $config->get( 'EnableSidebarCache' )
+ $messageTitle = $config->get( MainConfigNames::EnableSidebarCache )
? Title::newMainPage() : $this->getTitle();
$messageCache = MediaWikiServices::getInstance()->getMessageCache();
@@ -1612,14 +1618,16 @@ abstract class Skin extends ContextSource {
$href = $link;
// Parser::getExternalLinkAttribs won't work here because of the Namespace things
- if ( $config->get( 'NoFollowLinks' ) &&
- !wfMatchesDomainList( $href, $config->get( 'NoFollowDomainExceptions' ) )
+ if ( $config->get( MainConfigNames::NoFollowLinks ) &&
+ !wfMatchesDomainList( $href,
+ $config->get( MainConfigNames::NoFollowDomainExceptions ) )
) {
$extraAttribs['rel'] = 'nofollow';
}
- if ( $config->get( 'ExternalLinkTarget' ) ) {
- $extraAttribs['target'] = $config->get( 'ExternalLinkTarget' );
+ if ( $config->get( MainConfigNames::ExternalLinkTarget ) ) {
+ $extraAttribs['target'] =
+ $config->get( MainConfigNames::ExternalLinkTarget );
}
} else {
$title = Title::newFromText( $link );
@@ -1777,7 +1785,7 @@ abstract class Skin extends ContextSource {
if ( $name === 'default' ) {
// special case
- $notice = $config->get( 'SiteNotice' );
+ $notice = $config->get( MainConfigNames::SiteNotice );
if ( empty( $notice ) ) {
return false;
}
@@ -1796,7 +1804,8 @@ abstract class Skin extends ContextSource {
$parsed = $cache->getWithSetCallback(
// Use the extra hash appender to let eg SSL variants separately cache
// Key is verified with md5 hash of unparsed wikitext
- $cache->makeKey( $name, $config->get( 'RenderHashAppend' ), md5( $notice ) ),
+ $cache->makeKey(
+ $name, $config->get( MainConfigNames::RenderHashAppend ), md5( $notice ) ),
// TTL in seconds
600,
function () use ( $notice ) {
@@ -2411,8 +2420,8 @@ abstract class Skin extends ContextSource {
$title = $out->getTitle();
$titleExists = $title->exists();
$config = $this->getConfig();
- $maxCredits = $config->get( 'MaxCredits' );
- $showCreditsIfMax = $config->get( 'ShowCreditsIfMax' );
+ $maxCredits = $config->get( MainConfigNames::MaxCredits );
+ $showCreditsIfMax = $config->get( MainConfigNames::ShowCreditsIfMax );
$useCredits = $titleExists
&& $out->isArticle()
&& $out->isRevisionCurrent()
diff --git a/includes/skins/SkinFallback.php b/includes/skins/SkinFallback.php
index a7c10708e9fe..ec9d0d16d986 100644
--- a/includes/skins/SkinFallback.php
+++ b/includes/skins/SkinFallback.php
@@ -5,6 +5,7 @@
* @since 1.24
* @file
*/
+use MediaWiki\MainConfigNames;
use MediaWiki\MediaWikiServices;
/**
@@ -26,7 +27,7 @@ class SkinFallback extends SkinMustache {
*/
private function findInstalledSkins() {
$config = $this->getConfig();
- $styleDirectory = $config->get( 'StyleDirectory' );
+ $styleDirectory = $config->get( MainConfigNames::StyleDirectory );
// Get all subdirectories which might contains skins
$possibleSkins = scandir( $styleDirectory );
$possibleSkins = array_filter( $possibleSkins, static function ( $maybeDir ) use ( $styleDirectory ) {
@@ -49,7 +50,7 @@ class SkinFallback extends SkinMustache {
*/
private function buildHelpfulInformationMessage() {
$config = $this->getConfig();
- $defaultSkin = $config->get( 'DefaultSkin' );
+ $defaultSkin = $config->get( MainConfigNames::DefaultSkin );
$installedSkins = $this->findInstalledSkins();
$skinFactory = MediaWikiServices::getInstance()->getSkinFactory();
$enabledSkins = $skinFactory->getInstalledSkins();
@@ -116,7 +117,9 @@ class SkinFallback extends SkinMustache {
$data = parent::getTemplateData();
// If the default skin isn't configured correctly, append a warning to the
// subtitle to alert a sysadmin.
- if ( !isset( $skinFactory->getInstalledSkins()[$config->get( 'DefaultSkin' )] ) ) {
+ if ( !isset(
+ $skinFactory->getInstalledSkins()[$config->get( MainConfigNames::DefaultSkin )]
+ ) ) {
$data['html-fallback-warning'] = Html::warningBox( $this->buildHelpfulInformationMessage() );
}
return $data;
diff --git a/includes/skins/components/SkinComponentSearch.php b/includes/skins/components/SkinComponentSearch.php
index f8bb23c24bba..88632854e538 100644
--- a/includes/skins/components/SkinComponentSearch.php
+++ b/includes/skins/components/SkinComponentSearch.php
@@ -5,6 +5,7 @@ namespace MediaWiki\Skin;
use Config;
use Html;
use Linker;
+use MediaWiki\MainConfigNames;
use Message;
use MessageLocalizer;
use MWException;
@@ -154,7 +155,7 @@ class SkinComponentSearch implements SkinComponent {
* @return array attributes of HTML input
*/
private function getSearchInputAttributes( array $attrs = [] ) {
- $autoCapHint = $this->getConfig()->get( 'CapitalLinks' );
+ $autoCapHint = $this->getConfig()->get( MainConfigNames::CapitalLinks );
$realAttrs = [
'type' => 'search',
'name' => 'search',
@@ -245,7 +246,7 @@ class SkinComponentSearch implements SkinComponent {
$this->cachedData = [
'search-special-page-title' => $searchTitle->getText(),
- 'form-action' => $config->get( 'Script' ),
+ 'form-action' => $config->get( MainConfigNames::Script ),
'html-button-search-fallback' => $this->makeSearchButton(
'fulltext',
$fallbackButtonAttributes + [
diff --git a/includes/specialpage/SpecialPageFactory.php b/includes/specialpage/SpecialPageFactory.php
index 2a35ac56b06d..b41f19a81199 100644
--- a/includes/specialpage/SpecialPageFactory.php
+++ b/includes/specialpage/SpecialPageFactory.php
@@ -1011,13 +1011,13 @@ class SpecialPageFactory {
* @internal For use by ServiceWiring
*/
public const CONSTRUCTOR_OPTIONS = [
- 'DisableInternalSearch',
- 'EmailAuthentication',
- 'EnableEmail',
- 'EnableJavaScriptTest',
- 'EnableSpecialMute',
- 'PageLanguageUseDB',
- 'SpecialPages',
+ MainConfigNames::DisableInternalSearch,
+ MainConfigNames::EmailAuthentication,
+ MainConfigNames::EnableEmail,
+ MainConfigNames::EnableJavaScriptTest,
+ MainConfigNames::EnableSpecialMute,
+ MainConfigNames::PageLanguageUseDB,
+ MainConfigNames::SpecialPages,
];
/**
@@ -1067,7 +1067,7 @@ class SpecialPageFactory {
if ( !is_array( $this->list ) ) {
$this->list = self::CORE_LIST;
- if ( !$this->options->get( 'DisableInternalSearch' ) ) {
+ if ( !$this->options->get( MainConfigNames::DisableInternalSearch ) ) {
$this->list['Search'] = [
'class' => \SpecialSearch::class,
'services' => [
@@ -1083,7 +1083,7 @@ class SpecialPageFactory {
];
}
- if ( $this->options->get( 'EmailAuthentication' ) ) {
+ if ( $this->options->get( MainConfigNames::EmailAuthentication ) ) {
$this->list['Confirmemail'] = [
'class' => \SpecialConfirmEmail::class,
'services' => [
@@ -1098,7 +1098,7 @@ class SpecialPageFactory {
];
}
- if ( $this->options->get( 'EnableEmail' ) ) {
+ if ( $this->options->get( MainConfigNames::EnableEmail ) ) {
$this->list['ChangeEmail'] = [
'class' => \SpecialChangeEmail::class,
'services' => [
@@ -1107,13 +1107,13 @@ class SpecialPageFactory {
];
}
- if ( $this->options->get( 'EnableJavaScriptTest' ) ) {
+ if ( $this->options->get( MainConfigNames::EnableJavaScriptTest ) ) {
$this->list['JavaScriptTest'] = [
'class' => \SpecialJavaScriptTest::class
];
}
- if ( $this->options->get( 'EnableSpecialMute' ) ) {
+ if ( $this->options->get( MainConfigNames::EnableSpecialMute ) ) {
$this->list['Mute'] = [
'class' => \SpecialMute::class,
'services' => [
@@ -1124,7 +1124,7 @@ class SpecialPageFactory {
];
}
- if ( $this->options->get( 'PageLanguageUseDB' ) ) {
+ if ( $this->options->get( MainConfigNames::PageLanguageUseDB ) ) {
$this->list['PageLanguage'] = [
'class' => \SpecialPageLanguage::class,
'services' => [
@@ -1137,7 +1137,8 @@ class SpecialPageFactory {
}
// Add extension special pages
- $this->list = array_merge( $this->list, $this->options->get( 'SpecialPages' ) );
+ $this->list = array_merge( $this->list,
+ $this->options->get( MainConfigNames::SpecialPages ) );
// This hook can be used to disable unwanted core special pages
// or conditionally register special pages.
diff --git a/includes/title/NamespaceInfo.php b/includes/title/NamespaceInfo.php
index a6940671d4ed..5c0160721a06 100644
--- a/includes/title/NamespaceInfo.php
+++ b/includes/title/NamespaceInfo.php
@@ -381,11 +381,11 @@ class NamespaceInfo {
public function getCanonicalNamespaces() {
if ( $this->canonicalNamespaces === null ) {
$this->canonicalNamespaces =
- [ NS_MAIN => '' ] + $this->options->get( 'CanonicalNamespaceNames' );
+ [ NS_MAIN => '' ] + $this->options->get( MainConfigNames::CanonicalNamespaceNames );
$this->canonicalNamespaces +=
ExtensionRegistry::getInstance()->getAttribute( 'ExtensionNamespaces' );
- if ( is_array( $this->options->get( 'ExtraNamespaces' ) ) ) {
- $this->canonicalNamespaces += $this->options->get( 'ExtraNamespaces' );
+ if ( is_array( $this->options->get( MainConfigNames::ExtraNamespaces ) ) ) {
+ $this->canonicalNamespaces += $this->options->get( MainConfigNames::ExtraNamespaces );
}
$this->hookRunner->onCanonicalNamespaces( $this->canonicalNamespaces );
}
@@ -462,7 +462,8 @@ class NamespaceInfo {
* @return bool
*/
public function isContent( $index ) {
- return $index == NS_MAIN || in_array( $index, $this->options->get( 'ContentNamespaces' ) );
+ return $index == NS_MAIN ||
+ in_array( $index, $this->options->get( MainConfigNames::ContentNamespaces ) );
}
/**
@@ -474,7 +475,7 @@ class NamespaceInfo {
*/
public function wantSignatures( $index ) {
return $this->isTalk( $index ) ||
- in_array( $index, $this->options->get( 'ExtraSignatureNamespaces' ) );
+ in_array( $index, $this->options->get( MainConfigNames::ExtraSignatureNamespaces ) );
}
/**
@@ -495,7 +496,7 @@ class NamespaceInfo {
* @return bool
*/
public function hasSubpages( $index ) {
- return !empty( $this->options->get( 'NamespacesWithSubpages' )[$index] );
+ return !empty( $this->options->get( MainConfigNames::NamespacesWithSubpages )[$index] );
}
/**
@@ -503,7 +504,7 @@ class NamespaceInfo {
* @return int[] Array of namespace indices
*/
public function getContentNamespaces() {
- $contentNamespaces = $this->options->get( 'ContentNamespaces' );
+ $contentNamespaces = $this->options->get( MainConfigNames::ContentNamespaces );
if ( !is_array( $contentNamespaces ) || $contentNamespaces === [] ) {
return [ NS_MAIN ];
} elseif ( !in_array( NS_MAIN, $contentNamespaces ) ) {
@@ -557,13 +558,13 @@ class NamespaceInfo {
if ( in_array( $index, $this->alwaysCapitalizedNamespaces ) ) {
return true;
}
- $overrides = $this->options->get( 'CapitalLinkOverrides' );
+ $overrides = $this->options->get( MainConfigNames::CapitalLinkOverrides );
if ( isset( $overrides[$index] ) ) {
// CapitalLinkOverrides is explicitly set
return $overrides[$index];
}
// Default to the global setting
- return $this->options->get( 'CapitalLinks' );
+ return $this->options->get( MainConfigNames::CapitalLinks );
}
/**
@@ -584,7 +585,7 @@ class NamespaceInfo {
* @return bool
*/
public function isNonincludable( $index ) {
- $namespaces = $this->options->get( 'NonincludableNamespaces' );
+ $namespaces = $this->options->get( MainConfigNames::NonincludableNamespaces );
return $namespaces && in_array( $index, $namespaces );
}
@@ -599,7 +600,7 @@ class NamespaceInfo {
* @return null|string Default model name for the given namespace, if set
*/
public function getNamespaceContentModel( $index ) {
- return $this->options->get( 'NamespaceContentModels' )[$index] ?? null;
+ return $this->options->get( MainConfigNames::NamespaceContentModels )[$index] ?? null;
}
/**