X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=blobdiff_plain;f=maintenance%2Fedit.php;h=4219ed05179b391cce6d4d9376f532704130d7e7;hb=3aa7e1d66a0f3d91043c7abf0e10eac15f445a80;hp=75ec12bfdd1da559d501170dbd856bd1ef0e29ad;hpb=91b07c5e0950572fb41f7d8f466fb6b3bbe98be5;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/edit.php b/maintenance/edit.php index 75ec12bfdd..4219ed0517 100644 --- a/maintenance/edit.php +++ b/maintenance/edit.php @@ -31,7 +31,7 @@ require_once __DIR__ . '/Maintenance.php'; class EditCLI extends Maintenance { public function __construct() { parent::__construct(); - $this->mDescription = "Edit an article from the command line, text is from stdin"; + $this->addDescription( 'Edit an article from the command line, text is from stdin' ); $this->addOption( 'user', 'Username', false, true, 'u' ); $this->addOption( 'summary', 'Edit summary', false, true, 's' ); $this->addOption( 'minor', 'Minor edit', false, false, 'm' ); @@ -46,14 +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 ); + if ( $userName === false ) { + $wgUser = User::newSystemUser( 'Maintenance script', [ 'steal' => true ] ); + } else { + $wgUser = User::newFromName( $userName ); + } if ( !$wgUser ) { $this->error( "Invalid username", true ); } @@ -93,7 +97,7 @@ class EditCLI extends Maintenance { $exit = 1; } if ( !$status->isGood() ) { - $this->output( $status->getWikiText() . "\n" ); + $this->output( $status->getWikiText( false, false, 'en' ) . "\n" ); } exit( $exit ); }