"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "maintenance/language/generateNormalizerDataAr.php" between
mediawiki-1.31.1.tar.gz and mediawiki-1.32.0.tar.gz

About: MediaWiki is a wiki engine (the collaborative editing software that runs for e.g. Wikipedia, the free encyclopedia).

generateNormalizerDataAr.php  (mediawiki-1.31.1):generateNormalizerDataAr.php  (mediawiki-1.32.0)
skipping to change at line 31 skipping to change at line 31
* @ingroup MaintenanceLanguage * @ingroup MaintenanceLanguage
*/ */
require_once __DIR__ . '/../Maintenance.php'; require_once __DIR__ . '/../Maintenance.php';
/** /**
* Generates the normalizer data file for Arabic. * Generates the normalizer data file for Arabic.
* *
* This data file is used after normalizing to NFC. * This data file is used after normalizing to NFC.
* *
* Example usage:
*
* curl 'https://unicode.org/Public/6.0.0/ucd/UnicodeData.txt' > /tmp/Unicode
Data.txt
* php generateNormalizerDataAr.php --unicode-data-file /tmp/UnicodeData.txt
*
* @ingroup MaintenanceLanguage * @ingroup MaintenanceLanguage
*/ */
class GenerateNormalizerDataAr extends Maintenance { class GenerateNormalizerDataAr extends Maintenance {
public function __construct() { public function __construct() {
parent::__construct(); parent::__construct();
$this->addDescription( 'Generate the normalizer data file for Ara bic' ); $this->addDescription( 'Generate the normalizer data file for Ara bic' );
$this->addOption( 'unicode-data-file', 'The local location of the data file ' . $this->addOption( 'unicode-data-file', 'The local location of the data file ' .
'from http://unicode.org/Public/UNIDATA/UnicodeData.txt', false, true ); 'from https://unicode.org/Public/6.0.0/ucd/UnicodeData.tx t', false, true );
} }
public function getDbType() { public function getDbType() {
return Maintenance::DB_NONE; return Maintenance::DB_NONE;
} }
public function execute() { public function execute() {
if ( !$this->hasOption( 'unicode-data-file' ) ) { if ( !$this->hasOption( 'unicode-data-file' ) ) {
$dataFile = 'UnicodeData.txt'; $dataFile = 'UnicodeData.txt';
if ( !file_exists( $dataFile ) ) { if ( !file_exists( $dataFile ) ) {
skipping to change at line 64 skipping to change at line 69
if ( !file_exists( $dataFile ) ) { if ( !file_exists( $dataFile ) ) {
$this->fatalError( 'Unable to find the specified data file.' ); $this->fatalError( 'Unable to find the specified data file.' );
} }
} }
$file = fopen( $dataFile, 'r' ); $file = fopen( $dataFile, 'r' );
if ( !$file ) { if ( !$file ) {
$this->fatalError( 'Unable to open the data file.' ); $this->fatalError( 'Unable to open the data file.' );
} }
// For the file format, see http://www.unicode.org/reports/tr44/ // For the file format, see https://www.unicode.org/reports/tr44/
$fieldNames = [ $fieldNames = [
'Code', 'Code',
'Name', 'Name',
'General_Category', 'General_Category',
'Canonical_Combining_Class', 'Canonical_Combining_Class',
'Bidi_Class', 'Bidi_Class',
'Decomposition_Type_Mapping', 'Decomposition_Type_Mapping',
'Numeric_Type_Value_6', 'Numeric_Type_Value_6',
'Numeric_Type_Value_7', 'Numeric_Type_Value_7',
'Numeric_Type_Value_8', 'Numeric_Type_Value_8',
skipping to change at line 125 skipping to change at line 130
continue; continue;
} }
$source = UtfNormal\Utils::hexSequenceToUtf8( $da ta['Code'] ); $source = UtfNormal\Utils::hexSequenceToUtf8( $da ta['Code'] );
$dest = UtfNormal\Utils::hexSequenceToUtf8( $m[2] ); $dest = UtfNormal\Utils::hexSequenceToUtf8( $m[2] );
$pairs[$source] = $dest; $pairs[$source] = $dest;
} }
} }
global $IP; global $IP;
file_put_contents( "$IP/serialized/normalize-ar.ser", serialize( $writer = new StaticArrayWriter();
$pairs ) ); file_put_contents( "$IP/languages/data/normalize-ar.php", $writer
->create(
$pairs,
'File created by generateNormalizerDataAr.php'
) );
echo "ar: " . count( $pairs ) . " pairs written.\n"; echo "ar: " . count( $pairs ) . " pairs written.\n";
} }
} }
$maintClass = GenerateNormalizerDataAr::class; $maintClass = GenerateNormalizerDataAr::class;
require_once RUN_MAINTENANCE_IF_MAIN; require_once RUN_MAINTENANCE_IF_MAIN;
 End of changes. 4 change blocks. 
4 lines changed or deleted 15 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)