Last modified: 2012-04-17 08:54:01 UTC
When I want to query for all categories that have at least one member, I can use a query like http://en.wikipedia.org/w/api.php?action=query&list=allcategories&acprop=size&acdir=ascending&acmin=1 But if I want to them in the reverse order: http://en.wikipedia.org/w/api.php?action=query&list=allcategories&acprop=size&acdir=descending&acmin=1 the result is wrong. It contains categories with *at most* one member, that's the opposite of what I want. I think the problem is this line in ApiQueryAllCategories.php: $this->addWhereRange( 'cat_pages', $dir, $min, $max ); I think this range shouldn't depend on $dir. Changing it to $this->addWhereRange( 'cat_pages', 'newer', $min, $max ); works fine for me, but I'm not completely sure this is the right solution.
That would mean no older support. I suspect you probably want: if ( $dir == 'newer' ) { $this->addWhereRange( 'cat_pages', 'newer', $min, $max ); } else { $this->addWhereRange( 'cat_pages', 'older', $max, $min); }
I don't understand what you mean. Both mine and your code seem to work exactly the same to me, whether I use acdir=ascending or acdir=descending. The only difference is that my code produces something like (with acdir=descending&acmin=0&acmax=3): WHERE (cat_pages>='0') AND (cat_pages<='3') while your is: WHERE (cat_pages<='3') AND (cat_pages>='0') But I guess I'm missing something.
They probably do, but hard coding the direction isn't probably the best idea... It might end up having some unexpected consequence in future...