Replace $wgOut with RequestContext::getMain()

Bug: T252978
Change-Id: I5e677fde89accfa6363824ef4cbd8808097e00f3
This commit is contained in:
Umherirrender 2023-05-15 22:32:44 +02:00
parent 52af58f4b8
commit c9511bb825
3 changed files with 15 additions and 12 deletions

View file

@ -15,6 +15,7 @@ use MediaWiki\WikiMap\WikiMap;
use MWTimestamp;
use NullLockManager;
use ObjectCache;
use RequestContext;
use SpecialPage;
use StatusValue;
use UnderflowException;
@ -382,11 +383,10 @@ class FancyCaptcha extends SimpleCaptcha {
* @return bool|StatusValue
*/
public function showImage() {
global $wgOut, $wgRequest;
$context = RequestContext::getMain();
$context->getOutput()->disable();
$wgOut->disable();
$index = $wgRequest->getVal( 'wpCaptchaId' );
$index = $context->getRequest()->getVal( 'wpCaptchaId' );
$info = $this->retrieveCaptcha( $index );
if ( $info ) {
$timestamp = new MWTimestamp();

View file

@ -15,6 +15,7 @@ use MediaWiki\Auth\AuthenticationRequest;
use MediaWiki\Extension\ConfirmEdit\Auth\CaptchaAuthenticationRequest;
use MediaWiki\Extension\ConfirmEdit\SimpleCaptcha\SimpleCaptcha;
use MediaWiki\Extension\ConfirmEdit\Store\CaptchaStore;
use RequestContext;
use Xml;
class QuestyCaptcha extends SimpleCaptcha {
@ -106,11 +107,12 @@ class QuestyCaptcha extends SimpleCaptcha {
}
public function showHelp() {
global $wgOut;
$wgOut->setPageTitle( wfMessage( 'captchahelp-title' )->text() );
$wgOut->addWikiMsg( 'questycaptchahelp-text' );
$context = RequestContext::getMain();
$out = $context->getOutput();
$out->setPageTitle( $context->msg( 'captchahelp-title' )->text() );
$out->addWikiMsg( 'questycaptchahelp-text' );
if ( CaptchaStore::get()->cookiesNeeded() ) {
$wgOut->addWikiMsg( 'captchahelp-cookies-needed' );
$out->addWikiMsg( 'captchahelp-cookies-needed' );
}
}

View file

@ -1197,11 +1197,12 @@ class SimpleCaptcha {
* Show a page explaining what this wacky thing is.
*/
public function showHelp() {
global $wgOut;
$wgOut->setPageTitle( wfMessage( 'captchahelp-title' )->text() );
$wgOut->addWikiMsg( 'captchahelp-text' );
$context = RequestContext::getMain();
$out = $context->getOutput();
$out->setPageTitle( $context->msg( 'captchahelp-title' )->text() );
$out->addWikiMsg( 'captchahelp-text' );
if ( CaptchaStore::get()->cookiesNeeded() ) {
$wgOut->addWikiMsg( 'captchahelp-cookies-needed' );
$out->addWikiMsg( 'captchahelp-cookies-needed' );
}
}