r97452 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97451‎ | r97452 | r97453 >
Date:06:07, 19 September 2011
Author:nikerabbit
Status:deferred
Tags:
Comment:
Made groupStatistics.php more efficient
Fixed a bug in MessageGroupStats::forItem which caused database errors - do the same as in forGroup and expand the group ids to include subgroups
Modified paths:
  • /trunk/extensions/Translate/scripts/groupStatistics.php (modified) (history)
  • /trunk/extensions/Translate/utils/MessageGroupStats.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/scripts/groupStatistics.php
@@ -373,6 +373,8 @@
374374 }
375375
376376 foreach ( $groups as $groupName => $g ) {
 377+ $stats = MessageGroupStats::forGroup( $groupName );
 378+
377379 // Perform the statistic calculations on every language
378380 foreach ( $languages as $code => $name ) {
379381 // Skip list
@@ -390,7 +392,7 @@
391393 continue;
392394 }
393395
394 - list( $total, $translated, $fuzzy ) = MessageGroupStats::forItem( $groupName, $code );
 396+ list( $total, $translated, $fuzzy ) = $stats[$code];
395397
396398 $rows[$code][] = array( false, $translated, $total );
397399
Index: trunk/extensions/Translate/utils/MessageGroupStats.php
@@ -40,9 +40,10 @@
4141 * @return Array
4242 */
4343 public static function forItem( $id, $code ) {
44 - $stats = array();
45 - $res = self::selectRowsIdLang( $id, $code );
46 - $stats = self::extractResults( $res, $stats );
 44+ $group = MessageGroups::getGroup( $id );
 45+ $ids = array_unique( self::expandAggregates( $group ) );
 46+ $res = self::selectRowsIdLang( $ids, $code );
 47+ $stats = self::extractResults( $res );
4748
4849 $group = MessageGroups::getGroup( $id );
4950

Status & tagging log