http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97486

Revision: 97486
Author:   nikerabbit
Date:     2011-09-19 13:17:27 +0000 (Mon, 19 Sep 2011)
Log Message:
-----------
Delay loading info about subgroups until necessary. This way we can avoid 
loading loooots of useless data when viewing stats for aggregate message groups 
with hundreds of members.

Modified Paths:
--------------
    trunk/extensions/Translate/utils/MessageGroupStats.php

Modified: trunk/extensions/Translate/utils/MessageGroupStats.php
===================================================================
--- trunk/extensions/Translate/utils/MessageGroupStats.php      2011-09-19 
13:10:42 UTC (rev 97485)
+++ trunk/extensions/Translate/utils/MessageGroupStats.php      2011-09-19 
13:17:27 UTC (rev 97486)
@@ -41,8 +41,7 @@
         */
        public static function forItem( $id, $code ) {
                $group = MessageGroups::getGroup( $id );
-               $ids = array_unique( self::expandAggregates( $group ) );
-               $res = self::selectRowsIdLang( $ids, $code );
+               $res = self::selectRowsIdLang( $id, $code );
                $stats = self::extractResults( $res );
 
                $group = MessageGroups::getGroup( $id );
@@ -190,12 +189,11 @@
        
 
        protected static function forGroupInternal( $group, $stats = array() ) {
-               $ids = array_unique( self::expandAggregates( $group ) );
-               $res = self::selectRowsIdLang( $ids, null );
+               $id = $group->getId();
+               $res = self::selectRowsIdLang( $id, null );
                $stats = self::extractResults( $res, $stats );
 
                # Go over each language filling missing entries
-               $id = $group->getId();
                $languages = array_keys( Language::getLanguageNames( false ) );
                foreach ( $languages as $code ) {
                        if ( isset( $stats[$id][$code] ) ) continue;
@@ -228,6 +226,10 @@
                }
 
                if ( $group instanceof AggregateMessageGroup ) {
+                       $ids = array_unique( self::expandAggregates( $group ) );
+                       $res = self::selectRowsIdLang( $ids, $code );
+                       $stats = self::extractResults( $res, $stats );
+                       
                        $aggregates = array( 0, 0, 0 );
                        foreach ( $group->getGroups() as $sid => $sgroup ) {
                                if ( !isset( $stats[$sid][$code] ) ) {


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to