const LINKS = 'links';
const TEMPLATES = 'templates';
- private $table, $prefix, $helpUrl;
+ private $table, $prefix, $titlesParam, $helpUrl;
public function __construct( ApiQuery $query, $moduleName ) {
switch ( $moduleName ) {
$this->addWhereFld( $this->prefix . '_from', array_keys( $this->getPageSet()->getGoodTitles() ) );
$this->addWhereFld( $this->prefix . '_namespace', $params['namespace'] );
- if ( !is_null( $params[$this->titlesParam] ) ) {
+ if ( $params[$this->titlesParam] ) {
$lb = new LinkBatch;
foreach ( $params[$this->titlesParam] as $t ) {
$title = Title::newFromText( $t );
$cond = $lb->constructSet( $this->prefix, $this->getDB() );
if ( $cond ) {
$this->addWhere( $cond );
+ } else {
+ // No titles so no results
+ return;
}
}
$order[] = $this->prefix . '_title' . $sort;
$this->addOption( 'ORDER BY', $order );
- $this->addOption( 'USE INDEX', $this->prefix . '_from' );
$this->addOption( 'LIMIT', $params['limit'] + 1 );
$res = $this->select( __METHOD__ );