Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
ProtectedVarsAccessLogFormatter | |
0.00% |
0 / 9 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getMessageParameters | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Extension\AbuseFilter\LogFormatter; |
4 | |
5 | use LogEntry; |
6 | use LogFormatter; |
7 | use MediaWiki\Extension\AbuseFilter\ProtectedVarsAccessLogger; |
8 | use MediaWiki\Linker\Linker; |
9 | use MediaWiki\Message\Message; |
10 | use MediaWiki\User\UserFactory; |
11 | |
12 | class ProtectedVarsAccessLogFormatter extends LogFormatter { |
13 | |
14 | private UserFactory $userFactory; |
15 | |
16 | public function __construct( |
17 | LogEntry $entry, |
18 | UserFactory $userFactory |
19 | ) { |
20 | parent::__construct( $entry ); |
21 | $this->userFactory = $userFactory; |
22 | } |
23 | |
24 | /** |
25 | * @inheritDoc |
26 | */ |
27 | protected function getMessageParameters() { |
28 | $params = parent::getMessageParameters(); |
29 | |
30 | // Replace temporary user page link with contributions page link. |
31 | // Don't use LogFormatter::makeUserLink, because that adds tools links. |
32 | if ( $this->entry->getSubtype() === ProtectedVarsAccessLogger::ACTION_VIEW_PROTECTED_VARIABLE_VALUE ) { |
33 | $tempUserName = $this->entry->getTarget()->getText(); |
34 | $params[2] = Message::rawParam( |
35 | Linker::userLink( 0, $this->userFactory->newUnsavedTempUser( $tempUserName ) ) |
36 | ); |
37 | } |
38 | |
39 | return $params; |
40 | } |
41 | } |