X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=maintenance%2Fedit.php;h=b67a9571626f4540117d5459f7f9d1372102ad71;hb=865f4f8d6b22d166039f6721bbfe098309594aff;hp=6bdb15d90b587ecabbd1c3d84dfcef81e5064f78;hpb=b3970523a37d71997786683de214e2e1452b60fd;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/edit.php b/maintenance/edit.php index 6bdb15d90b..b67a957162 100644 --- a/maintenance/edit.php +++ b/maintenance/edit.php @@ -46,16 +46,18 @@ class EditCLI extends Maintenance { public function execute() { global $wgUser; - $userName = $this->getOption( 'user', 'Maintenance script' ); + $userName = $this->getOption( 'user', false ); $summary = $this->getOption( 'summary', '' ); $minor = $this->hasOption( 'minor' ); $bot = $this->hasOption( 'bot' ); $autoSummary = $this->hasOption( 'autosummary' ); $noRC = $this->hasOption( 'no-rc' ); - $wgUser = User::newFromName( $userName ); - $context = RequestContext::getMain(); - $context->setUser( $wgUser ); + if ( $userName === false ) { + $wgUser = User::newSystemUser( 'Maintenance script', array( 'steal' => true ) ); + } else { + $wgUser = User::newFromName( $userName ); + } if ( !$wgUser ) { $this->error( "Invalid username", true ); } @@ -67,7 +69,6 @@ class EditCLI extends Maintenance { if ( !$title ) { $this->error( "Invalid title", true ); } - $context->setTitle( $title ); if ( $this->hasOption( 'nocreate' ) && !$title->exists() ) { $this->error( "Page does not exist", true );