50 $result = Shell::command(
51 [
'node',
$IP .
'/maintenance/mediawiki.Title/generateJsToUpperCaseList.js' ]
54 ->limits( [
'memory' => 1024 * 1024 ] )
57 if ( $result->getExitCode() !== 0 ) {
58 $this->
output( $result->getStderr() );
62 $jsUpperChars = json_decode( $result->getStdout() );
63 '@phan-var string[] $jsUpperChars';
66 for ( $i = 0; $i <= 0x10ffff; $i++ ) {
67 if ( $i >= 0xd800 && $i <= 0xdfff ) {
71 $char = \UtfNormal\Utils::codepointToUtf8( $i );
72 $phpUpper = $contentLanguage->ucfirst( $char );
73 $jsUpper = $jsUpperChars[$i];
74 if ( $jsUpper !== $phpUpper ) {
75 if ( $char === $phpUpper ) {
80 $data[$char] = $phpUpper;
85 $mappingJson = str_replace(
' ',
"\t",
86 json_encode( $data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE )
88 $outputPath =
'/resources/src/mediawiki.Title/phpCharToUpper.json';
89 $file = fopen(
$IP . $outputPath,
'w' );
91 $this->
fatalError(
"Unable to write file \"$IP$outputPath\"" );
93 fwrite( $file, $mappingJson );
95 $this->
output( count( $data ) .
" differences found.\n" );
96 $this->
output(
"Written to $outputPath\n" );