MathGenerateTests: Remove use of $wgUser

Being written to, but not read from, so shouldn't be
needed anymore - set the User of the main RequestContext
instead.

Bug: T248550
Change-Id: I32d50e7bcd81ed77646d625e1a10b0e91e5d6c21
This commit is contained in:
DannyS712 2020-12-09 01:02:23 +00:00
parent c2b3f74402
commit 4868d632c1

View file

@ -60,13 +60,12 @@ class MathGenerateTests extends Maintenance {
} }
public function execute() { public function execute() {
global $wgUser;
$parserTests = []; $parserTests = [];
$page = $this->getArg( 0, self::REFERENCE_PAGE ); $page = $this->getArg( 0, self::REFERENCE_PAGE );
$offset = $this->getOption( 'offset', 0 ); $offset = $this->getOption( 'offset', 0 );
$length = $this->getOption( 'length', PHP_INT_MAX ); $length = $this->getOption( 'length', PHP_INT_MAX );
$userName = $this->getOption( 'user', 'Maintenance script' ); $userName = $this->getOption( 'user', 'Maintenance script' );
$wgUser = User::newFromName( $userName ); RequestContext::getMain()->setUser( User::newFromName( $userName ) );
$allEquations = self::getMathTagsFromPage( $page ); $allEquations = self::getMathTagsFromPage( $page );
if ( !is_array( $allEquations ) ) { if ( !is_array( $allEquations ) ) {
echo "Could not get equations from page '$page'\n"; echo "Could not get equations from page '$page'\n";