From 235ebadcee2a7282641727a3badf3b82e956bb38 Mon Sep 17 00:00:00 2001 From: aude Date: Fri, 20 Feb 2015 15:17:08 +0100 Subject: [PATCH] No longer use Wikibase\Utils to get languages for GetSuggestions api module the getLanguages method was removed and the class has been renamed. Bug: T90137 --- src/PropertySuggester/GetSuggestions.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/PropertySuggester/GetSuggestions.php b/src/PropertySuggester/GetSuggestions.php index fd7331c..4e83ff2 100644 --- a/src/PropertySuggester/GetSuggestions.php +++ b/src/PropertySuggester/GetSuggestions.php @@ -12,7 +12,6 @@ use Wikibase\Lib\Store\EntityTitleLookup; use Wikibase\Repo\WikibaseRepo; use Wikibase\TermIndex; -use Wikibase\Utils; /** * API module to get property suggestions. @@ -31,6 +30,11 @@ class GetSuggestions extends ApiBase { */ private $entityTitleLookup; + /** + * @var string[] + */ + private $languageCodes; + /** * @var SuggesterEngine */ @@ -52,10 +56,13 @@ public function __construct( ApiMain $main, $name, $prefix = '' ) { global $wgPropertySuggesterMinProbability; global $wgPropertySuggesterClassifyingPropertyIds; - $store = WikibaseRepo::getDefaultInstance()->getStore(); + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); + $store = $wikibaseRepo->getStore(); + $this->termIndex = $store->getTermIndex(); $this->entityLookup = $store->getEntityLookup(); - $this->entityTitleLookup = WikibaseRepo::getDefaultInstance()->getEntityTitleLookup(); + $this->entityTitleLookup = $wikibaseRepo->getEntityTitleLookup(); + $this->languageCodes = $wikibaseRepo->getTermsLanguages()->getLanguages(); $this->suggester = new SimpleSuggester( wfGetLB() ); $this->suggester->setDeprecatedPropertyIds( $wgPropertySuggesterDeprecatedIds ); @@ -150,7 +157,7 @@ public function getAllowedParams() { ), 'continue' => null, 'language' => array( - ApiBase::PARAM_TYPE => Utils::getLanguageCodes(), + ApiBase::PARAM_TYPE => $this->languageCodes, ApiBase::PARAM_DFLT => $this->getContext()->getLanguage()->getCode(), ), 'context' => array(