Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
23.81% |
5 / 21 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
ContentModelLogFormatter | |
23.81% |
5 / 21 |
|
50.00% |
1 / 2 |
16.06 | |
0.00% |
0 / 1 |
getMessageParameters | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
getActionLinks | |
0.00% |
0 / 16 |
|
0.00% |
0 / 1 |
20 |
1 | <?php |
2 | |
3 | use MediaWiki\Content\ContentHandler; |
4 | use MediaWiki\SpecialPage\SpecialPage; |
5 | |
6 | class ContentModelLogFormatter extends LogFormatter { |
7 | protected function getMessageParameters() { |
8 | $lang = $this->context->getLanguage(); |
9 | $params = parent::getMessageParameters(); |
10 | $params[3] = ContentHandler::getLocalizedName( $params[3], $lang ); |
11 | $params[4] = ContentHandler::getLocalizedName( $params[4], $lang ); |
12 | return $params; |
13 | } |
14 | |
15 | public function getActionLinks() { |
16 | if ( $this->entry->isDeleted( LogPage::DELETED_ACTION ) // Action is hidden |
17 | || $this->entry->getSubtype() !== 'change' |
18 | || !$this->context->getAuthority()->isAllowed( 'editcontentmodel' ) |
19 | ) { |
20 | return ''; |
21 | } |
22 | |
23 | $params = $this->extractParameters(); |
24 | $revert = $this->getLinkRenderer()->makeKnownLink( |
25 | SpecialPage::getTitleFor( 'ChangeContentModel' ), |
26 | $this->msg( 'logentry-contentmodel-change-revertlink' )->text(), |
27 | [], |
28 | [ |
29 | 'pagetitle' => $this->entry->getTarget()->getPrefixedText(), |
30 | 'model' => $params[3], |
31 | 'reason' => $this->msg( 'logentry-contentmodel-change-revert' )->inContentLanguage()->text(), |
32 | ] |
33 | ); |
34 | |
35 | return $this->msg( 'parentheses' )->rawParams( $revert )->escaped(); |
36 | } |
37 | } |