Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
11 / 11 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
IPInfoLogFormatter | |
100.00% |
11 / 11 |
|
100.00% |
1 / 1 |
4 | |
100.00% |
1 / 1 |
getMessageParameters | |
100.00% |
11 / 11 |
|
100.00% |
1 / 1 |
4 |
1 | <?php |
2 | |
3 | namespace MediaWiki\IPInfo\Logging; |
4 | |
5 | use LogFormatter; |
6 | use MediaWiki\Linker\Linker; |
7 | use MediaWiki\Message\Message; |
8 | |
9 | class IPInfoLogFormatter extends LogFormatter { |
10 | |
11 | /** @inheritDoc */ |
12 | protected function getMessageParameters() { |
13 | $params = parent::getMessageParameters(); |
14 | |
15 | // Update the log line depending on if the user had their access enabled or disabled |
16 | if ( $this->entry->getSubtype() === 'change_access' ) { |
17 | // Message keys used: |
18 | // - 'ipinfo-change-access-level-enable' |
19 | // - 'ipinfo-change-access-level-disable' |
20 | $params[3] = $this->msg( 'ipinfo-change-access-level-' . $params[3], $params[1] ); |
21 | } |
22 | |
23 | if ( |
24 | $this->entry->getSubtype() === 'view_infobox' || |
25 | $this->entry->getSubtype() === 'view_popup' |
26 | ) { |
27 | // Generate an appropriate user page or contributions page link. |
28 | // Don't use the LogFormatter::makeUserLink function, because that adds tools links. |
29 | $targetName = $this->entry->getTarget()->getText(); |
30 | $params[2] = Message::rawParam( |
31 | Linker::userLink( 0, $targetName ) |
32 | ); |
33 | |
34 | // Replace access level parameter with the message. |
35 | // Message keys used: |
36 | // - 'ipinfo-log-access-level-ipinfo-view-basic' |
37 | // - 'ipinfo-log-access-level-ipinfo-view-full' |
38 | $params[3] = $this->msg( 'ipinfo-log-access-level-' . $params[3] ); |
39 | } |
40 | |
41 | return $params; |
42 | } |
43 | } |