generatePhpCharToUpperMappings: Die if fopen fails
authorFomafix <fomafix@googlemail.com>
Wed, 18 Sep 2019 19:46:42 +0000 (21:46 +0200)
committerFomafix <fomafix@googlemail.com>
Thu, 19 Sep 2019 07:38:23 +0000 (09:38 +0200)
This prevents additional errors in the following code.

Change-Id: I27770e6ca09c495ec7b6cb588c251b4014697bfe

maintenance/mediawiki.Title/generatePhpCharToUpperMappings.php

index e1a50ea..9fc5513 100755 (executable)
@@ -82,6 +82,9 @@ class GeneratePhpCharToUpperMappings extends Maintenance {
                ) . "\n";
                $outputPath = '/resources/src/mediawiki.Title/phpCharToUpper.json';
                $file = fopen( $IP . $outputPath, 'w' );
                ) . "\n";
                $outputPath = '/resources/src/mediawiki.Title/phpCharToUpper.json';
                $file = fopen( $IP . $outputPath, 'w' );
+               if ( !$file ) {
+                       $this->fatalError( "Unable to write file \"$IP$outputPath\"" );
+               }
                fwrite( $file, $mappingJson );
 
                $this->output( count( $data ) . " differences found.\n" );
                fwrite( $file, $mappingJson );
 
                $this->output( count( $data ) . " differences found.\n" );