aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>2024-05-19 16:43:58 +0000
committerGerrit Code Review <gerrit@wikimedia.org>2024-05-19 16:43:58 +0000
commitd2706542426f84c50d24d86d86eed4746b55ff2e (patch)
treea2887526e651e5c2d7eaa8904e1c8eb09b5225e8
parent43cfa970e3827e329544c6429ff75f5fed023d57 (diff)
parent4e6158a6fbfe54c927a1180a273e939adcf08d3a (diff)
downloadmediawikicore-d2706542426f84c50d24d86d86eed4746b55ff2e.tar.gz
mediawikicore-d2706542426f84c50d24d86d86eed4746b55ff2e.zip
Merge "Use constants provided by MainConfigNames for config names"
-rw-r--r--includes/api/ApiQuerySiteinfo.php4
-rw-r--r--includes/page/Article.php2
-rw-r--r--includes/search/searchwidgets/FullSearchResultWidget.php5
-rw-r--r--includes/search/searchwidgets/InterwikiSearchResultSetWidget.php3
-rw-r--r--includes/skins/SkinTemplate.php2
-rw-r--r--includes/specials/SpecialBlock.php6
-rw-r--r--includes/specials/SpecialContribute.php3
-rw-r--r--includes/specials/SpecialContributions.php3
-rw-r--r--includes/specials/SpecialRenameUser.php3
-rw-r--r--tests/phpunit/includes/GlobalFunctions/WfThumbIsStandardTest.php2
-rw-r--r--tests/phpunit/includes/Output/OutputPageTest.php2
-rw-r--r--tests/phpunit/includes/preferences/DefaultPreferencesFactoryTest.php4
-rw-r--r--tests/phpunit/includes/session/TestBagOStuff.php3
-rw-r--r--tests/phpunit/includes/user/BotPasswordTest.php2
-rw-r--r--tests/phpunit/includes/utils/MWTimestampTest.php3
-rw-r--r--tests/phpunit/structure/SettingsTest.php2
-rw-r--r--tests/phpunit/tests/MediaWikiIntegrationTestCaseTest.php2
17 files changed, 29 insertions, 22 deletions
diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php
index 167f5d9c5645..591940f49514 100644
--- a/includes/api/ApiQuerySiteinfo.php
+++ b/includes/api/ApiQuerySiteinfo.php
@@ -998,7 +998,7 @@ class ApiQuerySiteinfo extends ApiQueryBase {
'query',
$property,
$this->processAutoPromote(
- $this->getConfig()->get( 'Autopromote' ),
+ $this->getConfig()->get( MainConfigNames::Autopromote ),
$this->getAutoPromoteConds()
)
);
@@ -1007,7 +1007,7 @@ class ApiQuerySiteinfo extends ApiQueryBase {
private function appendAutoPromoteOnce( $property ) {
$allowedConditions = $this->getAutoPromoteConds();
$data = [];
- foreach ( $this->getConfig()->get( 'AutopromoteOnce' ) as $key => $value ) {
+ foreach ( $this->getConfig()->get( MainConfigNames::AutopromoteOnce ) as $key => $value ) {
$data[$key] = $this->processAutoPromote( $value, $allowedConditions );
}
return $this->getResult()->addValue( 'query', $property, $data );
diff --git a/includes/page/Article.php b/includes/page/Article.php
index 513e8133b964..a3e387cab383 100644
--- a/includes/page/Article.php
+++ b/includes/page/Article.php
@@ -599,7 +599,7 @@ class Article implements Page {
$request->response()->clearCookie( $cookieKey );
$outputPage->addJsConfigVars( 'wgPostEdit', $postEdit );
$outputPage->addModules( 'mediawiki.action.view.postEdit' ); // FIXME: test this
- if ( $this->getContext()->getConfig()->get( 'EnableEditRecovery' )
+ if ( $this->getContext()->getConfig()->get( MainConfigNames::EnableEditRecovery )
&& $this->userOptionsLookup->getOption( $this->getContext()->getUser(), 'editrecovery' )
) {
$outputPage->addModules( 'mediawiki.editRecovery.postEdit' );
diff --git a/includes/search/searchwidgets/FullSearchResultWidget.php b/includes/search/searchwidgets/FullSearchResultWidget.php
index 1bdeb4af5457..33a34a0a77de 100644
--- a/includes/search/searchwidgets/FullSearchResultWidget.php
+++ b/includes/search/searchwidgets/FullSearchResultWidget.php
@@ -10,6 +10,7 @@ use MediaWiki\HookContainer\HookContainer;
use MediaWiki\HookContainer\HookRunner;
use MediaWiki\Html\Html;
use MediaWiki\Linker\LinkRenderer;
+use MediaWiki\MainConfigNames;
use MediaWiki\Search\Entity\SearchResultThumbnail;
use MediaWiki\Search\SearchResultThumbnailProvider;
use MediaWiki\Specials\SpecialSearch;
@@ -351,7 +352,7 @@ class FullSearchResultWidget implements SearchResultWidget {
return null;
}
- $namespacesWithThumbnails = $this->specialPage->getConfig()->get( 'ThumbnailNamespaces' );
+ $namespacesWithThumbnails = $this->specialPage->getConfig()->get( MainConfigNames::ThumbnailNamespaces );
$showThumbnail = in_array( $title->getNamespace(), $namespacesWithThumbnails );
if ( !$showThumbnail ) {
return null;
@@ -421,7 +422,7 @@ class FullSearchResultWidget implements SearchResultWidget {
// player must remain at the size we want, regardless of whether or
// not it fits the thumb limits, which in this case are irrelevant)
if ( $rescaledWidth !== $thumbnail->getWidth() ) {
- $thumbLimits = $this->specialPage->getConfig()->get( 'ThumbLimits' );
+ $thumbLimits = $this->specialPage->getConfig()->get( MainConfigNames::ThumbLimits );
$largerThumbLimits = array_filter(
$thumbLimits,
static function ( $limit ) use ( $rescaledWidth ) {
diff --git a/includes/search/searchwidgets/InterwikiSearchResultSetWidget.php b/includes/search/searchwidgets/InterwikiSearchResultSetWidget.php
index 159dc5ff122b..28bda6e60f4b 100644
--- a/includes/search/searchwidgets/InterwikiSearchResultSetWidget.php
+++ b/includes/search/searchwidgets/InterwikiSearchResultSetWidget.php
@@ -6,6 +6,7 @@ use ISearchResultSet;
use MediaWiki\Html\Html;
use MediaWiki\Interwiki\InterwikiLookup;
use MediaWiki\Linker\LinkRenderer;
+use MediaWiki\MainConfigNames;
use MediaWiki\Output\OutputPage;
use MediaWiki\Specials\SpecialSearch;
use MediaWiki\Title\Title;
@@ -47,7 +48,7 @@ class InterwikiSearchResultSetWidget implements SearchResultSetWidget {
$this->iwLookup = $iwLookup;
$this->output = $specialSearch->getOutput();
$this->showMultimedia = $showMultimedia;
- $this->iwLogoOverrides = $this->specialSearch->getConfig()->get( 'InterwikiLogoOverride' );
+ $this->iwLogoOverrides = $this->specialSearch->getConfig()->get( MainConfigNames::InterwikiLogoOverride );
}
/**
diff --git a/includes/skins/SkinTemplate.php b/includes/skins/SkinTemplate.php
index 5e2974930d55..a728fa2f65ed 100644
--- a/includes/skins/SkinTemplate.php
+++ b/includes/skins/SkinTemplate.php
@@ -1640,7 +1640,7 @@ class SkinTemplate extends Skin {
private function isSpecialContributeShowable(): bool {
return ContributeFactory::isEnabledOnCurrentSkin(
$this,
- $this->getConfig()->get( 'SpecialContributeSkinsEnabled' )
+ $this->getConfig()->get( MainConfigNames::SpecialContributeSkinsEnabled )
);
}
diff --git a/includes/specials/SpecialBlock.php b/includes/specials/SpecialBlock.php
index b5c2abbca7a1..731b01bf3d06 100644
--- a/includes/specials/SpecialBlock.php
+++ b/includes/specials/SpecialBlock.php
@@ -146,7 +146,7 @@ class SpecialBlock extends FormSpecialPage {
public function execute( $par ) {
parent::execute( $par );
- if ( $this->getConfig()->get( 'UseCodexSpecialBlock' ) ) {
+ if ( $this->getConfig()->get( MainConfigNames::UseCodexSpecialBlock ) ) {
$this->getOutput()->addModules( 'mediawiki.special.block.codex' );
$this->getOutput()->addJsConfigVars( $this->codexFormData );
}
@@ -235,7 +235,7 @@ class SpecialBlock extends FormSpecialPage {
}
protected function getDisplayFormat() {
- return $this->getConfig()->get( 'UseCodexSpecialBlock' ) ? 'codex' : 'ooui';
+ return $this->getConfig()->get( MainConfigNames::UseCodexSpecialBlock ) ? 'codex' : 'ooui';
}
/**
@@ -275,7 +275,7 @@ class SpecialBlock extends FormSpecialPage {
'section' => 'target',
];
- $editingRestrictionOptions = $this->getConfig()->get( 'UseCodexSpecialBlock' ) ?
+ $editingRestrictionOptions = $this->getConfig()->get( MainConfigNames::UseCodexSpecialBlock ) ?
// If we're using Codex, use the option-descriptions feature, which is only supported by Codex
[
'options-messages' => [
diff --git a/includes/specials/SpecialContribute.php b/includes/specials/SpecialContribute.php
index 7aaf5c794a91..8b7bb80edfbd 100644
--- a/includes/specials/SpecialContribute.php
+++ b/includes/specials/SpecialContribute.php
@@ -3,6 +3,7 @@
namespace MediaWiki\Specials;
use MediaWiki\Html\TemplateParser;
+use MediaWiki\MainConfigNames;
use MediaWiki\SpecialPage\IncludableSpecialPage;
use MediaWiki\Specials\Contribute\ContributeFactory;
@@ -92,7 +93,7 @@ class SpecialContribute extends IncludableSpecialPage {
public function isShowable(): bool {
return ContributeFactory::isEnabledOnCurrentSkin(
$this->getSkin(),
- $this->getConfig()->get( 'SpecialContributeSkinsEnabled' )
+ $this->getConfig()->get( MainConfigNames::SpecialContributeSkinsEnabled )
);
}
}
diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php
index 8542a349bcb5..c1a132af1d5b 100644
--- a/includes/specials/SpecialContributions.php
+++ b/includes/specials/SpecialContributions.php
@@ -23,6 +23,7 @@ namespace MediaWiki\Specials;
use MediaWiki\Block\DatabaseBlockStore;
use MediaWiki\Cache\LinkBatchFactory;
use MediaWiki\CommentFormatter\CommentFormatter;
+use MediaWiki\MainConfigNames;
use MediaWiki\MediaWikiServices;
use MediaWiki\Pager\ContribsPager;
use MediaWiki\Permissions\PermissionManager;
@@ -146,7 +147,7 @@ class SpecialContributions extends ContributionsSpecialPage {
if (
ContributeFactory::isEnabledOnCurrentSkin(
$this->getSkin(),
- $this->getConfig()->get( 'SpecialContributeSkinsEnabled' )
+ $this->getConfig()->get( MainConfigNames::SpecialContributeSkinsEnabled )
)
) {
return ContributeFactory::getAssociatedNavigationLinks(
diff --git a/includes/specials/SpecialRenameUser.php b/includes/specials/SpecialRenameUser.php
index 7bdbd35ff01c..8c599561e7ad 100644
--- a/includes/specials/SpecialRenameUser.php
+++ b/includes/specials/SpecialRenameUser.php
@@ -6,6 +6,7 @@ use Language;
use MediaWiki\CommentStore\CommentStore;
use MediaWiki\Html\Html;
use MediaWiki\HTMLForm\HTMLForm;
+use MediaWiki\MainConfigNames;
use MediaWiki\Page\MovePageFactory;
use MediaWiki\Permissions\PermissionManager;
use MediaWiki\RenameUser\RenameuserSQL;
@@ -201,7 +202,7 @@ class SpecialRenameUser extends SpecialPage {
->caller( __METHOD__ )
->fetchField();
if ( $uid === false ) {
- if ( !$this->getConfig()->get( 'CapitalLinks' ) ) {
+ if ( !$this->getConfig()->get( MainConfigNames::CapitalLinks ) ) {
$uid = 0; // We are on a lowercase wiki but lowercase username does not exist
} else {
// We are on a standard uppercase wiki, use normal
diff --git a/tests/phpunit/includes/GlobalFunctions/WfThumbIsStandardTest.php b/tests/phpunit/includes/GlobalFunctions/WfThumbIsStandardTest.php
index 905c190f9a5b..60a293634aff 100644
--- a/tests/phpunit/includes/GlobalFunctions/WfThumbIsStandardTest.php
+++ b/tests/phpunit/includes/GlobalFunctions/WfThumbIsStandardTest.php
@@ -95,7 +95,7 @@ class WfThumbIsStandardTest extends MediaWikiIntegrationTestCase {
* @dataProvider provideThumbParams
*/
public function testIsStandard( $message, $expected, $params ) {
- $handlers = $this->getServiceContainer()->getMainConfig()->get( 'ParserTestMediaHandlers' );
+ $handlers = $this->getServiceContainer()->getMainConfig()->get( MainConfigNames::ParserTestMediaHandlers );
$this->setService(
'MediaHandlerFactory',
new MediaHandlerFactory( new NullLogger(), $handlers )
diff --git a/tests/phpunit/includes/Output/OutputPageTest.php b/tests/phpunit/includes/Output/OutputPageTest.php
index d6cc8da7a8bf..67c86033d815 100644
--- a/tests/phpunit/includes/Output/OutputPageTest.php
+++ b/tests/phpunit/includes/Output/OutputPageTest.php
@@ -1119,7 +1119,7 @@ class OutputPageTest extends MediaWikiIntegrationTestCase {
$this->assertFalse( $op->isSyndicated() );
$this->assertSame( [], $op->getSyndicationLinks() );
- $feedTypes = $op->getConfig()->get( 'AdvertisedFeedTypes' );
+ $feedTypes = $op->getConfig()->get( MainConfigNames::AdvertisedFeedTypes );
$op->addFeedLink( $feedTypes[0], 'def' );
$this->assertTrue( $op->isSyndicated() );
diff --git a/tests/phpunit/includes/preferences/DefaultPreferencesFactoryTest.php b/tests/phpunit/includes/preferences/DefaultPreferencesFactoryTest.php
index 898044f0f387..91f0c43bf11a 100644
--- a/tests/phpunit/includes/preferences/DefaultPreferencesFactoryTest.php
+++ b/tests/phpunit/includes/preferences/DefaultPreferencesFactoryTest.php
@@ -469,9 +469,9 @@ class DefaultPreferencesFactoryTest extends \MediaWikiIntegrationTestCase {
*/
private function createUserOptionsManagerMock( array $userOptions, bool $defaultOptions = false ) {
$services = $this->getServiceContainer();
- $defaults = $services->getMainConfig()->get( 'DefaultUserOptions' );
+ $defaults = $services->getMainConfig()->get( MainConfigNames::DefaultUserOptions );
$defaults['language'] = $services->getContentLanguage()->getCode();
- $defaults['skin'] = Skin::normalizeKey( $services->getMainConfig()->get( 'DefaultSkin' ) );
+ $defaults['skin'] = Skin::normalizeKey( $services->getMainConfig()->get( MainConfigNames::DefaultSkin ) );
( new HookRunner( $services->getHookContainer() ) )->onUserGetDefaultOptions( $defaults );
$userOptions += $defaults;
diff --git a/tests/phpunit/includes/session/TestBagOStuff.php b/tests/phpunit/includes/session/TestBagOStuff.php
index 2a80a9904fd5..50ac52bc810b 100644
--- a/tests/phpunit/includes/session/TestBagOStuff.php
+++ b/tests/phpunit/includes/session/TestBagOStuff.php
@@ -4,6 +4,7 @@ namespace MediaWiki\Tests\Session;
use CachedBagOStuff;
use HashBagOStuff;
+use MediaWiki\MainConfigNames;
use MediaWiki\MediaWikiServices;
/**
@@ -55,7 +56,7 @@ class TestBagOStuff extends CachedBagOStuff {
* @param array|mixed $blob Session metadata and data
*/
public function setRawSession( $id, $blob ) {
- $expiry = MediaWikiServices::getInstance()->getMainConfig()->get( 'ObjectCacheSessionExpiry' );
+ $expiry = MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::ObjectCacheSessionExpiry );
$this->set( $this->makeKey( 'MWSession', $id ), $blob, $expiry );
}
diff --git a/tests/phpunit/includes/user/BotPasswordTest.php b/tests/phpunit/includes/user/BotPasswordTest.php
index 3ac9fbad9601..d624c2723d16 100644
--- a/tests/phpunit/includes/user/BotPasswordTest.php
+++ b/tests/phpunit/includes/user/BotPasswordTest.php
@@ -278,7 +278,7 @@ class BotPasswordTest extends MediaWikiIntegrationTestCase {
// Now configure BotPasswordSessionProvider for further tests...
$mainConfig = $this->getServiceContainer()->getMainConfig();
$config = new HashConfig( [
- MainConfigNames::SessionProviders => $mainConfig->get( 'SessionProviders' ) + [
+ MainConfigNames::SessionProviders => $mainConfig->get( MainConfigNames::SessionProviders ) + [
MediaWiki\Session\BotPasswordSessionProvider::class => [
'class' => MediaWiki\Session\BotPasswordSessionProvider::class,
'args' => [ [ 'priority' => 40 ] ],
diff --git a/tests/phpunit/includes/utils/MWTimestampTest.php b/tests/phpunit/includes/utils/MWTimestampTest.php
index f789314f5cb9..aec0b1c9143e 100644
--- a/tests/phpunit/includes/utils/MWTimestampTest.php
+++ b/tests/phpunit/includes/utils/MWTimestampTest.php
@@ -1,5 +1,6 @@
<?php
+use MediaWiki\MainConfigNames;
use MediaWiki\User\Options\StaticUserOptionsLookup;
use MediaWiki\User\UserIdentityValue;
use MediaWiki\Utils\MWTimestamp;
@@ -10,7 +11,7 @@ use MediaWiki\Utils\MWTimestamp;
class MWTimestampTest extends MediaWikiLangTestCase {
private function setMockUserOptions( array $options ) {
- $defaults = $this->getServiceContainer()->getMainConfig()->get( 'DefaultUserOptions' );
+ $defaults = $this->getServiceContainer()->getMainConfig()->get( MainConfigNames::DefaultUserOptions );
// $options are set as the options for "Pamela", the name used in the tests
$userOptionsLookup = new StaticUserOptionsLookup(
diff --git a/tests/phpunit/structure/SettingsTest.php b/tests/phpunit/structure/SettingsTest.php
index 3b457e346a72..2eb8d3c8f066 100644
--- a/tests/phpunit/structure/SettingsTest.php
+++ b/tests/phpunit/structure/SettingsTest.php
@@ -598,7 +598,7 @@ class SettingsTest extends MediaWikiIntegrationTestCase {
*/
public function testSetLocaltimezone(): void {
// Make sure the configured timezone ewas applied to the PHP runtime.
- $tz = $this->getServiceContainer()->getMainConfig()->get( 'Localtimezone' );
+ $tz = $this->getServiceContainer()->getMainConfig()->get( MainConfigNames::Localtimezone );
$this->assertSame( $tz, date_default_timezone_get() );
}
}
diff --git a/tests/phpunit/tests/MediaWikiIntegrationTestCaseTest.php b/tests/phpunit/tests/MediaWikiIntegrationTestCaseTest.php
index d36e5a4afee7..fb69b5092092 100644
--- a/tests/phpunit/tests/MediaWikiIntegrationTestCaseTest.php
+++ b/tests/phpunit/tests/MediaWikiIntegrationTestCaseTest.php
@@ -128,7 +128,7 @@ class MediaWikiIntegrationTestCaseTest extends MediaWikiIntegrationTestCase {
public function testOverrideConfigValues__before() {
$nsInfo1 = $this->getServiceContainer()->getNamespaceInfo();
- $oldSitename = $this->getServiceContainer()->getMainConfig()->get( 'Sitename' );
+ $oldSitename = $this->getServiceContainer()->getMainConfig()->get( MainConfigNames::Sitename );
$this->overrideConfigValue( MainConfigNames::Sitename, 'TestingSitenameOverride' );
$nsInfo2 = $this->getServiceContainer()->getNamespaceInfo();