Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 16
0.00% covered (danger)
0.00%
0 / 5
CRAP
0.00% covered (danger)
0.00%
0 / 1
SpecialContentTranslationStats
0.00% covered (danger)
0.00%
0 / 16
0.00% covered (danger)
0.00%
0 / 5
30
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 execute
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 1
2
 getDescription
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 initModules
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 addJsConfigVars
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3 * Contains the special page Special:ContentTranslationStats.
4 *
5 * @copyright See AUTHORS.txt
6 * @license GPL-2.0-or-later
7 */
8
9namespace ContentTranslation\Special;
10
11use MediaWiki\Context\MutableContext;
12use MediaWiki\SpecialPage\SpecialPage;
13
14/**
15 * Shows some metrics about ContentTranslation usage.
16 *
17 * @ingroup SpecialPage
18 */
19class SpecialContentTranslationStats extends SpecialPage {
20
21    /**
22     * @var \SkinFactory
23     */
24    private $skinFactory;
25
26    /**
27     * @param \SkinFactory $skinFactory
28     */
29    public function __construct( \SkinFactory $skinFactory ) {
30        parent::__construct( 'ContentTranslationStats' );
31        $this->skinFactory = $skinFactory;
32    }
33
34    /** @inheritDoc */
35    final public function execute( $parameters ) {
36        parent::execute( $parameters );
37        // Use custom 'contenttranslation' skin
38        /** @var MutableContext $context */
39        $context = $this->getContext();
40        '@phan-var MutableContext $context';
41        $context->setSkin(
42            $this->skinFactory->makeSkin( 'contenttranslation' )
43        );
44        // Run the extendable chunks from the sub class.
45        $this->initModules();
46        $this->addJsConfigVars();
47    }
48
49    /** @inheritDoc */
50    public function getDescription() {
51        return $this->msg( 'cx-stats-title' );
52    }
53
54    protected function initModules() {
55        $this->getOutput()->addModules( 'ext.cx.stats' );
56    }
57
58    protected function addJsConfigVars() {
59        $this->getOutput()->addJsConfigVars(
60            'wgContentTranslationCampaigns',
61            $this->getConfig()->get( 'ContentTranslationCampaigns' )
62        );
63    }
64}