MediaWiki REL1_41
digit2html.php
Go to the documentation of this file.
1<?php
24require_once __DIR__ . '/../Maintenance.php';
25
31class Digit2Html extends Maintenance {
32
37 private $mLangs = [
38 'Ar', 'As', 'Bh', 'Bo', 'Dz',
39 'Fa', 'Gu', 'Hi', 'Km', 'Kn',
40 'Ks', 'Lo', 'Ml', 'Mr', 'Ne',
41 'New', 'Or', 'Pa', 'Pi', 'Sa'
42 ];
43
44 public function __construct() {
45 parent::__construct();
46 $this->addDescription( 'Check digit transformation' );
47 }
48
49 public function execute() {
50 $languageNameUtils = $this->getServiceContainer()->getLanguageNameUtils();
51 foreach ( $this->mLangs as $code ) {
52 $filename = $languageNameUtils->getMessagesFileName( $code );
53 $this->output( "Loading language [$code] ..." );
54 unset( $digitTransformTable );
55 require_once $filename;
56 if ( !isset( $digitTransformTable ) ) {
57 $this->error( "\$digitTransformTable not found for lang: $code" );
58 continue;
59 }
60
61 $this->output( "OK\n\$digitTransformTable = [\n" );
62 foreach ( $digitTransformTable as $latin => $translation ) {
63 $htmlent = bin2hex( $translation );
64 $this->output( "'$latin' => '$translation', # &#x$htmlent;\n" );
65 }
66 $this->output( "];\n" );
67 }
68 }
69}
70
71$maintClass = Digit2Html::class;
72require_once RUN_MAINTENANCE_IF_MAIN;
$digitTransformTable
Maintenance script that check digit transformation.
execute()
Do the actual work.
__construct()
Default constructor.
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
error( $err, $die=0)
Throw an error to the user.
output( $out, $channel=null)
Throw some output to the user.
getServiceContainer()
Returns the main service container.
addDescription( $text)
Set the description text.
$maintClass