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.
This commit is contained in:
Ævar Arnfjörð Bjarmason 2010-02-06 01:50:30 +00:00
parent a5933a3aeb
commit 3fcec28299
2 changed files with 10 additions and 3 deletions

View file

@ -741,6 +741,10 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
* (bug 21593) Special:UserRights now lists automatic groups membership
* (bug 22364) Setting $wgUseExternalEditor to false no longer hides the reupload
link from file pages
* Fix bug introduced in MediaWiki 1.12: The author field in
$wgExtensionCredits is no longer sorted with sort() but rather used
as it appears in extensions as was the case before r30117 where it
was unintentionally sorted along with other fields.
== API changes in 1.16 ==

View file

@ -307,7 +307,7 @@ class SpecialVersion extends SpecialPage {
}
$author = isset ( $extension['author'] ) ? $extension['author'] : array();
$extDescAuthor = "<td>$description</td>
<td>" . $this->listToText( (array)$author ) . "</td>
<td>" . $this->listToText( (array)$author, false ) . "</td>
</tr>\n";
return $extNameVer . $extDescAuthor;
}
@ -369,9 +369,10 @@ class SpecialVersion extends SpecialPage {
/**
* @param array $list
* @param bool $sort
* @return string
*/
function listToText( $list ) {
function listToText( $list, $sort = true ) {
$cnt = count( $list );
if ( $cnt == 1 ) {
@ -381,7 +382,9 @@ class SpecialVersion extends SpecialPage {
return '';
} else {
global $wgLang;
sort( $list );
if ( $sort ) {
sort( $list );
}
return $wgLang->listToText( array_map( array( __CLASS__, 'arrayToString' ), $list ) );
}
}