MediaWiki  1.33.0
generateNormalizerDataMl.php
Go to the documentation of this file.
1 <?php
24 require_once __DIR__ . '/../Maintenance.php';
25 
27 
36  public function __construct() {
37  parent::__construct();
38  $this->addDescription( 'Generate the normalizer data file for Malayalam' );
39  }
40 
41  public function getDbType() {
42  return Maintenance::DB_NONE;
43  }
44 
45  public function execute() {
46  $hexPairs = [
47  # From https://www.unicode.org/versions/Unicode5.1.0/#Malayalam_Chillu_Characters
48  '0D23 0D4D 200D' => '0D7A',
49  '0D28 0D4D 200D' => '0D7B',
50  '0D30 0D4D 200D' => '0D7C',
51  '0D32 0D4D 200D' => '0D7D',
52  '0D33 0D4D 200D' => '0D7E',
53 
54  # From http://permalink.gmane.org/gmane.science.linguistics.wikipedia.technical/46413
55  '0D15 0D4D 200D' => '0D7F',
56  ];
57 
58  $pairs = [];
59  foreach ( $hexPairs as $hexSource => $hexDest ) {
60  $source = UtfNormal\Utils::hexSequenceToUtf8( $hexSource );
61  $dest = UtfNormal\Utils::hexSequenceToUtf8( $hexDest );
62  $pairs[$source] = $dest;
63  }
64 
65  global $IP;
66  $writer = new StaticArrayWriter();
67  file_put_contents( "$IP/languages/data/normalize-ml.php", $writer->create(
68  $pairs,
69  'File created by generateNormalizerDataMl.php'
70  ) );
71 
72  echo "ml: " . count( $pairs ) . " pairs written.\n";
73  }
74 }
75 
77 require_once RUN_MAINTENANCE_IF_MAIN;
$maintClass
$maintClass
Definition: generateNormalizerDataMl.php:76
captcha-old.count
count
Definition: captcha-old.py:249
Maintenance\addDescription
addDescription( $text)
Set the description text.
Definition: Maintenance.php:329
RUN_MAINTENANCE_IF_MAIN
require_once RUN_MAINTENANCE_IF_MAIN
Definition: maintenance.txt:50
GenerateNormalizerDataMl\__construct
__construct()
Default constructor.
Definition: generateNormalizerDataMl.php:36
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
use
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Definition: MIT-LICENSE.txt:10
GenerateNormalizerDataMl\execute
execute()
Do the actual work.
Definition: generateNormalizerDataMl.php:45
Wikimedia\StaticArrayWriter
Format a static PHP array to be written to a file.
Definition: StaticArrayWriter.php:26
Maintenance\DB_NONE
const DB_NONE
Constants for DB access type.
Definition: Maintenance.php:77
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
class
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
Definition: maintenance.txt:52
GenerateNormalizerDataMl\getDbType
getDbType()
Does the script need different DB access? By default, we give Maintenance scripts normal rights to th...
Definition: generateNormalizerDataMl.php:41
GenerateNormalizerDataMl
Generates the normalizer data file for Malayalam.
Definition: generateNormalizerDataMl.php:35