Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 28 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| AbuseFilterModifyLogFormatter | |
0.00% |
0 / 28 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
| getMessageKey | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| extractParameters | |
0.00% |
0 / 26 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Extension\AbuseFilter\LogFormatter; |
| 4 | |
| 5 | use MediaWiki\Logging\LogFormatter; |
| 6 | use MediaWiki\Message\Message; |
| 7 | use MediaWiki\SpecialPage\SpecialPage; |
| 8 | |
| 9 | class AbuseFilterModifyLogFormatter extends LogFormatter { |
| 10 | |
| 11 | /** |
| 12 | * @return string |
| 13 | */ |
| 14 | protected function getMessageKey() { |
| 15 | $subtype = $this->entry->getSubtype(); |
| 16 | // Messages that can be used here: |
| 17 | // * abusefilter-logentry-create |
| 18 | // * abusefilter-logentry-modify |
| 19 | return "abusefilter-logentry-$subtype"; |
| 20 | } |
| 21 | |
| 22 | /** |
| 23 | * @return array |
| 24 | */ |
| 25 | protected function extractParameters() { |
| 26 | $parameters = $this->entry->getParameters(); |
| 27 | if ( $this->entry->isLegacy() ) { |
| 28 | [ $historyId, $filterId ] = $parameters; |
| 29 | } else { |
| 30 | $historyId = $parameters['historyId']; |
| 31 | $filterId = $parameters['newId']; |
| 32 | } |
| 33 | |
| 34 | $detailsTitle = SpecialPage::getTitleFor( |
| 35 | 'AbuseFilter', |
| 36 | "history/$filterId/diff/prev/$historyId" |
| 37 | ); |
| 38 | |
| 39 | $params = []; |
| 40 | $params[3] = Message::rawParam( |
| 41 | $this->makePageLink( |
| 42 | $this->entry->getTarget(), |
| 43 | [], |
| 44 | $this->msg( 'abusefilter-log-detailedentry-local' ) |
| 45 | ->numParams( $filterId )->escaped() |
| 46 | ) |
| 47 | ); |
| 48 | $params[4] = Message::rawParam( |
| 49 | $this->makePageLink( |
| 50 | $detailsTitle, |
| 51 | [], |
| 52 | $this->msg( 'abusefilter-log-detailslink' )->escaped() |
| 53 | ) |
| 54 | ); |
| 55 | |
| 56 | return $params; |
| 57 | } |
| 58 | |
| 59 | } |