Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7484951
ThanksLogFormatter.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
ThanksLogFormatter.php
View Options
<?php
namespace
MediaWiki\Extension\Thanks
;
use
MediaWiki\Logging\LogEntry
;
use
MediaWiki\Logging\LogFormatter
;
use
MediaWiki\Message\Message
;
use
MediaWiki\Title\NamespaceInfo
;
use
MediaWiki\User\UserFactory
;
use
MediaWiki\User\UserRigorOptions
;
/**
* This class formats log entries for thanks
*/
class
ThanksLogFormatter
extends
LogFormatter
{
public
function
__construct
(
LogEntry
$entry
,
private
readonly
NamespaceInfo
$namespaceInfo
,
private
readonly
UserFactory
$userFactory
,
)
{
parent
::
__construct
(
$entry
);
}
/**
* @inheritDoc
*/
protected
function
getMessageParameters
()
{
$params
=
parent
::
getMessageParameters
();
// Convert target from a pageLink to a userLink since the target is
// actually a user, not a page.
$recipient
=
$this
->
userFactory
->
newFromName
(
$this
->
entry
->
getTarget
()->
getText
(),
UserRigorOptions
::
RIGOR_NONE
);
// @phan-suppress-next-line PhanTypeMismatchArgumentNullable
$params
[
2
]
=
Message
::
rawParam
(
$this
->
makeUserLink
(
$recipient
)
);
$params
[
3
]
=
$recipient
->
getName
();
return
$params
;
}
/** @inheritDoc */
public
function
getPreloadTitles
()
{
// Add the recipient's user talk page to LinkBatch
return
[
$this
->
namespaceInfo
->
getTalkPage
(
$this
->
entry
->
getTarget
()
)
];
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, Nov 23, 14:24 (1 w, 6 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
80/f5/53ec33187ff998a329e1ed255393
Default Alt Text
ThanksLogFormatter.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment