r62057 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62056‎ | r62057 | r62058 >
Date:01:50, 6 February 2010
Author:avar
Status:ok (Comments)
Tags:
Comment:
Fix regression introduced in r30117: Don's sort() the author list in
Special:Version

When extensions specify a list of authors they expect them to appear
in Special:Version as they're specified. Sorting lists on
Special:Version as introduced in r30117 makes sense for things like
the names of parser functions, but not authors.

Some extensions give arrays like array("foo", "bar", "others") and
expect output like "foo, bar and others". Sometimes (like in the case
of Maps.php) this would only incidentally work.

Furthermore in some cases the first author in the array indicates the
primary author, this is the case with CheckUser.php and other similar
extensions with multiple authors.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/specials/SpecialVersion.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialVersion.php
@@ -307,7 +307,7 @@
308308 }
309309 $author = isset ( $extension['author'] ) ? $extension['author'] : array();
310310 $extDescAuthor = "<td>$description</td>
311 - <td>" . $this->listToText( (array)$author ) . "</td>
 311+ <td>" . $this->listToText( (array)$author, false ) . "</td>
312312 </tr>\n";
313313 return $extNameVer . $extDescAuthor;
314314 }
@@ -369,9 +369,10 @@
370370
371371 /**
372372 * @param array $list
 373+ * @param bool $sort
373374 * @return string
374375 */
375 - function listToText( $list ) {
 376+ function listToText( $list, $sort = true ) {
376377 $cnt = count( $list );
377378
378379 if ( $cnt == 1 ) {
@@ -381,7 +382,9 @@
382383 return '';
383384 } else {
384385 global $wgLang;
385 - sort( $list );
 386+ if ( $sort ) {
 387+ sort( $list );
 388+ }
386389 return $wgLang->listToText( array_map( array( __CLASS__, 'arrayToString' ), $list ) );
387390 }
388391 }
Index: trunk/phase3/RELEASE-NOTES
@@ -741,6 +741,10 @@
742742 * (bug 21593) Special:UserRights now lists automatic groups membership
743743 * (bug 22364) Setting $wgUseExternalEditor to false no longer hides the reupload
744744 link from file pages
 745+* Fix bug introduced in MediaWiki 1.12: The author field in
 746+ $wgExtensionCredits is no longer sorted with sort() but rather used
 747+ as it appears in extensions as was the case before r30117 where it
 748+ was unintentionally sorted along with other fields.
745749
746750 == API changes in 1.16 ==
747751

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r30117* Sort elements by alphabet...raymond12:57, 24 January 2008

Comments

#Comment by Jeroen De Dauw (talk | contribs)   03:23, 2 August 2010

Thanks, I wondered what happened here :)

Status & tagging log