Normalise check for filterredir in Allpages to that of backlinks
authorSam Reed <reedy@users.mediawiki.org>
Sat, 23 Jan 2010 21:28:27 +0000 (21:28 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Sat, 23 Jan 2010 21:28:27 +0000 (21:28 +0000)
Add a couple of blank lines

includes/api/ApiQueryAllpages.php
includes/api/ApiQueryBacklinks.php

index 4f8fe40..0d3572a 100644 (file)
@@ -58,12 +58,17 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase {
 
                // Page filters
                $this->addTables( 'page' );
-               if ( !$this->addWhereIf( 'page_is_redirect = 1', $params['filterredir'] === 'redirects' ) )
-                       $this->addWhereIf( 'page_is_redirect = 0', $params['filterredir'] === 'nonredirects' );
+               
+               if ( $this->params['filterredir'] == 'redirects' )
+                       $this->addWhereFld( 'page_is_redirect', 1 );
+               else if ( $this->params['filterredir'] == 'nonredirects' )
+                       $this->addWhereFld( 'page_is_redirect', 0 );
+
                $this->addWhereFld( 'page_namespace', $params['namespace'] );
                $dir = ( $params['dir'] == 'descending' ? 'older' : 'newer' );
                $from = ( is_null( $params['from'] ) ? null : $this->titlePartToKey( $params['from'] ) );
                $this->addWhereRange( 'page_title', $dir, $from, null );
+               
                if ( isset ( $params['prefix'] ) )
                        $this->addWhere( 'page_title' . $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) );
 
index e5b0d3a..6b4ee3f 100644 (file)
@@ -116,10 +116,12 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                $this->addWhereFld( 'page_namespace', $this->params['namespace'] );
                if ( !is_null( $this->contID ) )
                        $this->addWhere( "{$this->bl_from}>={$this->contID}" );
+
                if ( $this->params['filterredir'] == 'redirects' )
                        $this->addWhereFld( 'page_is_redirect', 1 );
                else if ( $this->params['filterredir'] == 'nonredirects' )
                        $this->addWhereFld( 'page_is_redirect', 0 );
+
                $this->addOption( 'LIMIT', $this->params['limit'] + 1 );
                $this->addOption( 'ORDER BY', $this->bl_from );
                $this->addOption( 'STRAIGHT_JOIN' );