Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for more recent versions of MediaWiki #13

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions maintenance/importEntities.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Wikibase\Import\QueryRunner;
use Wikibase\Import\PropertyIdLister;
use Wikibase\Repo\WikibaseRepo;
use MediaWiki\MediaWikiServices;

$IP = getenv( 'MW_INSTALL_PATH' );
if ( $IP === false ) {
Expand Down Expand Up @@ -109,7 +110,7 @@ private function newEntityIdListBuilderFactory() {
);

return new EntityIdListBuilderFactory(
WikibaseRepo::getDefaultInstance()->getEntityIdParser(),
WikibaseRepo::getEntityIdParser(),
new PropertyIdLister(),
$queryRunner,
$this->getConfig()->get( 'WBImportSourceApi' )
Expand All @@ -118,8 +119,8 @@ private function newEntityIdListBuilderFactory() {

private function newEntityImporter() {
$entityImporterFactory = new EntityImporterFactory(
WikibaseRepo::getDefaultInstance()->getStore()->getEntityStore(),
wfGetLB(),
WikibaseRepo::getEntityStore(),
MediaWikiServices::getInstance()->getDBLoadBalancer(),
$this->logger,
$this->getConfig()->get( 'WBImportSourceApi' )
);
Expand Down
12 changes: 4 additions & 8 deletions src/EntityImporterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
use DataValues\Serializers\DataValueSerializer;
use LoadBalancer;
use Psr\Log\LoggerInterface;
use Wikibase\DataModel\DeserializerFactory;
use Wikibase\DataModel\SerializerFactory;
use Wikibase\DataModel\Serializers\DeserializerFactory;
use Wikibase\DataModel\Serializers\SerializerFactory;
use Wikibase\Lib\Store\EntityStore;
use Wikibase\Import\Store\DBImportedEntityMappingStore;
use Wikibase\Import\Store\ImportedEntityMappingStore;
Expand Down Expand Up @@ -103,21 +103,17 @@ private function newStatementsImporter() {

private function getImportedEntityMappingStore() {
if ( $this->importedEntityMappingStore === null ) {
$wikibaseRepo = WikibaseRepo::getDefaultInstance();

$this->importedEntityMappingStore = new DBImportedEntityMappingStore(
$this->loadBalancer,
$wikibaseRepo->getEntityIdParser()
WikibaseRepo::getEntityIdParser()
);
}

return $this->importedEntityMappingStore;
}

private function newEntityDeserializer() {
$wikibaseRepo = WikibaseRepo::getDefaultInstance();

$deserializerFactory = $wikibaseRepo->getBaseDataModelDeserializerFactory();
$deserializerFactory = WikibaseRepo::getBaseDataModelDeserializerFactory();

return $deserializerFactory->newEntityDeserializer();
}
Expand Down
5 changes: 3 additions & 2 deletions tests/integration/ApiEntityLookupIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Wikibase\DataModel\Entity\PropertyId;
use Wikibase\Import\EntityImporterFactory;
use Wikibase\Repo\WikibaseRepo;
use MediaWiki\MediaWikiServices;

/**
* @group WikibaseImport
Expand Down Expand Up @@ -35,8 +36,8 @@ public function testGetEntity() {

private function getApiEntityLookup() {
$entityImporterFactory = new EntityImporterFactory(
WikibaseRepo::getDefaultInstance()->getStore()->getEntityStore(),
wfGetLB(),
WikibaseRepo::getEntityStore(),
MediaWikiServices::getInstance()->getDBLoadBalancer(),
$this->newLogger(),
'https://www.wikidata.org/w/api.php'
);
Expand Down
5 changes: 3 additions & 2 deletions tests/integration/EntityImporterFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Wikibase\Import\EntityImporter;
use Wikibase\Import\EntityImporterFactory;
use Wikibase\Repo\WikibaseRepo;
use MediaWiki\MediaWikiServices;

/**
* @group WikibaseImport
Expand All @@ -31,8 +32,8 @@ public function testGetApiEntityLookup() {

private function newEntityImporterFactory() {
return new EntityImporterFactory(
WikibaseRepo::getDefaultInstance()->getStore()->getEntityStore(),
wfGetLB(),
WikibaseRepo::getEntityStore(),
MediaWikiServices::getInstance()->getDBLoadBalancer(),
$this->newLogger(),
'https://www.wikidata.org/w/api.php'
);
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/Store/DBImportedEntityMappingStoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Wikibase\DataModel\Entity\ItemId;
use Wikibase\DataModel\Entity\PropertyId;
use Wikibase\Import\Store\DBImportedEntityMappingStore;
use MediaWiki\MediaWikiServices;

/**
* @group WikibaseImport
Expand Down Expand Up @@ -45,7 +46,7 @@ public function testGetOriginalId() {

private function newDBImportedEntityMappingStore() {
return new DBImportedEntityMappingStore(
wfGetLB(),
MediaWikiServices::getInstance()->getDBLoadBalancer(),
new BasicEntityIdParser()
);
}
Expand Down