r112812 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112811‎ | r112812 | r112813 >
Date:15:20, 1 March 2012
Author:siebrand
Status:reverted
Tags:
Comment:
Revert r112787: Broke exports.

Example:
Command:
php export.php --target=$EXPORTPATH --groupprefix=out-osm- --lang='*' --skip=en,qqq --threshold=35

Output:
$ bxa osm
Exporting OpenStreetMap potlatch and site with 35%+
Skipping meta message group out-osm-0-all
Exporting out-osm-0-all
$

It shouldn't have tried to calculate translation percentages of aggregate groups, but skipped them immediately.
Modified paths:
  • /trunk/extensions/Translate/MessageGroups.php (modified) (history)
  • /trunk/extensions/Translate/scripts/export.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/scripts/export.php
@@ -109,16 +109,12 @@
110110
111111 foreach ( $groups as $groupId => $group ) {
112112 if ( !$group instanceof MessageGroup ) {
113 - STDERR( "Unknown message group $groupId" );
 113+ STDERR( "Invalid group: " . $groupId );
114114 exit( 1 );
115115 }
116116
117 - if ( $group->isMeta() ) {
118 - STDERR( "Skipping meta message group $groupId" );
119 - }
 117+ STDERR( 'Exporting ' . $groupId );
120118
121 - STDERR( "Exporting $groupId" );
122 -
123119 $langs = $reqLangs;
124120 if ( $threshold ) {
125121 $stats = MessageGroupStats::forGroup( $groupId );
Index: trunk/extensions/Translate/MessageGroups.php
@@ -1333,17 +1333,22 @@
13341334 /**
13351335 * Get message groups for corresponding message group ids.
13361336 *
1337 - * @param $ids array of message group ids
1338 - * @return array array of message groups indexed by message group ids
 1337+ * @param $ids array Group IDs
 1338+ * @param $skipMeta bool Skip aggregate message groups
 1339+ * @return array
13391340 * @since 2012-02-13
13401341 */
1341 - public static function getGroupsById( array $ids ) {
 1342+ public static function getGroupsById( array $ids, $skipMeta = false ) {
13421343 $groups = array();
13431344 foreach ( $ids as $id ) {
13441345 $group = self::getGroup( $id );
13451346
13461347 if ( $group !== null ) {
1347 - $groups[$id] = $group;
 1348+ if ( $skipMeta && $group->isMeta() ) {
 1349+ continue;
 1350+ } else {
 1351+ $groups[$id] = $group;
 1352+ }
13481353 } else {
13491354 wfDebug( __METHOD__ . ": Invalid message group id: $id\n" );
13501355 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r112814Reverted the reversion of r112787 in rr112812 and add the missing continuenikerabbit15:28, 1 March 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r112787Followup r111456. Move the complexity to caller and keep other code "clean".nikerabbit10:33, 1 March 2012

Status & tagging log