X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=blobdiff_plain;f=maintenance%2Fedit.php;h=b67a9571626f4540117d5459f7f9d1372102ad71;hb=f2c242e2e8d86d6d12ae9c160b88c43558306d8f;hp=6bdb15d90b587ecabbd1c3d84dfcef81e5064f78;hpb=8751d6a10fa15a7608a75f06bbf4c43001b4c4c9;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 );