r73934 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73933‎ | r73934 | r73935 >
Date:07:38, 29 September 2010
Author:nikerabbit
Status:ok
Tags:
Comment:
Start cleaning up MessageGroups (class) api by introducing static getAllGroups()
Modified paths:
  • /trunk/extensions/Translate/MessageGroups.php (modified) (history)
  • /trunk/extensions/Translate/TranslatePage.php (modified) (history)
  • /trunk/extensions/Translate/api/ApiQueryMessageCollection.php (modified) (history)
  • /trunk/extensions/Translate/api/ApiQueryMessageGroups.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/TranslatePage.php
@@ -238,7 +238,7 @@
239239 /* Selectors ahead */
240240
241241 protected function groupSelector() {
242 - $groups = MessageGroups::singleton()->getGroups();
 242+ $groups = MessageGroups::getAllGroups();
243243 $selector = new HTMLSelector( 'group', 'group', $this->options['group'] );
244244
245245 foreach ( $groups as $id => $class ) {
@@ -403,7 +403,7 @@
404404 public function getGroupStructure() {
405405 global $wgTranslateGroupStructure;
406406
407 - $groups = MessageGroups::singleton()->getGroups();
 407+ $groups = MessageGroups::getAllGroups();
408408 $structure = array();
409409
410410 foreach ( $groups as $id => $o ) {
Index: trunk/extensions/Translate/MessageGroups.php
@@ -984,6 +984,14 @@
985985 }
986986 }
987987
 988+ /**
 989+ * Get all enabled message groups.
 990+ * @return \arrayof{String,MessageGroup}
 991+ */
 992+ public static function getAllGroups() {
 993+ return self::singleton()->getGroups();
 994+ }
 995+
988996 /// @todo Make protected.
989997 public $classes;
990998 private function __construct() {
Index: trunk/extensions/Translate/api/ApiQueryMessageCollection.php
@@ -113,7 +113,7 @@
114114 public function getAllowedParams() {
115115 return array(
116116 'group' => array(
117 - ApiBase::PARAM_TYPE => array_keys( MessageGroups::singleton()->getGroups() ),
 117+ ApiBase::PARAM_TYPE => array_keys( MessageGroups::>getAllGroups() ),
118118 ApiBase::PARAM_REQUIRED => true,
119119 ),
120120 'language' => array(
@@ -173,7 +173,7 @@
174174 }
175175
176176 protected function getExamples() {
177 - $groups = MessageGroups::singleton()->getGroups();
 177+ $groups = MessageGroups::getAllGroups();
178178 $group = key( $groups );
179179
180180 return array(
Index: trunk/extensions/Translate/api/ApiQueryMessageGroups.php
@@ -25,7 +25,7 @@
2626
2727 public function execute() {
2828 $params = $this->extractRequestParams();
29 - $groups = MessageGroups::singleton()->getGroups();
 29+ $groups = MessageGroups::getAllGroups();
3030 $result = $this->getResult();
3131
3232 foreach ( $groups as $id => $g ) {

Status & tagging log