Merge "Reduce some references to $wgUser"

This commit is contained in:
jenkins-bot 2020-11-09 14:53:37 +00:00 committed by Gerrit Code Review
commit b8f3822d52
3 changed files with 8 additions and 4 deletions

View file

@ -1656,7 +1656,7 @@ class OutputPage extends ContextSource {
public function parserOptions() {
if ( !$this->mParserOptions ) {
if ( !$this->getUser()->isSafeToLoad() ) {
// $wgUser isn't unstubbable yet, so don't try to get a
// Context user isn't unstubbable yet, so don't try to get a
// ParserOptions for it. And don't cache this ParserOptions
// either.
$po = ParserOptions::newFromAnon();

View file

@ -108,7 +108,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
$out->addModuleStyles( 'mediawiki.special' );
# B/C: $mode used to be waaay down the parameter list, and the first parameter
# was $wgUser
# was a User
if ( $mode instanceof User ) {
$args = func_get_args();
if ( count( $args ) >= 4 ) {

View file

@ -54,13 +54,17 @@ class TableCleanup extends Maintenance {
$this->reportInterval = $this->getOption( 'reporting-interval', $this->reportInterval );
$this->dryrun = $this->hasOption( 'dry-run' );
if ( $this->dryrun ) {
$wgUser = User::newFromName( 'Conversion script' );
$user = User::newFromName( 'Conversion script' );
$this->output( "Checking for bad titles...\n" );
} else {
$wgUser = User::newSystemUser( 'Conversion script', [ 'steal' => true ] );
$user = User::newSystemUser( 'Conversion script', [ 'steal' => true ] );
$this->output( "Checking and fixing bad titles...\n" );
}
// Support deprecated use of the global
$wgUser = $user;
$this->runTable( $this->defaultParams );
}