36 $result = Shell::command(
37 [
'node',
$IP .
'/maintenance/mediawiki.Title/generateJsToUpperCaseList.js' ]
40 ->limits( [
'memory' => 1024 * 1024 ] )
43 if ( $result->getExitCode() !== 0 ) {
44 $this->
output( $result->getStderr() );
48 $jsUpperChars = json_decode( $result->getStdout() );
49 '@phan-var string[] $jsUpperChars';
52 for ( $i = 0; $i <= 0x10ffff; $i++ ) {
53 if ( $i >= 0xd800 && $i <= 0xdfff ) {
57 $char = \UtfNormal\Utils::codepointToUtf8( $i );
58 $phpUpper = $contentLanguage->ucfirst( $char );
59 $jsUpper = $jsUpperChars[$i];
60 if ( $jsUpper !== $phpUpper ) {
61 if ( $char === $phpUpper ) {
66 $data[$char] = $phpUpper;
71 $mappingJson = str_replace(
' ',
"\t",
72 json_encode( $data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE )
74 $outputPath =
'/resources/src/mediawiki.Title/phpCharToUpper.json';
75 $file = fopen(
$IP . $outputPath,
'w' );
77 $this->
fatalError(
"Unable to write file \"$IP$outputPath\"" );
79 fwrite( $file, $mappingJson );
81 $this->
output( count( $data ) .
" differences found.\n" );
82 $this->
output(
"Written to $outputPath\n" );