http://www.mediawiki.org/wiki/Special:Code/MediaWiki/60013

Revision: 60013
Author:   ialex
Date:     2009-12-13 20:17:09 +0000 (Sun, 13 Dec 2009)

Log Message:
-----------
* (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
    trunk/phase3/includes/specials/SpecialListgrouprights.php

Modified: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES  2009-12-13 19:23:09 UTC (rev 60012)
+++ trunk/phase3/RELEASE-NOTES  2009-12-13 20:17:09 UTC (rev 60013)
@@ -678,6 +678,8 @@
 * (bug 21803) Special:MyContributions now keeps the query string parameters
 * Redirecting special pages now keep query string paramters set to "0" (e.g.
   for namespace)
+* (bug 20765) Special:ListGroupRights no longer misses addables and removables
+  groups if there are duplicate entries
 
 == API changes in 1.16 ==
 

Modified: trunk/phase3/includes/specials/SpecialListgrouprights.php
===================================================================
--- trunk/phase3/includes/specials/SpecialListgrouprights.php   2009-12-13 
19:23:09 UTC (rev 60012)
+++ trunk/phase3/includes/specials/SpecialListgrouprights.php   2009-12-13 
20:17:09 UTC (rev 60013)
@@ -150,25 +150,25 @@
                if( $add === true ){
                        $r[] = wfMsgExt( 'listgrouprights-addgroup-all', array( 
'escape' ) );
                } else if( is_array( $add ) && count( $add ) ) {
-                       $add = array_unique( $add );
+                       $add = array_values( array_unique( $add ) );
                        $r[] = wfMsgExt( 'listgrouprights-addgroup', array( 
'parseinline' ), $wgLang->listToText( array_map( array( 'User', 
'makeGroupLinkWiki' ), $add ) ), count( $add ) );
                }
                if( $remove === true ){
                        $r[] = wfMsgExt( 'listgrouprights-removegroup-all', 
array( 'escape' ) );
                } else if( is_array( $remove ) && count( $remove ) ) {
-                       $remove = array_unique( $remove );
+                       $remove = array_values( array_unique( $remove ) );
                        $r[] = wfMsgExt( 'listgrouprights-removegroup', array( 
'parseinline' ), $wgLang->listToText( array_map( array( 'User', 
'makeGroupLinkWiki' ), $remove ) ), count( $remove ) );
                }
                if( $addSelf === true ){
                        $r[] = wfMsgExt( 'listgrouprights-addgroup-self-all', 
array( 'escape' ) );
                } else if( is_array( $addSelf ) && count( $addSelf ) ) {
-                       $addSelf = array_unique( $addSelf );
+                       $addSelf = array_values( array_unique( $addSelf ) );
                        $r[] = wfMsgExt( 'listgrouprights-addgroup-self', 
array( 'parseinline' ), $wgLang->listToText( array_map( array( 'User', 
'makeGroupLinkWiki' ), $addSelf ) ), count( $addSelf ) );
                }
                if( $removeSelf === true ){
                        $r[] = wfMsgExt( 
'listgrouprights-removegroup-self-all', array( 'escape' ) );
                } else if( is_array( $removeSelf ) && count( $removeSelf ) ) {
-                       $removeSelf = array_unique( $removeSelf );
+                       $removeSelf = array_values( array_unique( $removeSelf ) 
);
                        $r[] = wfMsgExt( 'listgrouprights-removegroup-self', 
array( 'parseinline' ), $wgLang->listToText( array_map( array( 'User', 
'makeGroupLinkWiki' ), $removeSelf ) ), count( $removeSelf ) );
                }
                if( empty( $r ) ) {



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to