r70635 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70634‎ | r70635 | r70636 >
Date:16:51, 7 August 2010
Author:soxred93
Status:ok
Tags:
Comment:
Followup to r70584: Use fourth parameter of ApiQueryBase::addWhereRange instead of a second call
Modified paths:
  • /trunk/phase3/includes/api/ApiQueryAllCategories.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryAllimages.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryAllpages.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryAllCategories.php
@@ -59,12 +59,10 @@
6060 $this->addTables( 'category' );
6161 $this->addFields( 'cat_title' );
6262
63 - $fromdir = ( $params['dir'] == 'descending' ? 'older' : 'newer' );
64 - $todir = ( $params['dir'] != 'descending' ? 'older' : 'newer' );
 63+ $dir = ( $params['dir'] == 'descending' ? 'older' : 'newer' );
6564 $from = ( is_null( $params['from'] ) ? null : $this->titlePartToKey( $params['from'] ) );
6665 $to = ( is_null( $params['to'] ) ? null : $this->titlePartToKey( $params['to'] ) );
67 - $this->addWhereRange( 'cat_title', $fromdir, $from, null );
68 - $this->addWhereRange( 'cat_title', $todir, $to, null );
 66+ $this->addWhereRange( 'cat_title', $dir, $from, $to );
6967
7068 if ( isset( $params['prefix'] ) ) {
7169 $this->addWhere( 'cat_title' . $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) );
Index: trunk/phase3/includes/api/ApiQueryAllpages.php
@@ -70,12 +70,11 @@
7171 }
7272
7373 $this->addWhereFld( 'page_namespace', $params['namespace'] );
74 - $fromdir = ( $params['dir'] == 'descending' ? 'older' : 'newer' );
75 - $todir = ( $params['dir'] != 'descending' ? 'older' : 'newer' );
 74+ $dir = ( $params['dir'] == 'descending' ? 'older' : 'newer' );
7675 $from = ( is_null( $params['from'] ) ? null : $this->titlePartToKey( $params['from'] ) );
7776 $to = ( is_null( $params['to'] ) ? null : $this->titlePartToKey( $params['to'] ) );
78 - $this->addWhereRange( 'page_title', $fromdir, $from, null );
79 - $this->addWhereRange( 'page_title', $todir, $to, null );
 77+ $this->addWhereRange( 'page_title', $dir, $from, $to );
 78+
8079
8180 if ( isset( $params['prefix'] ) ) {
8281 $this->addWhere( 'page_title' . $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) );
Index: trunk/phase3/includes/api/ApiQueryAllimages.php
@@ -78,12 +78,10 @@
7979 $params = $this->extractRequestParams();
8080
8181 // Image filters
82 - $fromdir = ( $params['dir'] == 'descending' ? 'older' : 'newer' );
83 - $todir = ( $params['dir'] != 'descending' ? 'older' : 'newer' );
 82+ $dir = ( $params['dir'] == 'descending' ? 'older' : 'newer' );
8483 $from = ( is_null( $params['from'] ) ? null : $this->titlePartToKey( $params['from'] ) );
8584 $to = ( is_null( $params['to'] ) ? null : $this->titlePartToKey( $params['to'] ) );
86 - $this->addWhereRange( 'img_name', $fromdir, $from, null );
87 - $this->addWhereRange( 'img_name', $todir, $to, null );
 85+ $this->addWhereRange( 'img_name', $dir, $from, $to );
8886
8987 if ( isset( $params['prefix'] ) )
9088 $this->addWhere( 'img_name' . $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r70584* (bug 24677) axto= parameters added to allcategories, allimages, alllinks, a...soxred9318:58, 6 August 2010

Status & tagging log