Merge "Provide RequestContext from fixDoubleRedirects"
[lhc/web/wiklou.git] / maintenance / language / generateCollationData.php
index 12823c0..db6c315 100644 (file)
@@ -21,7 +21,7 @@
  * @ingroup MaintenanceLanguage
  */
 
-require_once( __DIR__ .'/../Maintenance.php' );
+require_once __DIR__ . '/../Maintenance.php';
 
 /**
  * Generate first letter data files for Collation.php
@@ -102,7 +102,7 @@ class GenerateCollationData extends Maintenance {
                                $error .= "You are using outdated version of ICU ($icuVersion), intended for "
                                        . ( $unicodeVersion ? "Unicode $unicodeVersion" : "an unknown version of Unicode" )
                                        . "; this file might not be avalaible for it, and it's not supported by MediaWiki. "
-                                       ." You are on your own; consider upgrading PHP's intl extension or try "
+                                       . " You are on your own; consider upgrading PHP's intl extension or try "
                                        . "one of the files available at:";
                        } elseif ( version_compare( $icuVersion, "51.0", ">=" ) ) {
                                // Extra recent version
@@ -158,7 +158,8 @@ class GenerateCollationData extends Maintenance {
                // people like to use that as a fake no header symbol.
                $category = substr( $data['gc'], 0, 1 );
                if ( strpos( 'LNPS', $category ) === false
-                       && $data['cp'] !== '0020' ) {
+                       && $data['cp'] !== '0020'
+               ) {
                        return;
                }
                $cp = hexdec( $data['cp'] );
@@ -178,8 +179,8 @@ class GenerateCollationData extends Maintenance {
                // Calculate implicit weight per UTS #10 v6.0.0, sec 7.1.3
                if ( $data['UIdeo'] === 'Y' ) {
                        if ( $data['block'] == 'CJK Unified Ideographs'
-                               || $data['block'] == 'CJK Compatibility Ideographs' )
-                       {
+                               || $data['block'] == 'CJK Compatibility Ideographs'
+                       {
                                $base = 0xFB40;
                        } else {
                                $base = 0xFB80;
@@ -248,8 +249,8 @@ class GenerateCollationData extends Maintenance {
                        }
                        $this->weights[$cp] = $primary;
                        if ( $tertiary === '.0008'
-                               || $tertiary === '.000E' )
-                       {
+                               || $tertiary === '.000E'
+                       {
                                $goodTertiaryChars[$cp] = true;
                        }
                }
@@ -325,7 +326,7 @@ class GenerateCollationData extends Maintenance {
                        $char = codepointToUtf8( $cp );
                        $headerChars[] = $char;
                        if ( $primaryCollator->compare( $char, $prevChar ) <= 0 ) {
-                               $numOutOfOrder ++;
+                               $numOutOfOrder++;
                                /*
                                printf( "Out of order: U+%05X > U+%05X\n",
                                        utf8ToCodepoint( $prevChar ),
@@ -386,10 +387,11 @@ class UcdXmlReader {
                $this->xml = new XMLReader;
                $this->xml->open( $this->fileName );
                if ( !$this->xml ) {
-                       throw new MWException( __METHOD__.": unable to open {$this->fileName}" );
+                       throw new MWException( __METHOD__ . ": unable to open {$this->fileName}" );
                }
                while ( $this->xml->name !== 'ucd' && $this->xml->read() );
                $this->xml->read();
+
                return $this->xml;
        }
 
@@ -403,6 +405,7 @@ class UcdXmlReader {
                while ( $this->xml->moveToNextAttribute() ) {
                        $attrs[$this->xml->name] = $this->xml->value;
                }
+
                return $attrs;
        }
 
@@ -460,10 +463,10 @@ class UcdXmlReader {
                        }
                }
                $xml->close();
+
                return $this->blocks;
        }
-
 }
 
 $maintClass = 'GenerateCollationData';
-require_once( RUN_MAINTENANCE_IF_MAIN );
+require_once RUN_MAINTENANCE_IF_MAIN;