r83837 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83836‎ | r83837 | r83838 >
Date:17:36, 13 March 2011
Author:reedy
Status:resolved
Tags:
Comment:
Cleanup/simplify code added to alllinks in r70584
Modified paths:
  • /trunk/phase3/includes/api/ApiQueryAllLinks.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryAllLinks.php
@@ -94,12 +94,10 @@
9595 );
9696 }
9797
98 - if ( !is_null( $params['from'] ) ) {
99 - $this->addWhere( 'pl_title>=' . $db->addQuotes( $this->titlePartToKey( $params['from'] ) ) );
100 - }
101 - if ( !is_null( $params['to'] ) ) {
102 - $this->addWhere( 'pl_title<=' . $db->addQuotes( $this->titlePartToKey( $params['to'] ) ) );
103 - }
 98+ $from = ( is_null( $params['from'] ) ? null : $this->titlePartToKey( $params['from'] ) );
 99+ $to = ( is_null( $params['to'] ) ? null : $this->titlePartToKey( $params['to'] ) );
 100+ $this->addWhereRange( 'pl_title', 'newer', $from, $to );
 101+
104102 if ( isset( $params['prefix'] ) ) {
105103 $this->addWhere( 'pl_title' . $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) );
106104 }
@@ -112,10 +110,9 @@
113111 $this->addOption( 'USE INDEX', 'pl_namespace' );
114112 $limit = $params['limit'];
115113 $this->addOption( 'LIMIT', $limit + 1 );
116 - if ( $params['unique'] ) {
117 - $this->addOption( 'ORDER BY', 'pl_title' );
118 - } else {
119 - $this->addOption( 'ORDER BY', 'pl_title, pl_from' );
 114+
 115+ if ( !$params['unique'] ) {
 116+ $this->addOption( 'ORDER BY', 'pl_from' );
120117 }
121118
122119 $res = $this->select( __METHOD__ );

Follow-up revisions

RevisionCommit summaryAuthorDate
r83850Followup r83843, r83837, per brian, addOption unconditionally replaces ORDER ...reedy19:28, 13 March 2011

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