From 5a25b01376a4d8b43cb856c2eafd24d5b1865e12 Mon Sep 17 00:00:00 2001 From: Erik Bernhardson Date: Thu, 30 Jun 2016 15:55:20 -0700 Subject: [PATCH] Repair interwiki search via api This was throwing exceptions, probably for many months now, when requesting and finding interwiki search results. Probably this went unnoticed due to interwiki search only being enabled on itwiki, and the requirement to pass a special parameter to turn it on. Change-Id: I68ec35bb072b5ad62dd66789936bc2ae47d5256f --- includes/api/ApiQuerySearch.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/includes/api/ApiQuerySearch.php b/includes/api/ApiQuerySearch.php index f84f806b1f..4377831ba5 100644 --- a/includes/api/ApiQuerySearch.php +++ b/includes/api/ApiQuerySearch.php @@ -232,15 +232,14 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { $totalhits = null; if ( $interwiki && $resultPageSet === null && $matches->hasInterwikiResults() ) { foreach ( $matches->getInterwikiResults() as $interwikiMatches ) { - $currentMatches = $interwikiMatches->getInterwikiResults(); $hasInterwikiResults = true; // Include number of results if requested if ( $resultPageSet === null && isset( $searchInfo['totalhits'] ) ) { - $totalhits += $currentMatches->getTotalHits(); + $totalhits += $interwikiMatches->getTotalHits(); } - $result = $currentMatches->next(); + $result = $interwikiMatches->next(); while ( $result ) { $title = $result->getTitle(); @@ -267,7 +266,7 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { $titles[] = $title; } - $result = $currentMatches->next(); + $result = $interwikiMatches->next(); } } if ( $totalhits !== null ) { -- 2.20.1