MediaWiki master
NewUsersLogFormatter.php
Go to the documentation of this file.
1<?php
29
36 protected function getMessageParameters() {
37 $params = parent::getMessageParameters();
38 $subtype = $this->entry->getSubtype();
39 if ( $subtype === 'create2' || $subtype === 'byemail' ) {
40 if ( isset( $params[3] ) ) {
41 $target = User::newFromId( $params[3] );
42 } else {
43 $target = User::newFromName( $this->entry->getTarget()->getText(), false );
44 }
45 $params[2] = Message::rawParam( $this->makeUserLink( $target ) );
46 $params[3] = $target->getName();
47 }
48
49 return $params;
50 }
51
52 public function getComment() {
53 $timestamp = wfTimestamp( TS_MW, $this->entry->getTimestamp() );
54 if ( $timestamp < '20080129000000' ) {
55 # Suppress $comment from old entries (before 2008-01-29),
56 # not needed and can contain incorrect links
57 return '';
58 }
59
60 return parent::getComment();
61 }
62
63 public function getPreloadTitles() {
64 $subtype = $this->entry->getSubtype();
65 if ( $subtype === 'create2' || $subtype === 'byemail' ) {
66 // add the user talk to LinkBatch for the userLink
67 return [ Title::makeTitle( NS_USER_TALK, $this->entry->getTarget()->getText() ) ];
68 }
69
70 return [];
71 }
72}
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)
The Message class deals with fetching and processing of interface message into a variety of formats.
Definition Message.php:155
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.