From: Sam Reed Date: Sat, 23 Jan 2010 21:28:27 +0000 (+0000) Subject: Normalise check for filterredir in Allpages to that of backlinks X-Git-Tag: 1.31.0-rc.0~38131 X-Git-Url: https://git.cyclocoop.org//%22?a=commitdiff_plain;h=01e257cbd515bf3b43f9365e6611c784598ec113;p=lhc%2Fweb%2Fwiklou.git Normalise check for filterredir in Allpages to that of backlinks Add a couple of blank lines --- diff --git a/includes/api/ApiQueryAllpages.php b/includes/api/ApiQueryAllpages.php index 4f8fe40dca..0d3572adce 100644 --- a/includes/api/ApiQueryAllpages.php +++ b/includes/api/ApiQueryAllpages.php @@ -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() ) ); diff --git a/includes/api/ApiQueryBacklinks.php b/includes/api/ApiQueryBacklinks.php index e5b0d3a41d..6b4ee3fa06 100644 --- a/includes/api/ApiQueryBacklinks.php +++ b/includes/api/ApiQueryBacklinks.php @@ -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' );