http://www.mediawiki.org/wiki/Special:Code/MediaWiki/70635
Revision: 70635 Author: soxred93 Date: 2010-08-07 16:51:25 +0000 (Sat, 07 Aug 2010) Log Message: ----------- Followup to r70584: Use fourth parameter of ApiQueryBase::addWhereRange instead of a second call Modified Paths: -------------- trunk/phase3/includes/api/ApiQueryAllCategories.php trunk/phase3/includes/api/ApiQueryAllimages.php trunk/phase3/includes/api/ApiQueryAllpages.php Modified: trunk/phase3/includes/api/ApiQueryAllCategories.php =================================================================== --- trunk/phase3/includes/api/ApiQueryAllCategories.php 2010-08-07 16:46:57 UTC (rev 70634) +++ trunk/phase3/includes/api/ApiQueryAllCategories.php 2010-08-07 16:51:25 UTC (rev 70635) @@ -59,12 +59,10 @@ $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() ) ); Modified: trunk/phase3/includes/api/ApiQueryAllimages.php =================================================================== --- trunk/phase3/includes/api/ApiQueryAllimages.php 2010-08-07 16:46:57 UTC (rev 70634) +++ trunk/phase3/includes/api/ApiQueryAllimages.php 2010-08-07 16:51:25 UTC (rev 70635) @@ -78,12 +78,10 @@ $params = $this->extractRequestParams(); // Image filters - $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( 'img_name', $fromdir, $from, null ); - $this->addWhereRange( 'img_name', $todir, $to, null ); + $this->addWhereRange( 'img_name', $dir, $from, $to ); if ( isset( $params['prefix'] ) ) $this->addWhere( 'img_name' . $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) ); Modified: trunk/phase3/includes/api/ApiQueryAllpages.php =================================================================== --- trunk/phase3/includes/api/ApiQueryAllpages.php 2010-08-07 16:46:57 UTC (rev 70634) +++ trunk/phase3/includes/api/ApiQueryAllpages.php 2010-08-07 16:51:25 UTC (rev 70635) @@ -70,12 +70,11 @@ } $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() ) ); _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs