MediaWiki master
NewUsersLogFormatter.php
Go to the documentation of this file.
1<?php
28
35 protected function getMessageParameters() {
36 $params = parent::getMessageParameters();
37 $subtype = $this->entry->getSubtype();
38 if ( $subtype === 'create2' || $subtype === 'byemail' ) {
39 if ( isset( $params[3] ) ) {
40 $target = User::newFromId( $params[3] );
41 } else {
42 $target = User::newFromName( $this->entry->getTarget()->getText(), false );
43 }
44 $params[2] = Message::rawParam( $this->makeUserLink( $target ) );
45 $params[3] = $target->getName();
46 }
47
48 return $params;
49 }
50
51 public function getComment() {
52 $timestamp = wfTimestamp( TS_MW, $this->entry->getTimestamp() );
53 if ( $timestamp < '20080129000000' ) {
54 # Suppress $comment from old entries (before 2008-01-29),
55 # not needed and can contain incorrect links
56 return '';
57 }
58
59 return parent::getComment();
60 }
61
62 public function getPreloadTitles() {
63 $subtype = $this->entry->getSubtype();
64 if ( $subtype === 'create2' || $subtype === 'byemail' ) {
65 // add the user talk to LinkBatch for the userLink
66 return [ Title::makeTitle( NS_USER_TALK, $this->entry->getTarget()->getText() ) ];
67 }
68
69 return [];
70 }
71}
const NS_USER_TALK
Definition Defines.php:68
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
array $params
The job parameters.
Implements the default log formatting.
makeUserLink(UserIdentity $user, $toolFlags=0)
Represents a title within MediaWiki.
Definition Title.php:78
internal since 1.36
Definition User.php:93
This class formats new user log entries.
getMessageParameters()
Formats parameters intended for action message from array of all parameters.
getComment()
Gets the user provided comment.