(bug 35855) fix min and max parameters in list=allcategories
authorPetr Onderka <gsvick@gmail.com>
Mon, 16 Apr 2012 18:40:00 +0000 (20:40 +0200)
committerPetr Onderka <gsvick@gmail.com>
Mon, 16 Apr 2012 18:43:17 +0000 (20:43 +0200)
API queries for list=allcategories with acdir=descending had the
acmin and acmax parameters in reverse, that is min behaved like max
and max behaved like min. This patch fixes the issue.

Change-Id: If6346b682782856ffa5b15d08abd1b2ecc50424c

includes/api/ApiQueryAllCategories.php

index 78367a4..ce28d03 100644 (file)
@@ -65,7 +65,12 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase {
 
                $min = $params['min'];
                $max = $params['max'];
-               $this->addWhereRange( 'cat_pages', $dir, $min, $max );
+               if ( $dir == 'newer' ) {
+                       $this->addWhereRange( 'cat_pages', 'newer', $min, $max );
+               } else {
+                       $this->addWhereRange( 'cat_pages', 'older', $max, $min);
+               }
+    
 
                if ( isset( $params['prefix'] ) ) {
                        $this->addWhere( 'cat_title' . $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) );