More parameter documentation
[lhc/web/wiklou.git] / includes / api / ApiQueryAllCategories.php
index a549294..c733703 100644 (file)
@@ -1,11 +1,10 @@
 <?php
-
 /**
- * Created on December 12, 2007
  *
- * API for MediaWiki 1.8+
  *
- * Copyright © 2007 Roan Kattouw <Firstname>.<Lastname>@home.nl
+ * Created on December 12, 2007
+ *
+ * Copyright © 2007 Roan Kattouw <Firstname>.<Lastname>@gmail.com
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -21,6 +20,8 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
  */
 
 if ( !defined( 'MEDIAWIKI' ) ) {
@@ -52,6 +53,10 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase {
                $this->run( $resultPageSet );
        }
 
+       /**
+        * @param $resultPageSet ApiPageSet
+        * @return void
+        */
        private function run( $resultPageSet = null ) {
                $db = $this->getDB();
                $params = $this->extractRequestParams();
@@ -59,12 +64,10 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase {
                $this->addTables( 'category' );
                $this->addFields( 'cat_title' );
 
-               $fromdir = ( $params['dir'] == 'descending' ? 'older' : 'newer' );
-               $todir = ( $params['dir'] != 'descending' ? 'older' : 'newer' );
+               $dir = ( $params['dir'] == 'descending' ? 'older' : 'newer' );
                $from = ( is_null( $params['from'] ) ? null : $this->titlePartToKey( $params['from'] ) );
                $to = ( is_null( $params['to'] ) ? null : $this->titlePartToKey( $params['to'] ) );
-               $this->addWhereRange( 'cat_title', $fromdir, $from, null );
-               $this->addWhereRange( 'cat_title', $todir, $to, null );
+               $this->addWhereRange( 'cat_title', $dir, $from, $to );
 
                if ( isset( $params['prefix'] ) ) {
                        $this->addWhere( 'cat_title' . $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) );