r36245 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36244‎ | r36245 | r36246 >
Date:19:21, 12 June 2008
Author:nikerabbit
Status:old
Tags:
Comment:
* Let meta groups claim messages left over from real groups
Modified paths:
  • /trunk/extensions/Translate/CreateMessageIndex.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/CreateMessageIndex.php
@@ -7,11 +7,27 @@
88 $groups = MessageGroups::singleton()->getGroups();
99
1010 $hugearray = array();
 11+$postponed = array();
1112
1213 foreach ( $groups as $g ) {
1314 # Skip meta thingies
14 - if ( $g->isMeta() ) continue;
 15+ if ( $g->isMeta() ) {
 16+ $postponed[] = $g;
 17+ continue;
 18+ }
1519
 20+ checkAndAdd( $g );
 21+}
 22+
 23+foreach ( $postponed as $g ) {
 24+ checkAndAdd( $g, true );
 25+}
 26+
 27+file_put_contents( TRANSLATE_INDEXFILE, serialize( $hugearray ) );
 28+
 29+function checkAndAdd( $g, $ignore = false ) {
 30+ global $hugearray;
 31+
1632 $messages = $g->getDefinitions();
1733 $id = $g->getId();
1834
@@ -30,12 +46,12 @@
3147 # mediawiki forces it to upper case
3248 $key = strtolower( "$namespace:$key" );
3349 if ( isset($hugearray[$key]) ) {
34 - echo "Key $key already belongs to $hugearray[$key], conflict with $id\n";
 50+ if ( !$ignore )
 51+ echo "Key $key already belongs to $hugearray[$key], conflict with $id\n";
3552 } else {
3653 $hugearray[$key] = &$id;
3754 }
3855 }
3956 unset($id); // Disconnect the previous references to this $id
40 -}
4157
42 -file_put_contents( TRANSLATE_INDEXFILE, serialize( $hugearray ) );
 58+}
\ No newline at end of file

Status & tagging log