aboutsummaryrefslogtreecommitdiffstats
path: root/includes/api/ApiQueryBase.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/api/ApiQueryBase.php')
-rw-r--r--includes/api/ApiQueryBase.php9
1 files changed, 4 insertions, 5 deletions
diff --git a/includes/api/ApiQueryBase.php b/includes/api/ApiQueryBase.php
index daadcaad1771..49db0c2ced7d 100644
--- a/includes/api/ApiQueryBase.php
+++ b/includes/api/ApiQueryBase.php
@@ -214,11 +214,10 @@ abstract class ApiQueryBase extends ApiBase {
if ( $sort ) {
$order = $field . ( $isDirNewer ? '' : ' DESC' );
- if ( !isset( $this->options['ORDER BY'] ) ) {
- $this->addOption( 'ORDER BY', $order );
- } else {
- $this->addOption( 'ORDER BY', $this->options['ORDER BY'] . ', ' . $order );
- }
+ // Append ORDER BY
+ $optionOrderBy = isset( $this->options['ORDER BY'] ) ? (array)$this->options['ORDER BY'] : array();
+ $optionOrderBy[] = $order;
+ $this->addOption( 'ORDER BY', $optionOrderBy );
}
}