28 require_once __DIR__ .
'/../Maintenance.php';
39 parent::__construct();
40 $this->
addDescription(
'Update list of upper case differences between JS and PHP.' );
48 $result = Shell::command(
49 [
'node',
$IP .
'/maintenance/mediawiki.Title/generateJsToUpperCaseList.js' ]
52 ->limits( [
'memory' => 1024 * 1024 ] )
55 if ( $result->getExitCode() !== 0 ) {
56 $this->
output( $result->getStderr() );
60 $jsUpperChars = json_decode( $result->getStdout() );
61 '@phan-var string[] $jsUpperChars';
63 for ( $i = 0; $i <= 0x10ffff; $i++ ) {
64 if ( $i >= 0xd800 && $i <= 0xdfff ) {
68 $char = \UtfNormal\Utils::codepointToUtf8( $i );
69 $phpUpper = MediaWikiServices::getInstance()->getContentLanguage()->ucfirst( $char );
70 $jsUpper = $jsUpperChars[$i];
71 if ( $jsUpper !== $phpUpper ) {
72 if ( $char === $phpUpper ) {
77 $data[$char] = $phpUpper;
82 $mappingJson = str_replace(
' ',
"\t",
83 json_encode( $data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE )
85 $outputPath =
'/resources/src/mediawiki.Title/phpCharToUpper.json';
86 $file = fopen(
$IP . $outputPath,
'w' );
88 $this->
fatalError(
"Unable to write file \"$IP$outputPath\"" );
90 fwrite(
$file, $mappingJson );
92 $this->
output( count( $data ) .
" differences found.\n" );
93 $this->
output(
"Written to $outputPath\n" );
98 require_once RUN_MAINTENANCE_IF_MAIN;
if(!defined( 'MEDIAWIKI')) if(ini_get( 'mbstring.func_overload')) if(!defined( 'MW_ENTRY_POINT')) global $IP
Environment checks.
Update list of upper case differences between JS and PHP.
execute()
Do the actual work.
__construct()
Default constructor.
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
output( $out, $channel=null)
Throw some output to the user.
addDescription( $text)
Set the description text.
fatalError( $msg, $exitCode=1)
Output a message and terminate the current script.
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.