From 69ef3c1bcb8f82f11efdfe49191c55d286635424 Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Sat, 19 Dec 2020 12:16:51 +0100 Subject: [PATCH] Avoid wfMessage in special page Use self::msg instead to avoid global state Change-Id: I78f914facee4174e76bbc77716b99d4aebd26c67 --- .phpcs.xml | 1 - src/Special/OATHManage.php | 26 +++++++++++++------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/.phpcs.xml b/.phpcs.xml index 0c16065f..b8f3b00e 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -3,7 +3,6 @@ - . diff --git a/src/Special/OATHManage.php b/src/Special/OATHManage.php index 7779a914..bb8cf301 100644 --- a/src/Special/OATHManage.php +++ b/src/Special/OATHManage.php @@ -153,17 +153,17 @@ class OATHManage extends SpecialPage { } private function addEnabledHTML() { - $this->addHeading( wfMessage( 'oathauth-ui-enabled-module' ) ); + $this->addHeading( $this->msg( 'oathauth-ui-enabled-module' ) ); $this->addModuleHTML( $this->getEnabled() ); } private function addAlternativesHTML() { - $this->addHeading( wfMessage( 'oathauth-ui-not-enabled-modules' ) ); + $this->addHeading( $this->msg( 'oathauth-ui-not-enabled-modules' ) ); $this->addInactiveHTML(); } private function nothingEnabled() { - $this->addHeading( wfMessage( 'oathauth-ui-available-modules' ) ); + $this->addHeading( $this->msg( 'oathauth-ui-available-modules' ) ); $this->addInactiveHTML(); } @@ -177,7 +177,7 @@ class OATHManage extends SpecialPage { } private function addGeneralHelp() { - $this->getOutput()->addHTML( wfMessage( + $this->getOutput()->addHTML( $this->msg( 'oathauth-ui-general-help' )->parseAsBlock() ); } @@ -215,8 +215,8 @@ class OATHManage extends SpecialPage { if ( $this->shouldShowGenericButtons() ) { $button = new ButtonWidget( [ 'label' => $this->isModuleEnabled( $module ) ? - wfMessage( 'oathauth-disable-generic' )->text() : - wfMessage( 'oathauth-enable-generic' )->text(), + $this->msg( 'oathauth-disable-generic' )->text() : + $this->msg( 'oathauth-enable-generic' )->text(), 'href' => $this->getOutput()->getTitle()->getLocalURL( [ 'action' => $this->isModuleEnabled( $module ) ? static::ACTION_DISABLE : static::ACTION_ENABLE, @@ -321,8 +321,8 @@ class OATHManage extends SpecialPage { if ( $this->isGenericAction() ) { $displayName = $this->requestedModule->getDisplayName(); $pageTitle = $this->isModuleEnabled( $this->requestedModule ) ? - wfMessage( 'oathauth-disable-page-title', $displayName )->text() : - wfMessage( 'oathauth-enable-page-title', $displayName )->text(); + $this->msg( 'oathauth-disable-page-title', $displayName )->text() : + $this->msg( 'oathauth-enable-page-title', $displayName )->text(); $this->getOutput()->setPageTitle( $pageTitle ); } @@ -361,15 +361,15 @@ class OATHManage extends SpecialPage { 'expanded' => false ] ); $headerMessage = $this->isSwitch() ? - wfMessage( 'oathauth-switch-method-warning-header' ) : - wfMessage( 'oathauth-disable-method-warning-header' ); + $this->msg( 'oathauth-switch-method-warning-header' ) : + $this->msg( 'oathauth-disable-method-warning-header' ); $genericMessage = $this->isSwitch() ? - wfMessage( + $this->msg( 'oathauth-switch-method-warning', $this->getEnabled()->getDisplayName(), $this->requestedModule->getDisplayName() ) : - wfMessage( 'oathauth-disable-method-warning', $this->getEnabled()->getDisplayName() ); + $this->msg( 'oathauth-disable-method-warning', $this->getEnabled()->getDisplayName() ); $panel->appendContent( new HtmlSnippet( $genericMessage->parseAsBlock() @@ -383,7 +383,7 @@ class OATHManage extends SpecialPage { } $button = new ButtonWidget( [ - 'label' => wfMessage( 'oathauth-disable-method-warning-button-label' )->plain(), + 'label' => $this->msg( 'oathauth-disable-method-warning-button-label' )->plain(), 'href' => $this->getOutput()->getTitle()->getLocalURL( [ 'action' => $this->action, 'module' => $this->requestedModule->getName()