reimplement r73652 having actually read coding conventions this time
[lhc/web/wiklou.git] / includes / api / ApiQueryAllpages.php
index 7b2a474..1734888 100644 (file)
@@ -1,10 +1,9 @@
 <?php
-
 /**
- * Created on Sep 25, 2006
- *
  * API for MediaWiki 1.8+
  *
+ * Created on Sep 25, 2006
+ *
  * Copyright © 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
  *
  * This program is free software; you can redistribute it and/or modify
@@ -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' ) ) {
@@ -70,13 +71,11 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase {
                }
 
                $this->addWhereFld( 'page_namespace', $params['namespace'] );
-               $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( 'page_title', $fromdir, $from, null );
-               $this->addWhereRange( 'page_title', $todir, $to, null );
-
+               $this->addWhereRange( 'page_title', $dir, $from, $to );
+               
                if ( isset( $params['prefix'] ) ) {
                        $this->addWhere( 'page_title' . $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) );
                }