Merge "deferred: Improve DeferredUpdates test coverage"
[lhc/web/wiklou.git] / includes / api / ApiQueryLinks.php
index 3639c06..2f75e76 100644 (file)
@@ -89,7 +89,7 @@ class ApiQueryLinks extends ApiQueryGeneratorBase {
                $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 );
@@ -102,6 +102,9 @@ class ApiQueryLinks extends ApiQueryGeneratorBase {
                        $cond = $lb->constructSet( $this->prefix, $this->getDB() );
                        if ( $cond ) {
                                $this->addWhere( $cond );
+                       } else {
+                               // No titles so no results
+                               return;
                        }
                }
 
@@ -137,7 +140,6 @@ class ApiQueryLinks extends ApiQueryGeneratorBase {
 
                $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__ );