From: Gergő Tisza Date: Fri, 26 Jul 2019 17:51:26 +0000 (+0200) Subject: QueryPage: allow arbitrary sorting X-Git-Tag: 1.34.0-rc.0~858^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22auteur_infos%22%2C%20%22id_auteur=%24id%22%29%20.%20%22?a=commitdiff_plain;h=2ba42f237449780ab61071132155f7649d723bbb;p=lhc%2Fweb%2Fwiklou.git QueryPage: allow arbitrary sorting When the value field is not provided in QueryPage::getQueryInfo, it is set to zero, essentially randomizing the result. Use a sequential index instead. Change-Id: I8b67268e3c59a51ed00bd832f80df184dd771c3b --- diff --git a/includes/specialpage/QueryPage.php b/includes/specialpage/QueryPage.php index eb179bf310..223f799cb1 100644 --- a/includes/specialpage/QueryPage.php +++ b/includes/specialpage/QueryPage.php @@ -312,7 +312,7 @@ abstract class QueryPage extends SpecialPage { $num = $res->numRows(); # Fetch results $vals = []; - foreach ( $res as $row ) { + foreach ( $res as $i => $row ) { if ( isset( $row->value ) ) { if ( $this->usesTimestamps() ) { $value = wfTimestamp( TS_UNIX, @@ -321,7 +321,7 @@ abstract class QueryPage extends SpecialPage { $value = intval( $row->value ); // T16414 } } else { - $value = 0; + $value = $i; } $vals[] = [