r112061 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112060‎ | r112061 | r112062 >
Date:23:38, 21 February 2012
Author:reedy
Status:ok (Comments)
Tags:todo 
Comment:
Bug 34508 - [Regression] IRC string output for log messages no longer compatible

Update messages/MessagesEn.php

Add large backcompat switch conditional thing
Modified paths:
  • /trunk/phase3/includes/logging/LogFormatter.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/logging/LogFormatter.php
@@ -157,17 +157,91 @@
158158
159159 $entry = $this->entry;
160160 $parameters = $entry->getParameters();
161 - switch ( $entry ) {
 161+ // Text of title the action is aimed at.
 162+ $target = $entry->getTarget()->getText() ;
 163+ $text = null;
 164+ switch( $entry->getType() ) {
162165 case 'move':
163 - if ( $entry->getSubtype() === 'move_redir' ) {
164 - $movesource = $parameters['4::target'];
165 - $movetarget = $entry->getTarget()->getText();
166 - $text = wfMsg( '1movedto2_redir', $movesource, $movetarget );
 166+ switch( $entry->getSubtype() ) {
 167+ case 'move':
 168+ $movesource = $parameters['4::target'];
 169+ $text = wfMsg( '1movedto2', $movesource, $target );
 170+ break;
 171+ case 'move_redir':
 172+ $movesource = $parameters['4::target'];
 173+ $text = wfMsg( '1movedto2_redir', $movesource, $target );
 174+ break;
 175+ case 'move-noredirect':
 176+ break;
 177+ case 'move_redir-noredirect':
 178+ break;
167179 }
168180 break;
169 - // case 'delete':
170 - // break
 181+
 182+ case 'delete':
 183+ switch( $entry->getSubtype() ) {
 184+ case 'delete':
 185+ $text = wfMsg( 'deletedarticle', $target );
 186+ break;
 187+ case 'restore':
 188+ $text = wfMsg( 'undeletedarticle', $target );
 189+ break;
 190+ //case 'revision': // Revision deletion
 191+ //case 'event': // Log deletion
 192+ // see https://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/LogPage.php?&pathrev=97044&r1=97043&r2=97044
 193+ //default:
 194+ }
 195+ break;
 196+
 197+ case 'patrol':
 198+ // https://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/PatrolLog.php?&pathrev=97495&r1=97494&r2=97495
 199+ // Create a diff link to the patrolled revision
 200+ $diffLink = Linker::link(
 201+ $target,
 202+ htmlspecialchars( wfMsg( 'patrol-log-diff', $parameters['4::curid']) ),
 203+ array(),
 204+ /*query parameters */ array( 'oldid'=>$parameters['4::curid'], 'diff' => 'prev' ),
 205+ array( 'known', 'noclasses' )
 206+ );
 207+ $link = Linker::link( $entry->getTarget() );
 208+
 209+ if ( $entry->getSubtype() === 'patrol' ) {
 210+ // 'patrol-log-line' => 'marked $1 of $2 patrolled $3',
 211+ // 'logentry-irc-patrol-patrol' => '$1 marked revision $4 of page $3 patrolled',
 212+
 213+ $text = wfMsg( 'patrol-log-line', $diffLink, $link );
 214+ } elseif ( $entry->getSubtype() === 'patrol-auto' ) {
 215+ // 'patrol-log-line' => 'marked $1 of $2 patrolled $3',
 216+ // 'patrol-log-auto' => '(automatic)',
 217+ // 'logentry-irc-patrol-patrol-auto' => '$1 automatically marked revision $4 of page $3 patrolled',
 218+ // How is this done with old messages? Some abomination to man?
 219+ $text = wfMsg( 'patrol-log-line-auto', $diffLink, $link );
 220+ } else {
 221+ // broken??
 222+ }
 223+ break;
 224+
 225+ case 'newusers':
 226+ switch( $entry->getSubtype() ) {
 227+ case 'newusers':
 228+ case 'create':
 229+ $text = wfMsg( 'newuserlog-create-entry' /* no params */ );
 230+ break;
 231+ case 'create2':
 232+ $text = wfMsg( 'newuserlog-create2-entry', $target );
 233+ break;
 234+ case 'autocreate':
 235+ $text = wfMsg( 'newuserlog-autocreate-entry' /* no params */ );
 236+ break;
 237+ }
 238+ break;
 239+
 240+ // case 'suppress' --private log -- aaron (sign your messages so we know who to blame in a few years :-D)
 241+ // default:
171242 }
 243+ if( is_null( $text ) ) {
 244+ $text = $this->getPlainActionText();
 245+ }
172246
173247 $this->plaintext = false;
174248 return $text;
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -4723,8 +4723,6 @@
47244724 'revdelete-content' => 'content',
47254725 'revdelete-summary' => 'edit summary',
47264726 'revdelete-uname' => 'username',
4727 -'revdelete-restricted' => 'applied restrictions to administrators',
4728 -'revdelete-unrestricted' => 'removed restrictions for administrators',
47294727 'revdelete-hid' => 'hid $1',
47304728 'revdelete-unhid' => 'unhid $1',
47314729 'revdelete-log-message' => '$1 for $2 {{PLURAL:$2|revision|revisions}}',
@@ -4735,6 +4733,15 @@
47364734 'patrol-log-line' => 'marked $1 of $2 patrolled $3',
47374735 'patrol-log-auto' => '(automatic)',
47384736 'patrol-log-diff' => 'revision $1',
 4737+'1movedto2' => 'moved [[$1]] to [[$2]]',
 4738+'1movedto2_redir' => 'moved [[$1]] to [[$2]] over redirect',
 4739+'move-redirect-suppressed' => 'redirect suppressed',
 4740+'newuserlog-byemail' => 'password sent by e-mail',
 4741+'newuserlog-create-entry' => 'New user account',
 4742+'newuserlog-create2-entry' => 'created new account $1',
 4743+'newuserlog-autocreate-entry' => 'Account created automatically',
 4744+'suppressedarticle' => 'suppressed "[[$1]]"',
 4745+'deletedarticle' => 'deleted "[[$1]]"',
47394746
47404747 # Feedback
47414748 'feedback-bugornote' => 'If you are ready to describe a technical problem in detail please [$1 report a bug].

Follow-up revisions

RevisionCommit summaryAuthorDate
r112066Move parameters were backwards...reedy00:00, 22 February 2012
r112073MFT r112045, r112046, r112049, r112061, r112062, r112063, r112065, r112066, r...reedy00:54, 22 February 2012
r112100r112061: Add new message keys to maintenance files otherwise the next run of ...raymond11:33, 22 February 2012
r112128r112045/bug 34508: Make upload/upload and overwrite match old IRC formatrobla18:29, 22 February 2012
r112415basic tests for bug 34508hashar21:22, 25 February 2012
r112561[IRC Log Message] Fix for protect/protect and protect/modify...krinkle01:56, 28 February 2012
r112639MFT r112045, r112046, r112049, r112061, r112066, r112079, r112128reedy21:08, 28 February 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r112042Part 1 for bug 34508, commit all the messages added in patch 3reedy21:12, 21 February 2012
r112045First merge of the rest of the code from bug 34508 patch 1 and patch 3reedy21:26, 21 February 2012

Comments

#Comment by Hashar (talk | contribs)   23:40, 21 February 2012

subscribing to revision.

#Comment by Krinkle (talk | contribs)   23:46, 21 February 2012

Todo:

  • Add 'qqq' messages documenting that these are used as 'irc log' messages
  • Document in 'qqq' what the variables mean, and perhaps mention {{mw-msg|..}} the equivalent message key for the on-wiki message (to help translators)
  • Document somewhere in the code that it's okay for these messages to change, but for backwards compatibility with IRC bots the message-keys and variable-numbers must stay compatible.
#Comment by Nikerabbit (talk | contribs)   07:14, 22 February 2012

I don't want these messages to be translated.

Status & tagging log