Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
DumpMessages
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
2 / 2
3
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 execute
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2/**
3 * Dump an entire language, using the keys from English
4 * so we get all the values, not just the customized ones
5 *
6 * @license GPL-2.0-or-later
7 * @file
8 * @ingroup MaintenanceLanguage
9 * @todo Make this more useful, right now just dumps content language
10 */
11
12use MediaWiki\Maintenance\Maintenance;
13
14// @codeCoverageIgnoreStart
15require_once __DIR__ . '/../Maintenance.php';
16// @codeCoverageIgnoreEnd
17
18/**
19 * Maintenance script that dumps an entire language, using the keys from English.
20 *
21 * @ingroup MaintenanceLanguage
22 */
23class DumpMessages extends Maintenance {
24
25    public function __construct() {
26        parent::__construct();
27        $this->addDescription( 'Dump an entire language, using the keys from English' );
28    }
29
30    public function execute() {
31        $messages = [];
32        $localisationCache = $this->getServiceContainer()->getLocalisationCache();
33        $localisationMessagesEn = $localisationCache->getItem( 'en', 'messages' );
34        foreach ( $localisationMessagesEn as $key => $_ ) {
35            $messages[$key] = wfMessage( $key )->text();
36        }
37        $this->output( "MediaWiki " . MW_VERSION . " language file\n" );
38        $this->output( serialize( $messages ) );
39    }
40}
41
42// @codeCoverageIgnoreStart
43$maintClass = DumpMessages::class;
44require_once RUN_MAINTENANCE_IF_MAIN;
45// @codeCoverageIgnoreEnd