Index: trunk/phase3/includes/api/ApiQueryAllLinks.php |
— | — | @@ -94,12 +94,10 @@ |
95 | 95 | ); |
96 | 96 | } |
97 | 97 | |
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 | + |
104 | 102 | if ( isset( $params['prefix'] ) ) { |
105 | 103 | $this->addWhere( 'pl_title' . $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) ); |
106 | 104 | } |
— | — | @@ -112,10 +110,9 @@ |
113 | 111 | $this->addOption( 'USE INDEX', 'pl_namespace' ); |
114 | 112 | $limit = $params['limit']; |
115 | 113 | $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' ); |
120 | 117 | } |
121 | 118 | |
122 | 119 | $res = $this->select( __METHOD__ ); |