Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 17
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
GroupRenameLogFormatter
0.00% covered (danger)
0.00%
0 / 17
0.00% covered (danger)
0.00%
0 / 2
20
0.00% covered (danger)
0.00%
0 / 1
 getMessageKey
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 extractParameters
0.00% covered (danger)
0.00%
0 / 16
0.00% covered (danger)
0.00%
0 / 1
12
1<?php
2
3namespace MediaWiki\Extension\CentralAuth\LogFormatter;
4
5use LogFormatter;
6use MediaWiki\Message\Message;
7use MediaWiki\SpecialPage\SpecialPage;
8use MediaWiki\Title\Title;
9
10/**
11 * Handles the following log types:
12 * - gblrights/grouprename
13 */
14class GroupRenameLogFormatter extends LogFormatter {
15
16    /** @inheritDoc */
17    protected function getMessageKey() {
18        return 'logentry-gblrights-grouprename';
19    }
20
21    protected function extractParameters() {
22        if ( $this->entry->isLegacy() ) {
23            $params = parent::extractParameters();
24            if ( isset( $params[4] ) ) {
25                $newName = $params[3];
26                $oldName = $params[4];
27            } else {
28                $newName = $this->entry->getTarget()->getSubpageText();
29                $oldName = $params[3];
30            }
31            $new = Title::newFromText( $newName );
32            $old = Title::newFromText( $oldName );
33        } else {
34            [ 'newName' => $newName, 'oldName' => $oldName ] = $this->entry->getParameters();
35            $new = SpecialPage::getTitleFor( 'GlobalGroupPermissions', $newName );
36            $old = SpecialPage::getTitleFor( 'GlobalGroupPermissions', $oldName );
37        }
38
39        return [
40            3 => Message::rawParam( $this->makePageLink( $new ) ),
41            4 => Message::rawParam( $this->makePageLink( $old ) ),
42        ];
43    }
44
45}