r111359 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111358‎ | r111359 | r111360 >
Date:10:42, 13 February 2012
Author:nikerabbit
Status:ok
Tags:
Comment:
Remove code duplication
Modified paths:
  • /trunk/extensions/Translate/Groups.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/Groups.php
@@ -605,7 +605,7 @@
606606 if ( !isset( $this->groups ) ) {
607607 $groups = array();
608608 $ids = (array) $this->conf['GROUPS'];
609 - $ids = $this->expandWildcards( $ids );
 609+ $ids = MessageGroups::expandWildcards( $ids );
610610
611611 foreach ( $ids as $id ) {
612612 // Do not try to include self and go to infinite loop.
@@ -632,38 +632,6 @@
633633 return $this->groups;
634634 }
635635
636 - /**
637 - * If the list of group ids contains wildcards, this function will match
638 - * them against the list of all supported groups and return matched group
639 - * names.
640 - * @param $ids \list{String}
641 - * @return \list{String}
642 - */
643 - protected function expandWildcards( $ids ) {
644 - $hasWild = false;
645 -
646 - foreach ( $ids as $id ) {
647 - if ( strpos( $id, '*' ) !== false ) {
648 - $hasWild = true;
649 - break;
650 - }
651 - }
652 -
653 - if ( !$hasWild ) {
654 - return $ids;
655 - }
656 -
657 - $matcher = new StringMatcher( '', $ids );
658 - $all = array();
659 -
660 - foreach ( MessageGroups::singleton()->getGroups() as $id => $_ ) {
661 - if ( $matcher->match( $id ) ) {
662 - $all[] = $id;
663 - }
664 - }
665 - return $all;
666 - }
667 -
668636 protected function loadMessagesFromCache( $groups ) {
669637 $messages = array();
670638 foreach ( $groups as $group ) {

Status & tagging log