specials: Get global via IContextSource::getConfig

Change-Id: I8fd45a5bf8f17e3025a80dc899a80375d7624ae8
This commit is contained in:
Umherirrender 2024-09-17 22:07:39 +02:00
parent 3652e8697e
commit 9a0dccd41f
3 changed files with 5 additions and 7 deletions

View file

@ -4,7 +4,6 @@
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPrivate" /> <exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPrivate" />
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected" /> <exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected" />
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" /> <exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" />
<exclude name="MediaWiki.Usage.ExtendClassUsage.FunctionConfigUsage" />
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" /> <exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
</rule> </rule>
<rule ref="Generic.Files.LineLength.TooLong"> <rule ref="Generic.Files.LineLength.TooLong">

View file

@ -4,6 +4,7 @@ namespace MediaWiki\Extension\Math;
use InvalidArgumentException; use InvalidArgumentException;
use MediaWiki\Extension\Math\Render\RendererFactory; use MediaWiki\Extension\Math\Render\RendererFactory;
use MediaWiki\MainConfigNames;
use MediaWiki\SpecialPage\SpecialPage; use MediaWiki\SpecialPage\SpecialPage;
/** /**
@ -63,11 +64,10 @@ class SpecialMathShowImage extends SpecialPage {
} }
public function execute( $par ) { public function execute( $par ) {
global $wgMathEnableExperimentalInputFormats;
$request = $this->getRequest(); $request = $this->getRequest();
$hash = $request->getText( 'hash', '' ); $hash = $request->getText( 'hash', '' );
$tex = $request->getText( 'tex', '' ); $tex = $request->getText( 'tex', '' );
if ( $wgMathEnableExperimentalInputFormats ) { if ( $this->getConfig()->get( 'MathEnableExperimentalInputFormats' ) ) {
$asciimath = $request->getText( 'asciimath', '' ); $asciimath = $request->getText( 'asciimath', '' );
} else { } else {
$asciimath = ''; $asciimath = '';
@ -129,7 +129,6 @@ class SpecialMathShowImage extends SpecialPage {
* @return string xml svg image with the error message * @return string xml svg image with the error message
*/ */
private function printSvgError( $msg ) { private function printSvgError( $msg ) {
global $wgDebugComments;
$result = <<<SVG $result = <<<SVG
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 4" preserveAspectRatio="xMidYMid meet" > <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 4" preserveAspectRatio="xMidYMid meet" >
<text text-anchor="start" fill="red" y="2"> <text text-anchor="start" fill="red" y="2">
@ -137,7 +136,7 @@ $msg
</text> </text>
</svg> </svg>
SVG; SVG;
if ( $wgDebugComments ) { if ( $this->getConfig()->get( MainConfigNames::DebugComments ) ) {
$result .= '<!--' . var_export( $this->renderer, true ) . '-->'; $result .= '<!--' . var_export( $this->renderer, true ) . '-->';
} }
return $result; return $result;

View file

@ -171,9 +171,9 @@ class SpecialMathStatus extends SpecialPage {
* http://www.w3.org/TR/REC-MathML/chap3_5.html#sec3.5.2 * http://www.w3.org/TR/REC-MathML/chap3_5.html#sec3.5.2
*/ */
public function testLaTeXMLLinebreak() { public function testLaTeXMLLinebreak() {
global $wgMathDefaultLaTeXMLSetting; $mathDefaultLaTeXMLSetting = $this->getConfig()->get( 'MathDefaultLaTeXMLSetting' );
$tex = ''; $tex = '';
$testMax = ceil( $wgMathDefaultLaTeXMLSetting[ 'linelength' ] / 2 ); $testMax = ceil( $mathDefaultLaTeXMLSetting[ 'linelength' ] / 2 );
for ( $i = 0; $i < $testMax; $i++ ) { for ( $i = 0; $i < $testMax; $i++ ) {
$tex .= "$i+"; $tex .= "$i+";
} }