Index: trunk/phase3/maintenance/language/messageTypes.inc |
— | — | @@ -179,7 +179,6 @@ |
180 | 180 | 'unusedtemplates-summary', |
181 | 181 | 'fewestrevisions-summary', |
182 | 182 | 'upload-summary', |
183 | | - 'logentry-newusers-newusers', |
184 | 183 | 'wantedtemplates-summary', |
185 | 184 | 'activeusers-summary', |
186 | 185 | 'search-summary', |
Index: trunk/phase3/includes/Setup.php |
— | — | @@ -316,7 +316,7 @@ |
317 | 317 | $wgLogNames['newusers'] = 'newuserlogpage'; |
318 | 318 | $wgLogHeaders['newusers'] = 'newuserlogpagetext'; |
319 | 319 | # newusers, create, create2, autocreate |
320 | | - $wgLogActionsHandlers['newusers/*'] = 'LogFormatter'; |
| 320 | + $wgLogActionsHandlers['newusers/*'] = 'NewUsersLogFormatter'; |
321 | 321 | } |
322 | 322 | |
323 | 323 | if ( $wgCookieSecure === 'detect' ) { |
Index: trunk/phase3/includes/logging/LogFormatter.php |
— | — | @@ -226,26 +226,8 @@ |
227 | 227 | */ |
228 | 228 | public function getPerformerElement() { |
229 | 229 | $performer = $this->entry->getPerformer(); |
| 230 | + $element = $this->makeUserLink( $performer ); |
230 | 231 | |
231 | | - if ( $this->plaintext ) { |
232 | | - $element = $performer->getName(); |
233 | | - } else { |
234 | | - $element = Linker::userLink( |
235 | | - $performer->getId(), |
236 | | - $performer->getName() |
237 | | - ); |
238 | | - |
239 | | - if ( $this->linkFlood ) { |
240 | | - $element .= Linker::userToolLinks( |
241 | | - $performer->getId(), |
242 | | - $performer->getName(), |
243 | | - true, // Red if no edits |
244 | | - 0, // Flags |
245 | | - $performer->getEditCount() |
246 | | - ); |
247 | | - } |
248 | | - } |
249 | | - |
250 | 232 | if ( $this->entry->isDeleted( LogPage::DELETED_USER ) ) { |
251 | 233 | $element = self::getRestrictedElement( 'rev-deleted-user' ); |
252 | 234 | } |
— | — | @@ -296,6 +278,28 @@ |
297 | 279 | ->title( $this->context->getTitle() ); |
298 | 280 | } |
299 | 281 | |
| 282 | + protected function makeUserLink( User $user ) { |
| 283 | + if ( $this->plaintext ) { |
| 284 | + $element = $user->getName(); |
| 285 | + } else { |
| 286 | + $element = Linker::userLink( |
| 287 | + $user->getId(), |
| 288 | + $user->getName() |
| 289 | + ); |
| 290 | + |
| 291 | + if ( $this->linkFlood ) { |
| 292 | + $element .= Linker::userToolLinks( |
| 293 | + $user->getId(), |
| 294 | + $user->getName(), |
| 295 | + true, // Red if no edits |
| 296 | + 0, // Flags |
| 297 | + $user->getEditCount() |
| 298 | + ); |
| 299 | + } |
| 300 | + } |
| 301 | + return $element; |
| 302 | + } |
| 303 | + |
300 | 304 | } |
301 | 305 | |
302 | 306 | /** |
— | — | @@ -455,4 +459,35 @@ |
456 | 460 | $newParams[3] = Message::rawParam( $revlink ); |
457 | 461 | return $newParams; |
458 | 462 | } |
| 463 | +} |
| 464 | + |
| 465 | +/** |
| 466 | + * This class formats new user log entries. |
| 467 | + * @since 1.19 |
| 468 | + */ |
| 469 | +class NewUsersLogFormatter extends LogFormatter { |
| 470 | + protected function getMessageParameters() { |
| 471 | + $params = parent::getMessageParameters(); |
| 472 | + if ( $this->entry->getSubtype() === 'create2' ) { |
| 473 | + if ( isset( $params[3] ) ) { |
| 474 | + $target = User::newFromId( $params[3] ); |
| 475 | + } else { |
| 476 | + $target = User::newFromName( $this->entry->getTarget()->getText(), false ); |
| 477 | + } |
| 478 | + $params[2] = Message::rawParam( $this->makeUserLink( $target ) ); |
| 479 | + $params[3] = $target->getName(); |
| 480 | + } |
| 481 | + return $params; |
| 482 | + } |
| 483 | + |
| 484 | + public function getComment() { |
| 485 | + $subtype = $this->entry->getSubtype(); |
| 486 | + $timestamp = wfTimestamp( TS_MW, $this->entry->getTimestamp() ); |
| 487 | + if ( $timestamp < '20080129000000' ) { |
| 488 | + # Suppress $comment from old entries (before 2008-01-29), |
| 489 | + # not needed and can contain incorrect links |
| 490 | + return ''; |
| 491 | + } |
| 492 | + return parent::getComment(); |
| 493 | + } |
459 | 494 | } |
\ No newline at end of file |
Index: trunk/phase3/includes/LogEventsList.php |
— | — | @@ -486,19 +486,6 @@ |
487 | 487 | array( 'known', 'noclasses' ) |
488 | 488 | ) . ')'; |
489 | 489 | } |
490 | | - // Self-created users |
491 | | - } elseif( self::typeAction( $row, 'newusers', 'create2' ) ) { |
492 | | - if( isset( $paramArray[0] ) ) { |
493 | | - $revert = Linker::userToolLinks( $paramArray[0], $title->getDBkey(), true ); |
494 | | - } else { |
495 | | - # Fall back to a blue contributions link |
496 | | - $revert = Linker::userToolLinks( 1, $title->getDBkey() ); |
497 | | - } |
498 | | - if( wfTimestamp( TS_MW, $row->log_timestamp ) < '20080129000000' ) { |
499 | | - # Suppress $comment from old entries (before 2008-01-29), |
500 | | - # not needed and can contain incorrect links |
501 | | - $comment = ''; |
502 | | - } |
503 | 490 | // Do nothing. The implementation is handled by the hook modifiying the passed-by-ref parameters. |
504 | 491 | } else { |
505 | 492 | wfRunHooks( 'LogLine', array( $row->log_type, $row->log_action, $title, $paramArray, |
Index: trunk/phase3/includes/AutoLoader.php |
— | — | @@ -545,6 +545,7 @@ |
546 | 546 | 'LogFormatter' => 'includes/logging/LogFormatter.php', |
547 | 547 | 'ManualLogEntry' => 'includes/logging/LogEntry.php', |
548 | 548 | 'MoveLogFormatter' => 'includes/logging/LogFormatter.php', |
| 549 | + 'NewUsersLogFormatter' => 'includes/logging/LogFormatter.php', |
549 | 550 | 'PatrolLog' => 'includes/logging/PatrolLog.php', |
550 | 551 | 'PatrolLogFormatter' => 'includes/logging/LogFormatter.php', |
551 | 552 | 'RCDatabaseLogEntry' => 'includes/logging/LogEntry.php', |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -4653,9 +4653,9 @@ |
4654 | 4654 | 'logentry-move-move_redir-noredirect' => '$1 {{GENDER:$2|moved}} page $3 to $4 over a redirect without leaving a redirect', |
4655 | 4655 | 'logentry-patrol-patrol' => '$1 {{GENDER:$2|marked}} revision $4 of page $3 patrolled', |
4656 | 4656 | 'logentry-patrol-patrol-auto' => '$1 automatically {{GENDER:$2|marked}} revision $4 of page $3 patrolled', |
4657 | | -'logentry-newusers-newusers' => '', # do not translate or duplicate this message to other languages |
| 4657 | +'logentry-newusers-newusers' => '$1 {{GENDER:$2|created}} a user account', |
4658 | 4658 | 'logentry-newusers-create' => '$1 {{GENDER:$2|created}} a user account', |
4659 | | -'logentry-newusers-create2' => '$1 {{GENDER:$2|created}} a user account $3', |
| 4659 | +'logentry-newusers-create2' => '$1 {{GENDER:$2|created}} {{GENDER:$4|a user account}} $3', |
4660 | 4660 | 'logentry-newusers-autocreate' => 'Account $1 was {{GENDER:$2|created}} automatically', |
4661 | 4661 | 'newuserlog-byemail' => 'password sent by e-mail', |
4662 | 4662 | |