Skip to content

Commit

Permalink
No longer use Wikibase\Utils to get languages for GetSuggestions api …
Browse files Browse the repository at this point in the history
…module

the getLanguages method was removed and the class has been renamed.

Bug: T90137
  • Loading branch information
aude committed Feb 20, 2015
1 parent 3b56482 commit 235ebad
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/PropertySuggester/GetSuggestions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -31,6 +30,11 @@ class GetSuggestions extends ApiBase {
*/
private $entityTitleLookup;

/**
* @var string[]
*/
private $languageCodes;

/**
* @var SuggesterEngine
*/
Expand All @@ -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 );
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 235ebad

Please sign in to comment.