/**
* Get the backlinks for a given table. Cached in process memory only.
- * @param $table String
- * @param $startId Integer|false
- * @param $endId Integer|false
- * @param $max Integer|INF
+ * @param string $table
+ * @param int|bool $startId
+ * @param int|bool $endId
+ * @param int|INF $max
* @return TitleArrayFromResult
*/
public function getLinks( $table, $startId = false, $endId = false, $max = INF ) {
);
}
- if ( !$startId && !$endId && $res->numRows() < $max ) {
+ if ( $select === 'all' && !$startId && !$endId && $res->numRows() < $max ) {
// The full results fit within the limit, so cache them
$this->fullResultCache[$table] = $res;
} else {
protected function getConditions( $table ) {
$prefix = $this->getPrefix( $table );
- // @todo FIXME: imagelinks and categorylinks do not rely on getNamespace,
- // they could be moved up for nicer case statements
switch ( $table ) {
case 'pagelinks':
case 'templatelinks':
);
break;
case 'imagelinks':
- $conds = array(
- 'il_to' => $this->title->getDBkey(),
- "page_id={$prefix}_from"
- );
- break;
case 'categorylinks':
$conds = array(
- 'cl_to' => $this->title->getDBkey(),
+ "{$prefix}_to" => $this->title->getDBkey(),
"page_id={$prefix}_from"
);
break;
$cacheEntry['numRows'] += $partitions['numRows'];
$cacheEntry['batches'] = array_merge( $cacheEntry['batches'], $partitions['batches'] );
if ( count( $partitions['batches'] ) ) {
- list( $lStart, $lEnd ) = end( $partitions['batches'] );
+ list( , $lEnd ) = end( $partitions['batches'] );
$start = $lEnd + 1; // pick up after this inclusive range
}
} while ( $partitions['numRows'] >= $selectSize );