Merge "rdbms: Remove reliance on internal STATUS_TRX and STATUS_SESS_ sequence"
[mediawiki.git] / maintenance / language / digit2html.php
blobd6dc8576700fbce7a6ae05560228b9c69d31cac7
1 <?php
2 /**
3 * Check digit transformation
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
20 * @file
21 * @ingroup MaintenanceLanguage
24 // @codeCoverageIgnoreStart
25 require_once __DIR__ . '/../Maintenance.php';
26 // @codeCoverageIgnoreEnd
28 /**
29 * Maintenance script that check digit transformation.
31 * @ingroup MaintenanceLanguage
33 class Digit2Html extends Maintenance {
35 /**
36 * @var string[] A list of unicode numerals is available at:
37 * https://www.fileformat.info/info/unicode/category/Nd/list.htm
39 private $mLangs = [
40 'Ar', 'As', 'Bh', 'Bo', 'Dz',
41 'Fa', 'Gu', 'Hi', 'Km', 'Kn',
42 'Ks', 'Lo', 'Ml', 'Mr', 'Ne',
43 'New', 'Or', 'Pa', 'Pi', 'Sa'
46 public function __construct() {
47 parent::__construct();
48 $this->addDescription( 'Check digit transformation' );
51 public function execute() {
52 $languageNameUtils = $this->getServiceContainer()->getLanguageNameUtils();
53 foreach ( $this->mLangs as $code ) {
54 $filename = $languageNameUtils->getMessagesFileName( $code );
55 $this->output( "Loading language [$code] ..." );
56 unset( $digitTransformTable );
57 require_once $filename;
58 if ( !isset( $digitTransformTable ) ) {
59 $this->error( "\$digitTransformTable not found for lang: $code" );
60 continue;
63 $this->output( "OK\n\$digitTransformTable = [\n" );
64 foreach ( $digitTransformTable as $latin => $translation ) {
65 $htmlent = bin2hex( $translation );
66 $this->output( "'$latin' => '$translation', # &#x$htmlent;\n" );
68 $this->output( "];\n" );
73 // @codeCoverageIgnoreStart
74 $maintClass = Digit2Html::class;
75 require_once RUN_MAINTENANCE_IF_MAIN;
76 // @codeCoverageIgnoreEnd