32 $result = Shell::command(
33 [
'node', MW_INSTALL_PATH .
'/maintenance/mediawiki.Title/generateJsToUpperCaseList.js' ]
36 ->limits( [
'memory' => 1024 * 1024 ] )
39 if ( $result->getExitCode() !== 0 ) {
40 $this->
output( $result->getStderr() );
44 $jsUpperChars = json_decode( $result->getStdout() );
45 '@phan-var string[] $jsUpperChars';
50 for ( $i = 0; $i <= 0x10ffff; $i++ ) {
51 if ( $i >= 0xd800 && $i <= 0xdfff ) {
55 $char = \UtfNormal\Utils::codepointToUtf8( $i );
56 $phpUpper = $contentLanguage->ucfirst( $char );
57 $jsUpper = $jsUpperChars[$i];
58 if ( $jsUpper !== $phpUpper ) {
59 if ( $char === $phpUpper ) {
64 $data[$char] = $phpUpper;
69 $mappingJson = str_replace(
' ',
"\t",
70 json_encode( $data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE )
72 $outputPath =
'/resources/src/mediawiki.Title/phpCharToUpper.json';
73 $file = fopen( MW_INSTALL_PATH . $outputPath,
'w' );
75 $this->
fatalError(
"Unable to write file \"$outputPath\"" );
77 fwrite( $file, $mappingJson );
79 $this->
output( count( $data ) .
" differences found.\n" );
80 $this->
output(
"Written to $outputPath\n" );