http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97452
Revision: 97452
Author: nikerabbit
Date: 2011-09-19 06:07:44 +0000 (Mon, 19 Sep 2011)
Log Message:
-----------
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
trunk/extensions/Translate/utils/MessageGroupStats.php
Modified: trunk/extensions/Translate/scripts/groupStatistics.php
===================================================================
--- trunk/extensions/Translate/scripts/groupStatistics.php 2011-09-19
05:56:03 UTC (rev 97451)
+++ trunk/extensions/Translate/scripts/groupStatistics.php 2011-09-19
06:07:44 UTC (rev 97452)
@@ -373,6 +373,8 @@
}
foreach ( $groups as $groupName => $g ) {
+ $stats = MessageGroupStats::forGroup( $groupName );
+
// Perform the statistic calculations on every language
foreach ( $languages as $code => $name ) {
// Skip list
@@ -390,7 +392,7 @@
continue;
}
- list( $total, $translated, $fuzzy ) =
MessageGroupStats::forItem( $groupName, $code );
+ list( $total, $translated, $fuzzy ) = $stats[$code];
$rows[$code][] = array( false, $translated, $total );
Modified: trunk/extensions/Translate/utils/MessageGroupStats.php
===================================================================
--- trunk/extensions/Translate/utils/MessageGroupStats.php 2011-09-19
05:56:03 UTC (rev 97451)
+++ trunk/extensions/Translate/utils/MessageGroupStats.php 2011-09-19
06:07:44 UTC (rev 97452)
@@ -40,9 +40,10 @@
* @return Array
*/
public static function forItem( $id, $code ) {
- $stats = array();
- $res = self::selectRowsIdLang( $id, $code );
- $stats = self::extractResults( $res, $stats );
+ $group = MessageGroups::getGroup( $id );
+ $ids = array_unique( self::expandAggregates( $group ) );
+ $res = self::selectRowsIdLang( $ids, $code );
+ $stats = self::extractResults( $res );
$group = MessageGroups::getGroup( $id );
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs