r85557 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85556‎ | r85557 | r85558 >
Date:18:37, 6 April 2011
Author:ialex
Status:ok
Tags:
Comment:
* Added possibility to set short options aliases to long long options, added -h alias to --help and -q to --quiet for all scripts
* Converted edit.php, people using short option version (with only one dash) won't have to change anything, but the ones using long options that were only one character (--u, --s, --m, --b and --a) will either need to change to short options or use full name
Modified paths:
  • /trunk/phase3/maintenance/edit.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/edit.php
@@ -26,23 +26,23 @@
2727 public function __construct() {
2828 parent::__construct();
2929 $this->mDescription = "Edit an article from the command line, text is from stdin";
30 - $this->addOption( 'u', 'Username', false, true );
31 - $this->addOption( 's', 'Edit summary', false, true );
32 - $this->addOption( 'm', 'Minor edit' );
33 - $this->addOption( 'b', 'Bot edit' );
34 - $this->addOption( 'a', 'Enable autosummary' );
35 - $this->addOption( 'no-rc', 'Do not show the change in recent changes' );
 30+ $this->addOption( 'user', 'Username', false, true, 'u' );
 31+ $this->addOption( 'summary', 'Edit summary', false, true, 's' );
 32+ $this->addOption( 'minor', 'Minor edit', false, false, 'm' );
 33+ $this->addOption( 'bot', 'Bot edit', false, false, 'b' );
 34+ $this->addOption( 'autosummary', 'Enable autosummary', false, false, 'a' );
 35+ $this->addOption( 'no-rc', 'Do not show the change in recent changes', false, false, 'r' );
3636 $this->addArg( 'title', 'Title of article to edit' );
3737 }
3838
3939 public function execute() {
4040 global $wgUser, $wgTitle;
4141
42 - $userName = $this->getOption( 'u', 'Maintenance script' );
43 - $summary = $this->getOption( 's', '' );
44 - $minor = $this->hasOption( 'm' );
45 - $bot = $this->hasOption( 'b' );
46 - $autoSummary = $this->hasOption( 'a' );
 42+ $userName = $this->getOption( 'user', 'Maintenance script' );
 43+ $summary = $this->getOption( 'summary', '' );
 44+ $minor = $this->hasOption( 'minor' );
 45+ $bot = $this->hasOption( 'bot' );
 46+ $autoSummary = $this->hasOption( 'autosummary' );
4747 $noRC = $this->hasOption( 'no-rc' );
4848
4949 $wgUser = User::newFromName( $userName );

Follow-up revisions

RevisionCommit summaryAuthorDate
r85558And I forgot to commit this file in r85557ialex18:38, 6 April 2011

Status & tagging log