r112079 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112078‎ | r112079 | r112080 >
Date:02:28, 22 February 2012
Author:aaron
Status:ok (Comments)
Tags:
Comment:
* General log formatting fixes, like using the content language, for IRC feeds (works similar to LogPage::actionText). Use getPrefixedText() for the log title, not just the non-namespace part.
* Made patrol log IRC code behave as it did pre-r97495.
Modified paths:
  • /trunk/phase3/includes/logging/LogFormatter.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/logging/LogFormatter.php
@@ -173,24 +173,23 @@
174174 $this->plaintext = true;
175175 $text = $this->getActionText();
176176
177 - // wfRunHooks( 'LogEntry::publish', array( $this, $formatter, &$actionText ) );
178 - // function efLegacyLogsIrcFormat( $entry, $formatter, &$text ) {
179 -
180177 $entry = $this->entry;
181178 $parameters = $entry->getParameters();
 179+ // @see LogPage::actionText()
 180+ $msgOpts = array( 'parsemag', 'escape', 'replaceafter', 'content' );
182181 // Text of title the action is aimed at.
183 - $target = $entry->getTarget()->getText() ;
 182+ $target = $entry->getTarget()->getPrefixedText() ;
184183 $text = null;
185184 switch( $entry->getType() ) {
186185 case 'move':
187186 switch( $entry->getSubtype() ) {
188187 case 'move':
189188 $movesource = $parameters['4::target'];
190 - $text = wfMsg( '1movedto2', $target, $movesource );
 189+ $text = wfMsgExt( '1movedto2', $msgOpts, $target, $movesource );
191190 break;
192191 case 'move_redir':
193192 $movesource = $parameters['4::target'];
194 - $text = wfMsg( '1movedto2_redir', $target, $movesource );
 193+ $text = wfMsgExt( '1movedto2_redir', $msgOpts, $target, $movesource );
195194 break;
196195 case 'move-noredirect':
197196 break;
@@ -202,10 +201,10 @@
203202 case 'delete':
204203 switch( $entry->getSubtype() ) {
205204 case 'delete':
206 - $text = wfMsg( 'deletedarticle', $target );
 205+ $text = wfMsgExt( 'deletedarticle', $msgOpts, $target );
207206 break;
208207 case 'restore':
209 - $text = wfMsg( 'undeletedarticle', $target );
 208+ $text = wfMsgExt( 'undeletedarticle', $msgOpts, $target );
210209 break;
211210 //case 'revision': // Revision deletion
212211 //case 'event': // Log deletion
@@ -217,26 +216,10 @@
218217 case 'patrol':
219218 // https://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/PatrolLog.php?&pathrev=97495&r1=97494&r2=97495
220219 // Create a diff link to the patrolled revision
221 - $diffLink = Linker::link(
222 - $target,
223 - htmlspecialchars( wfMsg( 'patrol-log-diff', $parameters['4::curid']) ),
224 - array(),
225 - /*query parameters */ array( 'oldid'=>$parameters['4::curid'], 'diff' => 'prev' ),
226 - array( 'known', 'noclasses' )
227 - );
228 - $link = Linker::link( $entry->getTarget() );
229 -
230220 if ( $entry->getSubtype() === 'patrol' ) {
231 - // 'patrol-log-line' => 'marked $1 of $2 patrolled $3',
232 - // 'logentry-irc-patrol-patrol' => '$1 marked revision $4 of page $3 patrolled',
233 -
234 - $text = wfMsg( 'patrol-log-line', $diffLink, $link );
235 - } elseif ( $entry->getSubtype() === 'patrol-auto' ) {
236 - // 'patrol-log-line' => 'marked $1 of $2 patrolled $3',
237 - // 'patrol-log-auto' => '(automatic)',
238 - // 'logentry-irc-patrol-patrol-auto' => '$1 automatically marked revision $4 of page $3 patrolled',
239 - // How is this done with old messages? Some abomination to man?
240 - $text = wfMsg( 'patrol-log-line-auto', $diffLink, $link );
 221+ $diffLink = htmlspecialchars(
 222+ wfMsgForContent( 'patrol-log-diff', $parameters['4::curid'] ) );
 223+ $text = wfMsgForContent( 'patrol-log-line', $diffLink, "[[$target]]", "" );
241224 } else {
242225 // broken??
243226 }
@@ -246,13 +229,13 @@
247230 switch( $entry->getSubtype() ) {
248231 case 'newusers':
249232 case 'create':
250 - $text = wfMsg( 'newuserlog-create-entry' /* no params */ );
 233+ $text = wfMsgExt( 'newuserlog-create-entry', $msgOpts /* no params */ );
251234 break;
252235 case 'create2':
253 - $text = wfMsg( 'newuserlog-create2-entry', $target );
 236+ $text = wfMsgExt( 'newuserlog-create2-entry', $msgOpts, $target );
254237 break;
255238 case 'autocreate':
256 - $text = wfMsg( 'newuserlog-autocreate-entry' /* no params */ );
 239+ $text = wfMsgExt( 'newuserlog-autocreate-entry', $msgOpts /* no params */ );
257240 break;
258241 }
259242 break;

Follow-up revisions

RevisionCommit summaryAuthorDate
r112130MFT r112079, r112128aaron18:40, 22 February 2012
r112639MFT r112045, r112046, r112049, r112061, r112066, r112079, r112128reedy21:08, 28 February 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r97495Converted patrol log to the new systemnikerabbit14:21, 19 September 2011

Comments

#Comment by Nikerabbit (talk | contribs)   08:14, 22 February 2012

wfMessage is the new thing.

Status & tagging log