r110364 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110363‎ | r110364 | r110365 >
Date:07:54, 31 January 2012
Author:nikerabbit
Status:ok
Tags:
Comment:
[Bug 34028] Special:MessageGroupStats does not work for group IDs with spaces
Modified paths:
  • /trunk/extensions/Translate/specials/SpecialLanguageStats.php (modified) (history)
  • /trunk/extensions/Translate/specials/SpecialMessageGroupStats.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/specials/SpecialMessageGroupStats.php
@@ -36,9 +36,12 @@
3737 }
3838
3939 /// Overwritten from SpecialLanguageStats
40 - protected function getAllowedValues() {
41 - $groups = MessageGroups::getAllGroups();
42 - return array_keys( $groups );
 40+ protected function isValidValue( $value ) {
 41+ $group = MessageGroups::getGroup( $value );
 42+ if ( $group ) {
 43+ $this->target = $group->getId();
 44+ }
 45+ return (bool) $group;
4346 }
4447
4548 /// Overwritten from SpecialLanguageStats
Index: trunk/extensions/Translate/specials/SpecialLanguageStats.php
@@ -124,8 +124,7 @@
125125 $wgOut->addHTML( $this->getForm() );
126126 }
127127
128 - $allowedValues = $this->getAllowedValues();
129 - if ( in_array( $this->target, $allowedValues, true ) ) {
 128+ if ( $this->isValidValue( $this->target ) ) {
130129 $this->outputIntroduction();
131130 $output = $this->getTable();
132131 if ( $this->incomplete ) {
@@ -145,9 +144,9 @@
146145 * Return the list of allowed values for target here.
147146 * @return array
148147 */
149 - protected function getAllowedValues() {
 148+ protected function isValidValue( $value ) {
150149 $langs = Language::getLanguageNames( false );
151 - return array_keys( $langs );
 150+ return isset( $langs[$value] );
152151 }
153152
154153 /// Called when the target is unknown.

Follow-up revisions

RevisionCommit summaryAuthorDate
r110738MFT 1.18wmf1 r110309 r110364 r110408 r110471 r110475nikerabbit11:00, 6 February 2012

Status & tagging log