From: X! Date: Sat, 7 Aug 2010 16:51:25 +0000 (+0000) Subject: Followup to r70584: Use fourth parameter of ApiQueryBase::addWhereRange instead of... X-Git-Tag: 1.31.0-rc.0~35646 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/ajouter.php?a=commitdiff_plain;h=f2e664cfe02c355ecc1b3657d6580c9735706ee3;p=lhc%2Fweb%2Fwiklou.git Followup to r70584: Use fourth parameter of ApiQueryBase::addWhereRange instead of a second call --- diff --git a/includes/api/ApiQueryAllCategories.php b/includes/api/ApiQueryAllCategories.php index a549294a0a..a8f09b120e 100644 --- a/includes/api/ApiQueryAllCategories.php +++ b/includes/api/ApiQueryAllCategories.php @@ -59,12 +59,10 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase { $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() ) ); diff --git a/includes/api/ApiQueryAllimages.php b/includes/api/ApiQueryAllimages.php index 863cd59ff4..0abb330c73 100644 --- a/includes/api/ApiQueryAllimages.php +++ b/includes/api/ApiQueryAllimages.php @@ -78,12 +78,10 @@ class ApiQueryAllimages extends ApiQueryGeneratorBase { $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() ) ); diff --git a/includes/api/ApiQueryAllpages.php b/includes/api/ApiQueryAllpages.php index 7b2a4748d5..c1919f2278 100644 --- a/includes/api/ApiQueryAllpages.php +++ b/includes/api/ApiQueryAllpages.php @@ -70,12 +70,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() ) );