MediaWiki REL1_40
NewUsersLogFormatter.php
Go to the documentation of this file.
1<?php
27
34 protected function getMessageParameters() {
35 $params = parent::getMessageParameters();
36 $subtype = $this->entry->getSubtype();
37 if ( $subtype === 'create2' || $subtype === 'byemail' ) {
38 if ( isset( $params[3] ) ) {
39 $target = User::newFromId( $params[3] );
40 } else {
41 $target = User::newFromName( $this->entry->getTarget()->getText(), false );
42 }
43 $params[2] = Message::rawParam( $this->makeUserLink( $target ) );
44 $params[3] = $target->getName();
45 }
46
47 return $params;
48 }
49
50 public function getComment() {
51 $timestamp = wfTimestamp( TS_MW, $this->entry->getTimestamp() );
52 if ( $timestamp < '20080129000000' ) {
53 # Suppress $comment from old entries (before 2008-01-29),
54 # not needed and can contain incorrect links
55 return '';
56 }
57
58 return parent::getComment();
59 }
60
61 public function getPreloadTitles() {
62 $subtype = $this->entry->getSubtype();
63 if ( $subtype === 'create2' || $subtype === 'byemail' ) {
64 // add the user talk to LinkBatch for the userLink
65 return [ Title::makeTitle( NS_USER_TALK, $this->entry->getTarget()->getText() ) ];
66 }
67
68 return [];
69 }
70}
const NS_USER_TALK
Definition Defines.php:67
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Implements the default log formatting.
makeUserLink(UserIdentity $user, $toolFlags=0)
Represents a title within MediaWiki.
Definition Title.php:82
static rawParam( $raw)
Definition Message.php:1135
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.
static newFromName( $name, $validate='valid')
Definition User.php:592
static newFromId( $id)
Static factory method for creation from a given user ID.
Definition User.php:626