MediaWiki  1.30.0
generateNormalizerDataMl.php
Go to the documentation of this file.
1 <?php
24 require_once __DIR__ . '/../Maintenance.php';
25 
34  public function __construct() {
35  parent::__construct();
36  $this->addDescription( 'Generate the normalizer data file for Malayalam' );
37  }
38 
39  public function getDbType() {
40  return Maintenance::DB_NONE;
41  }
42 
43  public function execute() {
44  $hexPairs = [
45  # From http://unicode.org/versions/Unicode5.1.0/#Malayalam_Chillu_Characters
46  '0D23 0D4D 200D' => '0D7A',
47  '0D28 0D4D 200D' => '0D7B',
48  '0D30 0D4D 200D' => '0D7C',
49  '0D32 0D4D 200D' => '0D7D',
50  '0D33 0D4D 200D' => '0D7E',
51 
52  # From http://permalink.gmane.org/gmane.science.linguistics.wikipedia.technical/46413
53  '0D15 0D4D 200D' => '0D7F',
54  ];
55 
56  $pairs = [];
57  foreach ( $hexPairs as $hexSource => $hexDest ) {
59  $dest = UtfNormal\Utils::hexSequenceToUtf8( $hexDest );
60  $pairs[$source] = $dest;
61  }
62 
63  global $IP;
64  file_put_contents( "$IP/serialized/normalize-ml.ser", serialize( $pairs ) );
65  echo "ml: " . count( $pairs ) . " pairs written.\n";
66  }
67 }
68 
69 $maintClass = 'GenerateNormalizerDataMl';
70 require_once RUN_MAINTENANCE_IF_MAIN;
$maintClass
$maintClass
Definition: generateNormalizerDataMl.php:69
captcha-old.count
count
Definition: captcha-old.py:249
Maintenance\addDescription
addDescription( $text)
Set the description text.
Definition: Maintenance.php:287
RUN_MAINTENANCE_IF_MAIN
require_once RUN_MAINTENANCE_IF_MAIN
Definition: maintenance.txt:50
serialize
serialize()
Definition: ApiMessage.php:177
GenerateNormalizerDataMl\__construct
__construct()
Default constructor.
Definition: generateNormalizerDataMl.php:34
Maintenance
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
Definition: maintenance.txt:39
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
$IP
$IP
Definition: update.php:3
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
GenerateNormalizerDataMl\execute
execute()
Do the actual work.
Definition: generateNormalizerDataMl.php:43
Maintenance\DB_NONE
const DB_NONE
Constants for DB access type.
Definition: Maintenance.php:62
hexSequenceToUtf8
hexSequenceToUtf8( $sequence)
Take a series of space-separated hexadecimal numbers representing Unicode code points and return a UT...
Definition: UtfNormalUtil.php:54
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
$source
$source
Definition: mwdoc-filter.php:46
GenerateNormalizerDataMl\getDbType
getDbType()
Does the script need different DB access? By default, we give Maintenance scripts normal rights to th...
Definition: generateNormalizerDataMl.php:39
GenerateNormalizerDataMl
Generates the normalizer data file for Malayalam.
Definition: generateNormalizerDataMl.php:33