If the parameter contains only invalid titles, it shouldn't be ignored.
Bug: T162816
Change-Id: I3ee6aeab421db5732b652fed21292d8509f8d757
$this->addTables( 'categorylinks' );
$this->addWhereFld( 'cl_from', array_keys( $this->getPageSet()->getGoodTitles() ) );
- if ( !is_null( $params['categories'] ) ) {
+ if ( $params['categories'] ) {
$cats = [];
foreach ( $params['categories'] as $cat ) {
$title = Title::newFromText( $cat );
$cats[] = $title->getDBkey();
}
}
+ if ( !$cats ) {
+ // No titles so no results
+ return;
+ }
$this->addWhereFld( 'cl_to', $cats );
}
}
$this->addOption( 'LIMIT', $params['limit'] + 1 );
- if ( !is_null( $params['images'] ) ) {
+ if ( $params['images'] ) {
$images = [];
foreach ( $params['images'] as $img ) {
$title = Title::newFromText( $img );
$images[] = $title->getDBkey();
}
}
+ if ( !$images ) {
+ // No titles so no results
+ return;
+ }
$this->addWhereFld( 'il_to', $images );
}
$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;
}
}