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

View file

@ -15,6 +15,7 @@ use MediaWiki\Auth\AuthenticationRequest;
use MediaWiki\Extension\ConfirmEdit\Auth\CaptchaAuthenticationRequest; use MediaWiki\Extension\ConfirmEdit\Auth\CaptchaAuthenticationRequest;
use MediaWiki\Extension\ConfirmEdit\SimpleCaptcha\SimpleCaptcha; use MediaWiki\Extension\ConfirmEdit\SimpleCaptcha\SimpleCaptcha;
use MediaWiki\Extension\ConfirmEdit\Store\CaptchaStore; use MediaWiki\Extension\ConfirmEdit\Store\CaptchaStore;
use RequestContext;
use Xml; use Xml;
class QuestyCaptcha extends SimpleCaptcha { class QuestyCaptcha extends SimpleCaptcha {
@ -106,11 +107,12 @@ class QuestyCaptcha extends SimpleCaptcha {
} }
public function showHelp() { public function showHelp() {
global $wgOut; $context = RequestContext::getMain();
$wgOut->setPageTitle( wfMessage( 'captchahelp-title' )->text() ); $out = $context->getOutput();
$wgOut->addWikiMsg( 'questycaptchahelp-text' ); $out->setPageTitle( $context->msg( 'captchahelp-title' )->text() );
$out->addWikiMsg( 'questycaptchahelp-text' );
if ( CaptchaStore::get()->cookiesNeeded() ) { 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. * Show a page explaining what this wacky thing is.
*/ */
public function showHelp() { public function showHelp() {
global $wgOut; $context = RequestContext::getMain();
$wgOut->setPageTitle( wfMessage( 'captchahelp-title' )->text() ); $out = $context->getOutput();
$wgOut->addWikiMsg( 'captchahelp-text' ); $out->setPageTitle( $context->msg( 'captchahelp-title' )->text() );
$out->addWikiMsg( 'captchahelp-text' );
if ( CaptchaStore::get()->cookiesNeeded() ) { if ( CaptchaStore::get()->cookiesNeeded() ) {
$wgOut->addWikiMsg( 'captchahelp-cookies-needed' ); $out->addWikiMsg( 'captchahelp-cookies-needed' );
} }
} }