r60013 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60012‎ | r60013 | r60014 >
Date:20:17, 13 December 2009
Author:ialex
Status:ok
Tags:
Comment:
* (bug 20765) Special:ListGroupRights no longer misses addables and removables groups if there are duplicate entries
I could reproduce the problem locally, but since I don't know the exact issue on the Polish Wikipedia, I suspect this is this one:
array_unique() doesn't change keys, so if you have:
array(
0 => 'One',
1 => 'One',
2 => 'Two'
)
you'll get after array_unique():
array(
0 => 'One',
2 => 'Two'
)
which confuses Language::listToText() since it expects consecutive keys
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/specials/SpecialListgrouprights.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialListgrouprights.php
@@ -150,25 +150,25 @@
151151 if( $add === true ){
152152 $r[] = wfMsgExt( 'listgrouprights-addgroup-all', array( 'escape' ) );
153153 } else if( is_array( $add ) && count( $add ) ) {
154 - $add = array_unique( $add );
 154+ $add = array_values( array_unique( $add ) );
155155 $r[] = wfMsgExt( 'listgrouprights-addgroup', array( 'parseinline' ), $wgLang->listToText( array_map( array( 'User', 'makeGroupLinkWiki' ), $add ) ), count( $add ) );
156156 }
157157 if( $remove === true ){
158158 $r[] = wfMsgExt( 'listgrouprights-removegroup-all', array( 'escape' ) );
159159 } else if( is_array( $remove ) && count( $remove ) ) {
160 - $remove = array_unique( $remove );
 160+ $remove = array_values( array_unique( $remove ) );
161161 $r[] = wfMsgExt( 'listgrouprights-removegroup', array( 'parseinline' ), $wgLang->listToText( array_map( array( 'User', 'makeGroupLinkWiki' ), $remove ) ), count( $remove ) );
162162 }
163163 if( $addSelf === true ){
164164 $r[] = wfMsgExt( 'listgrouprights-addgroup-self-all', array( 'escape' ) );
165165 } else if( is_array( $addSelf ) && count( $addSelf ) ) {
166 - $addSelf = array_unique( $addSelf );
 166+ $addSelf = array_values( array_unique( $addSelf ) );
167167 $r[] = wfMsgExt( 'listgrouprights-addgroup-self', array( 'parseinline' ), $wgLang->listToText( array_map( array( 'User', 'makeGroupLinkWiki' ), $addSelf ) ), count( $addSelf ) );
168168 }
169169 if( $removeSelf === true ){
170170 $r[] = wfMsgExt( 'listgrouprights-removegroup-self-all', array( 'escape' ) );
171171 } else if( is_array( $removeSelf ) && count( $removeSelf ) ) {
172 - $removeSelf = array_unique( $removeSelf );
 172+ $removeSelf = array_values( array_unique( $removeSelf ) );
173173 $r[] = wfMsgExt( 'listgrouprights-removegroup-self', array( 'parseinline' ), $wgLang->listToText( array_map( array( 'User', 'makeGroupLinkWiki' ), $removeSelf ) ), count( $removeSelf ) );
174174 }
175175 if( empty( $r ) ) {
Index: trunk/phase3/RELEASE-NOTES
@@ -678,6 +678,8 @@
679679 * (bug 21803) Special:MyContributions now keeps the query string parameters
680680 * Redirecting special pages now keep query string paramters set to "0" (e.g.
681681 for namespace)
 682+* (bug 20765) Special:ListGroupRights no longer misses addables and removables
 683+ groups if there are duplicate entries
682684
683685 == API changes in 1.16 ==
684686

Status & tagging log