https://www.mediawiki.org/wiki/Special:Code/MediaWiki/111456
Revision: 111456 Author: siebrand Date: 2012-02-14 12:45:51 +0000 (Tue, 14 Feb 2012) Log Message: ----------- * update documentation. * add skipMeta parameter to MessageGroup::getGroupsById() to all filtering out aggregate groups. * update export.php to use skipMeta to avoid fatal error. Modified Paths: -------------- trunk/extensions/Translate/MessageGroups.php trunk/extensions/Translate/scripts/export.php Modified: trunk/extensions/Translate/MessageGroups.php =================================================================== --- trunk/extensions/Translate/MessageGroups.php 2012-02-14 09:59:59 UTC (rev 111455) +++ trunk/extensions/Translate/MessageGroups.php 2012-02-14 12:45:51 UTC (rev 111456) @@ -1319,18 +1319,22 @@ /** * Get message groups for corresponding message group ids. * - * @param $groups array Group IDs - * @param $groupPrefix string Prefix for groups + * @param $ids array Group IDs + * @param $skipMeta bool Skip aggregate message groups * @return array * @since 2012-02-13 */ - public static function getGroupsById( array $ids ) { + public static function getGroupsById( array $ids, $skipMeta = false ) { $groups = array(); foreach ( $ids as $id ) { $group = self::getGroup( $id ); if ( $group !== null ) { - $groups[$id] = $group; + if( $group->isMeta() && $skipMeta ) { + continue; + } else { + $groups[$id] = $group; + } } else { wfDebug( __METHOD__ . ": Invalid message group id: $id\n" ); } Modified: trunk/extensions/Translate/scripts/export.php =================================================================== --- trunk/extensions/Translate/scripts/export.php 2012-02-14 09:59:59 UTC (rev 111455) +++ trunk/extensions/Translate/scripts/export.php 2012-02-14 12:45:51 UTC (rev 111456) @@ -98,8 +98,9 @@ if ( isset( $options['group'] ) ) { $groupIds = explode( ',', trim( $options['group'] ) ); } + $groupIds = MessageGroups::expandWildcards( $groupIds ); -$groups = MessageGroups::getGroupsById( $groupIds ); +$groups = MessageGroups::getGroupsById( $groupIds, true ); if ( !count( $groups ) ) { STDERR( "EE1: No valid message groups identified." ); _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs