jenkins-bot has submitted this change and it was merged. Change subject: Avoid calling getDefaultInstance multiple times ......................................................................
Avoid calling getDefaultInstance multiple times I found all these candidates with a simple regex: getdefault[^{}]*getdefault Change-Id: I2777f27acaaf2c0e072c8e703c38adc0864c1c31 --- M client/WikibaseClient.hooks.php M client/includes/store/AddUsagesForPageJob.php M client/maintenance/updateSubscriptions.php M repo/Wikibase.hooks.php M repo/includes/Hooks/LabelPrefetchHookHandlers.php M repo/includes/api/AvailableBadges.php M repo/includes/api/CreateClaim.php M repo/includes/api/GetEntities.php M repo/includes/api/ModifyClaim.php M repo/includes/api/RemoveQualifiers.php M repo/includes/api/RemoveReferences.php M repo/includes/specials/SpecialItemByTitle.php M repo/includes/specials/SpecialModifyTerm.php M repo/includes/specials/SpecialNewEntity.php M repo/maintenance/rebuildItemsPerSite.php M repo/tests/phpunit/includes/Dumpers/JsonDumpGeneratorTest.php M repo/tests/phpunit/includes/EntityModificationTestHelper.php M repo/tests/phpunit/includes/Hooks/OutputPageJsConfigHookHandlerTest.php M repo/tests/phpunit/includes/Interactors/ItemMergeInteractorTest.php M repo/tests/phpunit/includes/ItemMoveTest.php M repo/tests/phpunit/includes/Notifications/DatabaseChangeTransmitterTest.php M repo/tests/phpunit/includes/api/AvailableBadgesTest.php M repo/tests/phpunit/includes/api/CreateRedirectTest.php M repo/tests/phpunit/includes/api/EditEntityTest.php M repo/tests/phpunit/includes/api/EditPageTest.php M repo/tests/phpunit/includes/api/MergeItemsTest.php M repo/tests/phpunit/includes/api/ParseValueTest.php M repo/tests/phpunit/includes/api/SetClaimValueTest.php M repo/tests/phpunit/includes/api/SetReferenceTest.php M repo/tests/phpunit/includes/api/SetSiteLinkTest.php M repo/tests/phpunit/includes/api/StatementModificationHelperTest.php M repo/tests/phpunit/includes/api/WikibaseApiTestCase.php M repo/tests/phpunit/includes/content/DeferredDecodingEntityHolderTest.php M repo/tests/phpunit/includes/specials/SpecialMergeItemsTest.php M repo/tests/phpunit/includes/specials/SpecialRedirectEntityTest.php M repo/tests/phpunit/includes/specials/SpecialSetSiteLinkTest.php M repo/tests/phpunit/includes/store/sql/WikiPageEntityStoreTest.php 37 files changed, 148 insertions(+), 128 deletions(-) Approvals: Hoo man: Looks good to me, approved jenkins-bot: Verified diff --git a/client/WikibaseClient.hooks.php b/client/WikibaseClient.hooks.php index 0c5d8d8..60f82fc 100644 --- a/client/WikibaseClient.hooks.php +++ b/client/WikibaseClient.hooks.php @@ -577,7 +577,7 @@ $wikibaseClient = WikibaseClient::getDefaultInstance(); $settings = $wikibaseClient->getSettings(); - $namespaceChecker = WikibaseClient::getDefaultInstance()->getNamespaceChecker(); + $namespaceChecker = $wikibaseClient->getNamespaceChecker(); if ( !$namespaceChecker->isWikibaseEnabled( $context->getTitle()->getNamespace() ) ) { // shorten out diff --git a/client/includes/store/AddUsagesForPageJob.php b/client/includes/store/AddUsagesForPageJob.php index 382e2f5..d52c294 100644 --- a/client/includes/store/AddUsagesForPageJob.php +++ b/client/includes/store/AddUsagesForPageJob.php @@ -103,8 +103,9 @@ $this->usages = $params['usages']; $this->touched = $params['touched']; - $usageUpdater = WikibaseClient::getDefaultInstance()->getStore()->getUsageUpdater(); - $idParser = WikibaseClient::getDefaultInstance()->getEntityIdParser(); + $wikibaseClient = WikibaseClient::getDefaultInstance(); + $usageUpdater = $wikibaseClient->getStore()->getUsageUpdater(); + $idParser = $wikibaseClient->getEntityIdParser(); $this->overrideServices( $usageUpdater, $idParser ); } diff --git a/client/maintenance/updateSubscriptions.php b/client/maintenance/updateSubscriptions.php index 6311385..6b7e7c0 100644 --- a/client/maintenance/updateSubscriptions.php +++ b/client/maintenance/updateSubscriptions.php @@ -46,10 +46,12 @@ $this->error( "You need to have WikibaseClient enabled in order to use this maintenance script!", 1 ); } - $repoDB = WikibaseClient::getDefaultInstance()->getSettings()->getSetting( 'repoDatabase' ); - $clientId = WikibaseClient::getDefaultInstance()->getSettings()->getSetting( 'siteGlobalID' ); + $wikibaseClient = WikibaseClient::getDefaultInstance(); + $settings = $wikibaseClient->getSettings(); + $repoDB = $settings->getSetting( 'repoDatabase' ); + $clientId = $settings->getSetting( 'siteGlobalID' ); - $idParser = WikibaseClient::getDefaultInstance()->getEntityIdParser(); + $idParser = $wikibaseClient->getEntityIdParser(); $startItemOption = $this->getOption( 'start-item' ); $startItem = $startItemOption === null ? null : $idParser->parse( $startItemOption ); diff --git a/repo/Wikibase.hooks.php b/repo/Wikibase.hooks.php index 56d9279..4b70f01 100644 --- a/repo/Wikibase.hooks.php +++ b/repo/Wikibase.hooks.php @@ -282,7 +282,8 @@ Content $content = null, LogEntry $logEntry ) { - $entityContentFactory = WikibaseRepo::getDefaultInstance()->getEntityContentFactory(); + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); + $entityContentFactory = $wikibaseRepo->getEntityContentFactory(); // Bail out if we are not looking at an entity if ( !$content || !$entityContentFactory->isEntityContentModel( $content->getModel() ) ) { @@ -293,11 +294,9 @@ // Notify storage/lookup services that the entity was deleted. Needed to track page-level deletion. // May be redundant in some cases. Take care not to cause infinite regress. - WikibaseRepo::getDefaultInstance() - ->getEntityStoreWatcher() - ->entityDeleted( $content->getEntityId() ); + $wikibaseRepo->getEntityStoreWatcher()->entityDeleted( $content->getEntityId() ); - $notifier = WikibaseRepo::getDefaultInstance()->getChangeNotifier(); + $notifier = $wikibaseRepo->getChangeNotifier(); $notifier->notifyOnPageDeleted( $content, $user, $logEntry->getTimestamp() ); } @@ -313,7 +312,8 @@ * @return bool */ public static function onArticleUndelete( Title $title, $created, $comment ) { - $entityContentFactory = WikibaseRepo::getDefaultInstance()->getEntityContentFactory(); + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); + $entityContentFactory = $wikibaseRepo->getEntityContentFactory(); // Bail out if we are not looking at an entity if ( !$entityContentFactory->isEntityContentModel( $title->getContentModel() ) ) { @@ -329,12 +329,12 @@ } //XXX: EntityContent::save() also does this. Why are we doing this twice? - WikibaseRepo::getDefaultInstance()->getStore()->newEntityPerPage()->addEntityPage( + $wikibaseRepo->getStore()->newEntityPerPage()->addEntityPage( $content->getEntityId(), $title->getArticleID() ); - $notifier = WikibaseRepo::getDefaultInstance()->getChangeNotifier(); + $notifier = $wikibaseRepo->getChangeNotifier(); $notifier->notifyOnPageUndeleted( $revision ); return true; @@ -556,9 +556,10 @@ * @return bool */ public static function onOutputPageBodyAttributes( OutputPage $out, Skin $sk, array &$bodyAttrs ) { + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); $outputPageEntityIdReader = new OutputPageEntityIdReader( - WikibaseRepo::getDefaultInstance()->getEntityContentFactory(), - WikibaseRepo::getDefaultInstance()->getEntityIdParser() + $wikibaseRepo->getEntityContentFactory(), + $wikibaseRepo->getEntityIdParser() ); $entityId = $outputPageEntityIdReader->getEntityIdFromOutputPage( $out ); @@ -942,14 +943,15 @@ * @return bool */ public static function onContentHandlerForModelID( $modelId, &$handler ) { + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); // FIXME: a mechanism for registering additional entity types needs to be put in place. switch ( $modelId ) { case CONTENT_MODEL_WIKIBASE_ITEM: - $handler = WikibaseRepo::getDefaultInstance()->newItemHandler(); + $handler = $wikibaseRepo->newItemHandler(); return false; case CONTENT_MODEL_WIKIBASE_PROPERTY: - $handler = WikibaseRepo::getDefaultInstance()->newPropertyHandler(); + $handler = $wikibaseRepo->newPropertyHandler(); return false; default: @@ -1020,10 +1022,9 @@ */ public static function onImportHandleRevisionXMLTag( $importer, $pageInfo, $revisionInfo ) { if ( isset( $revisionInfo['model'] ) ) { - $contentModels = WikibaseRepo::getDefaultInstance()->getContentModelMappings(); - $allowImport = WikibaseRepo::getDefaultInstance() - ->getSettings() - ->getSetting( 'allowEntityImport' ); + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); + $contentModels = $wikibaseRepo->getContentModelMappings(); + $allowImport = $wikibaseRepo->getSettings()->getSetting( 'allowEntityImport' ); if ( !$allowImport && in_array( $revisionInfo['model'], $contentModels ) ) { // Skip entities. diff --git a/repo/includes/Hooks/LabelPrefetchHookHandlers.php b/repo/includes/Hooks/LabelPrefetchHookHandlers.php index 1f8a258..156a161 100644 --- a/repo/includes/Hooks/LabelPrefetchHookHandlers.php +++ b/repo/includes/Hooks/LabelPrefetchHookHandlers.php @@ -56,25 +56,24 @@ * @return null|LabelPrefetchHookHandlers */ private static function newFromGlobalState() { - $termBuffer = WikibaseRepo::getDefaultInstance()->getTermBuffer(); + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); + $termBuffer = $wikibaseRepo->getTermBuffer(); if ( $termBuffer === null ) { return null; } - $idLookup = WikibaseRepo::getDefaultInstance()->getEntityIdLookup(); - $titleFactory = new TitleFactory(); $termTypes = array( TermIndexEntry::TYPE_LABEL, TermIndexEntry::TYPE_DESCRIPTION ); // NOTE: keep in sync with fallback chain construction in LinkBeginHookHandler::newFromGlobalState $context = RequestContext::getMain(); - $languageFallbackChainFactory = WikibaseRepo::getDefaultInstance()->getLanguageFallbackChainFactory(); + $languageFallbackChainFactory = $wikibaseRepo->getLanguageFallbackChainFactory(); $languageFallbackChain = $languageFallbackChainFactory->newFromContext( $context ); return new LabelPrefetchHookHandlers( $termBuffer, - $idLookup, - $titleFactory, + $wikibaseRepo->getEntityIdLookup(), + new TitleFactory(), $termTypes, $languageFallbackChain->getFetchLanguageCodes() ); diff --git a/repo/includes/api/AvailableBadges.php b/repo/includes/api/AvailableBadges.php index 49b85e7..eea705d 100644 --- a/repo/includes/api/AvailableBadges.php +++ b/repo/includes/api/AvailableBadges.php @@ -21,13 +21,13 @@ * @since 0.5 */ public function execute() { - $settings = WikibaseRepo::getDefaultInstance()->getSettings(); - $badgeItems = array_keys( $settings->getSetting( 'badgeItems' ) ); - ApiResult::setIndexedTagName( $badgeItems, 'badge' ); + $badgeItems = WikibaseRepo::getDefaultInstance()->getSettings()->getSetting( 'badgeItems' ); + $idStrings = array_keys( $badgeItems ); + ApiResult::setIndexedTagName( $idStrings, 'badge' ); $this->getResult()->addValue( null, 'badges', - $badgeItems + $idStrings ); } diff --git a/repo/includes/api/CreateClaim.php b/repo/includes/api/CreateClaim.php index 47099d6..e22b6ea 100644 --- a/repo/includes/api/CreateClaim.php +++ b/repo/includes/api/CreateClaim.php @@ -40,7 +40,7 @@ $wikibaseRepo = WikibaseRepo::getDefaultInstance(); $apiHelperFactory = $wikibaseRepo->getApiHelperFactory( $this->getContext() ); - $changeOpFactoryProvider = WikibaseRepo::getDefaultInstance()->getChangeOpFactoryProvider(); + $changeOpFactoryProvider = $wikibaseRepo->getChangeOpFactoryProvider(); $this->errorReporter = $apiHelperFactory->getErrorReporter( $this ); $this->statementChangeOpFactory = $changeOpFactoryProvider->getStatementChangeOpFactory(); diff --git a/repo/includes/api/GetEntities.php b/repo/includes/api/GetEntities.php index acf9506..2222247 100644 --- a/repo/includes/api/GetEntities.php +++ b/repo/includes/api/GetEntities.php @@ -178,12 +178,12 @@ * @return ItemByTitleHelper */ private function getItemByTitleHelper() { - $siteLinkStore = WikibaseRepo::getDefaultInstance()->getStore()->newSiteLinkStore(); - $siteStore = WikibaseRepo::getDefaultInstance()->getSiteStore(); + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); + $siteLinkStore = $wikibaseRepo->getStore()->newSiteLinkStore(); return new ItemByTitleHelper( $this->resultBuilder, $siteLinkStore, - $siteStore, + $wikibaseRepo->getSiteStore(), $this->stringNormalizer ); } diff --git a/repo/includes/api/ModifyClaim.php b/repo/includes/api/ModifyClaim.php index 98341ab..37f8a9f 100644 --- a/repo/includes/api/ModifyClaim.php +++ b/repo/includes/api/ModifyClaim.php @@ -72,7 +72,7 @@ $apiHelperFactory->getErrorReporter( $this ) ); - $this->guidParser = WikibaseRepo::getDefaultInstance()->getStatementGuidParser(); + $this->guidParser = $wikibaseRepo->getStatementGuidParser(); $this->resultBuilder = $apiHelperFactory->getResultBuilder( $this ); $this->entityLoadingHelper = $apiHelperFactory->getEntityLoadingHelper( $this ); $this->entitySavingHelper = $apiHelperFactory->getEntitySavingHelper( $this ); diff --git a/repo/includes/api/RemoveQualifiers.php b/repo/includes/api/RemoveQualifiers.php index d7c18a6..780d7bd 100644 --- a/repo/includes/api/RemoveQualifiers.php +++ b/repo/includes/api/RemoveQualifiers.php @@ -41,7 +41,7 @@ $wikibaseRepo = WikibaseRepo::getDefaultInstance(); $apiHelperFactory = $wikibaseRepo->getApiHelperFactory( $this->getContext() ); - $changeOpFactoryProvider = WikibaseRepo::getDefaultInstance()->getChangeOpFactoryProvider(); + $changeOpFactoryProvider = $wikibaseRepo->getChangeOpFactoryProvider(); $this->errorReporter = $apiHelperFactory->getErrorReporter( $this ); $this->statementChangeOpFactory = $changeOpFactoryProvider->getStatementChangeOpFactory(); diff --git a/repo/includes/api/RemoveReferences.php b/repo/includes/api/RemoveReferences.php index 2c08640..481cc3d 100644 --- a/repo/includes/api/RemoveReferences.php +++ b/repo/includes/api/RemoveReferences.php @@ -41,7 +41,7 @@ $wikibaseRepo = WikibaseRepo::getDefaultInstance(); $apiHelperFactory = $wikibaseRepo->getApiHelperFactory( $this->getContext() ); - $changeOpFactoryProvider = WikibaseRepo::getDefaultInstance()->getChangeOpFactoryProvider(); + $changeOpFactoryProvider = $wikibaseRepo->getChangeOpFactoryProvider(); $this->errorReporter = $apiHelperFactory->getErrorReporter( $this ); $this->statementChangeOpFactory = $changeOpFactoryProvider->getStatementChangeOpFactory(); diff --git a/repo/includes/specials/SpecialItemByTitle.php b/repo/includes/specials/SpecialItemByTitle.php index 5267cad..626a024 100644 --- a/repo/includes/specials/SpecialItemByTitle.php +++ b/repo/includes/specials/SpecialItemByTitle.php @@ -53,16 +53,16 @@ // args $name, $restriction, $listed parent::__construct( 'ItemByTitle', '', true ); - $settings = WikibaseRepo::getDefaultInstance()->getSettings(); + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); $this->initSettings( - $settings->getSetting( 'siteLinkGroups' ) + $wikibaseRepo->getSettings()->getSetting( 'siteLinkGroups' ) ); $this->initServices( - WikibaseRepo::getDefaultInstance()->getEntityTitleLookup(), - WikibaseRepo::getDefaultInstance()->getSiteStore(), - WikibaseRepo::getDefaultInstance()->getStore()->newSiteLinkStore() + $wikibaseRepo->getEntityTitleLookup(), + $wikibaseRepo->getSiteStore(), + $wikibaseRepo->getStore()->newSiteLinkStore() ); } diff --git a/repo/includes/specials/SpecialModifyTerm.php b/repo/includes/specials/SpecialModifyTerm.php index 143d03b..a37b7ab 100644 --- a/repo/includes/specials/SpecialModifyTerm.php +++ b/repo/includes/specials/SpecialModifyTerm.php @@ -60,9 +60,10 @@ public function __construct( $title, $restriction = 'edit' ) { parent::__construct( $title, $restriction ); - $changeOpFactoryProvider = WikibaseRepo::getDefaultInstance()->getChangeOpFactoryProvider(); + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); + $changeOpFactoryProvider = $wikibaseRepo->getChangeOpFactoryProvider(); $this->termChangeOpFactory = $changeOpFactoryProvider->getFingerprintChangeOpFactory(); - $this->termsLanguages = WikibaseRepo::getDefaultInstance()->getTermsLanguages(); + $this->termsLanguages = $wikibaseRepo->getTermsLanguages(); } /** diff --git a/repo/includes/specials/SpecialNewEntity.php b/repo/includes/specials/SpecialNewEntity.php index c8ac174..a63f4d0 100644 --- a/repo/includes/specials/SpecialNewEntity.php +++ b/repo/includes/specials/SpecialNewEntity.php @@ -74,11 +74,12 @@ public function __construct( $name, $restriction = 'createpage' ) { parent::__construct( $name, $restriction ); + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); // TODO: find a way to inject these - $this->summaryFormatter = WikibaseRepo::getDefaultInstance()->getSummaryFormatter(); - $this->languageCodes = WikibaseRepo::getDefaultInstance()->getTermsLanguages()->getLanguages(); + $this->summaryFormatter = $wikibaseRepo->getSummaryFormatter(); + $this->languageCodes = $wikibaseRepo->getTermsLanguages()->getLanguages(); - $settings = WikibaseRepo::getDefaultInstance()->getSettings(); + $settings = $wikibaseRepo->getSettings(); $this->rightsUrl = $settings->getSetting( 'dataRightsUrl' ); $this->rightsText = $settings->getSetting( 'dataRightsText' ); diff --git a/repo/maintenance/rebuildItemsPerSite.php b/repo/maintenance/rebuildItemsPerSite.php index 8773c71..b8e4c0b 100644 --- a/repo/maintenance/rebuildItemsPerSite.php +++ b/repo/maintenance/rebuildItemsPerSite.php @@ -48,19 +48,20 @@ ); $siteLinkTable = new SiteLinkTable( 'wb_items_per_site', false ); + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); // Use an uncached EntityLookup here to avoid memory leaks - $entityLookup = WikibaseRepo::getDefaultInstance()->getEntityLookup( 'uncached' ); - $entityPrefetcher = WikibaseRepo::getDefaultInstance()->getStore()->getEntityPrefetcher(); + $entityLookup = $wikibaseRepo->getEntityLookup( 'uncached' ); + $store = $wikibaseRepo->getStore(); $builder = new ItemsPerSiteBuilder( $siteLinkTable, $entityLookup, - $entityPrefetcher + $store->getEntityPrefetcher() ); $builder->setReporter( $reporter ); $builder->setBatchSize( $batchSize ); - $entityPerPage = WikibaseRepo::getDefaultInstance()->getStore()->newEntityPerPage(); + $entityPerPage = $store->newEntityPerPage(); $stream = new EntityPerPageIdPager( $entityPerPage, 'item' ); // Now <s>kill</s> fix the table diff --git a/repo/tests/phpunit/includes/Dumpers/JsonDumpGeneratorTest.php b/repo/tests/phpunit/includes/Dumpers/JsonDumpGeneratorTest.php index 55dfadd..6ed8afc 100644 --- a/repo/tests/phpunit/includes/Dumpers/JsonDumpGeneratorTest.php +++ b/repo/tests/phpunit/includes/Dumpers/JsonDumpGeneratorTest.php @@ -48,12 +48,13 @@ protected function setUp() { parent::setUp(); + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); $serializerOptions = SerializerFactory::OPTION_SERIALIZE_MAIN_SNAKS_WITHOUT_HASH + SerializerFactory::OPTION_SERIALIZE_REFERENCE_SNAKS_WITHOUT_HASH; $this->serializerFactory = new SerializerFactory( new DataValueSerializer(), $serializerOptions ); $this->deserializerFactory = new DeserializerFactory( - WikibaseRepo::getDefaultInstance()->getDataValueDeserializer(), - WikibaseRepo::getDefaultInstance()->getEntityIdParser() + $wikibaseRepo->getDataValueDeserializer(), + $wikibaseRepo->getEntityIdParser() ); } diff --git a/repo/tests/phpunit/includes/EntityModificationTestHelper.php b/repo/tests/phpunit/includes/EntityModificationTestHelper.php index 821d3bf..4c95d35 100644 --- a/repo/tests/phpunit/includes/EntityModificationTestHelper.php +++ b/repo/tests/phpunit/includes/EntityModificationTestHelper.php @@ -47,9 +47,10 @@ private $redirectResolvingEntityLookup; public function __construct() { - $this->idParser = WikibaseRepo::getDefaultInstance()->getEntityIdParser(); - $this->serializer = WikibaseRepo::getDefaultInstance()->getInternalEntitySerializer(); - $this->deserializer = WikibaseRepo::getDefaultInstance()->getInternalEntityDeserializer(); + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); + $this->idParser = $wikibaseRepo->getEntityIdParser(); + $this->serializer = $wikibaseRepo->getInternalEntitySerializer(); + $this->deserializer = $wikibaseRepo->getInternalEntityDeserializer(); $this->mockRepository = new MockRepository(); $this->redirectResolvingEntityLookup = new RedirectResolvingEntityLookup( $this->mockRepository ); } diff --git a/repo/tests/phpunit/includes/Hooks/OutputPageJsConfigHookHandlerTest.php b/repo/tests/phpunit/includes/Hooks/OutputPageJsConfigHookHandlerTest.php index f7fb45f..5ce80ef 100644 --- a/repo/tests/phpunit/includes/Hooks/OutputPageJsConfigHookHandlerTest.php +++ b/repo/tests/phpunit/includes/Hooks/OutputPageJsConfigHookHandlerTest.php @@ -2,6 +2,7 @@ namespace Wikibase\Repo\Tests\Hooks; +use MediaWikiTestCase; use RequestContext; use Title; use Wikibase\DataModel\Entity\EntityId; @@ -21,7 +22,7 @@ * @licence GNU GPL v2+ * @author Katie Filbert < aude.w...@gmail.com > */ -class OutputPageJsConfigHookHandlerTest extends \MediaWikiTestCase { +class OutputPageJsConfigHookHandlerTest extends MediaWikiTestCase { /** * @dataProvider handleProvider diff --git a/repo/tests/phpunit/includes/Interactors/ItemMergeInteractorTest.php b/repo/tests/phpunit/includes/Interactors/ItemMergeInteractorTest.php index 2294d27..7100365 100644 --- a/repo/tests/phpunit/includes/Interactors/ItemMergeInteractorTest.php +++ b/repo/tests/phpunit/includes/Interactors/ItemMergeInteractorTest.php @@ -106,12 +106,13 @@ $user = $GLOBALS['wgUser']; } - $summaryFormatter = WikibaseRepo::getDefaultInstance()->getSummaryFormatter(); + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); + $summaryFormatter = $wikibaseRepo->getSummaryFormatter(); //XXX: we may want or need to mock some of these services $changeOpsFactory = new MergeChangeOpsFactory( - WikibaseRepo::getDefaultInstance()->getEntityConstraintProvider(), - WikibaseRepo::getDefaultInstance()->getChangeOpFactoryProvider(), + $wikibaseRepo->getEntityConstraintProvider(), + $wikibaseRepo->getChangeOpFactoryProvider(), MockSiteStore::newFromTestSites() ); diff --git a/repo/tests/phpunit/includes/ItemMoveTest.php b/repo/tests/phpunit/includes/ItemMoveTest.php index 9f61c13..f32a8a9 100644 --- a/repo/tests/phpunit/includes/ItemMoveTest.php +++ b/repo/tests/phpunit/includes/ItemMoveTest.php @@ -51,20 +51,20 @@ //TODO: remove global TestSites DB setup once we can inject sites sanely. static $hasSites = false; + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); + if ( !$hasSites ) { - $sitesTable = WikibaseRepo::getDefaultInstance()->getSiteStore(); + $sitesTable = $wikibaseRepo->getSiteStore(); $sitesTable->clear(); $sitesTable->saveSites( TestSites::getSites() ); $hasSites = true; } - $store = WikibaseRepo::getDefaultInstance()->getEntityStore(); - $item = new Item(); - $this->entityRevision = $store->saveEntity( $item, '', $GLOBALS['wgUser'], EDIT_NEW ); + $this->entityRevision = $wikibaseRepo->getEntityStore()->saveEntity( $item, '', $GLOBALS['wgUser'], EDIT_NEW ); $id = $this->entityRevision->getEntity()->getId(); - $this->itemTitle = WikibaseRepo::getDefaultInstance()->getEntityTitleLookup()->getTitleForId( $id ); + $this->itemTitle = $wikibaseRepo->getEntityTitleLookup()->getTitleForId( $id ); $title = Title::newFromText( 'wbmovetest', $this->getDefaultWikitextNS() ); $this->page = new WikiPage( $title ); diff --git a/repo/tests/phpunit/includes/Notifications/DatabaseChangeTransmitterTest.php b/repo/tests/phpunit/includes/Notifications/DatabaseChangeTransmitterTest.php index 876e56a..4f21097 100644 --- a/repo/tests/phpunit/includes/Notifications/DatabaseChangeTransmitterTest.php +++ b/repo/tests/phpunit/includes/Notifications/DatabaseChangeTransmitterTest.php @@ -22,12 +22,13 @@ class DatabaseChangeTransmitterTest extends \MediaWikiTestCase { public function testTransmitChange() { - $factory = WikibaseRepo::getDefaultInstance()->getEntityChangeFactory(); + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); + $factory = $wikibaseRepo->getEntityChangeFactory(); $change = $factory->newForEntity( EntityChange::ADD, new ItemId( 'Q21389475' ) ); $change->setField( 'time', wfTimestamp( TS_MW ) ); $db = wfGetDB( DB_MASTER ); - $tableName = WikibaseRepo::getDefaultInstance()->getStore()->getChangesTable()->getName(); + $tableName = $wikibaseRepo->getStore()->getChangesTable()->getName(); $db->delete( $tableName, '*', __METHOD__ ); $this->tablesUsed[] = $tableName; diff --git a/repo/tests/phpunit/includes/api/AvailableBadgesTest.php b/repo/tests/phpunit/includes/api/AvailableBadgesTest.php index efce12e..a0b21b6 100644 --- a/repo/tests/phpunit/includes/api/AvailableBadgesTest.php +++ b/repo/tests/phpunit/includes/api/AvailableBadgesTest.php @@ -30,14 +30,18 @@ protected function setUp() { parent::setUp(); + // Allow some badges for testing - self::$oldBadgeItems = WikibaseRepo::getDefaultInstance()->getSettings()->getSetting( 'badgeItems' ); - WikibaseRepo::getDefaultInstance()->getSettings()->setSetting( 'badgeItems', self::$badgeItems ); + $settings = WikibaseRepo::getDefaultInstance()->getSettings(); + self::$oldBadgeItems = $settings->getSetting( 'badgeItems' ); + $settings->setSetting( 'badgeItems', self::$badgeItems ); } protected function tearDown() { parent::tearDown(); - WikibaseRepo::getDefaultInstance()->getSettings()->setSetting( 'badgeItems', self::$oldBadgeItems ); + + $settings = WikibaseRepo::getDefaultInstance()->getSettings(); + $settings->setSetting( 'badgeItems', self::$oldBadgeItems ); } public function testExecute() { diff --git a/repo/tests/phpunit/includes/api/CreateRedirectTest.php b/repo/tests/phpunit/includes/api/CreateRedirectTest.php index 8c3222e..b6ecc06 100644 --- a/repo/tests/phpunit/includes/api/CreateRedirectTest.php +++ b/repo/tests/phpunit/includes/api/CreateRedirectTest.php @@ -112,27 +112,24 @@ $module = new CreateRedirect( $main, 'wbcreateredirect' ); - $idParser = new BasicEntityIdParser(); - + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); $errorReporter = new ApiErrorReporter( $module, - WikibaseRepo::getDefaultInstance()->getExceptionLocalizer(), + $wikibaseRepo->getExceptionLocalizer(), Language::factory( 'en' ) ); - - $summaryFormatter = WikibaseRepo::getDefaultInstance()->getSummaryFormatter(); $context = new RequestContext(); $context->setRequest( new FauxRequest() ); $module->setServices( - $idParser, + new BasicEntityIdParser(), $errorReporter, new RedirectCreationInteractor( $this->mockRepository, $this->mockRepository, $this->getPermissionCheckers(), - $summaryFormatter, + $wikibaseRepo->getSummaryFormatter(), $user, $this->getMockEditFilterHookRunner(), $this->mockRepository diff --git a/repo/tests/phpunit/includes/api/EditEntityTest.php b/repo/tests/phpunit/includes/api/EditEntityTest.php index 805248f..d0f3893 100644 --- a/repo/tests/phpunit/includes/api/EditEntityTest.php +++ b/repo/tests/phpunit/includes/api/EditEntityTest.php @@ -38,7 +38,8 @@ parent::setup(); if ( !isset( self::$hasSetup ) ) { - $store = WikibaseRepo::getDefaultInstance()->getEntityStore(); + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); + $store = $wikibaseRepo->getEntityStore(); $prop = Property::newFromType( 'string' ); $store->saveEntity( $prop, 'EditEntityTestP56', $GLOBALS['wgUser'], EDIT_NEW ); @@ -68,7 +69,7 @@ $store->saveEntity( $badge, 'EditEntityTestQ32', $GLOBALS['wgUser'], EDIT_NEW ); self::$idMap['%Q32%'] = $badge->getId()->getSerialization(); - WikibaseRepo::getDefaultInstance()->getSettings()->setSetting( 'badgeItems', array( + $wikibaseRepo->getSettings()->setSetting( 'badgeItems', array( self::$idMap['%Q42%'] => '', self::$idMap['%Q149%'] => '', 'Q99999' => '', // Just in case we have a wrong config diff --git a/repo/tests/phpunit/includes/api/EditPageTest.php b/repo/tests/phpunit/includes/api/EditPageTest.php index 6c2ef0d..d8366b7 100644 --- a/repo/tests/phpunit/includes/api/EditPageTest.php +++ b/repo/tests/phpunit/includes/api/EditPageTest.php @@ -30,7 +30,8 @@ * @group API */ public function testEditItemDirectly() { - $store = WikibaseRepo::getDefaultInstance()->getEntityStore(); + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); + $store = $wikibaseRepo->getEntityStore(); $item = new Item(); //@todo: do this with all kinds of entities. $item->setLabel( "en", "EditPageTest" ); @@ -38,10 +39,10 @@ $item->setLabel( "de", "EditPageTest" ); - $data = WikibaseRepo::getDefaultInstance()->getInternalEntitySerializer()->serialize( $item ); + $data = $wikibaseRepo->getInternalEntitySerializer()->serialize( $item ); $text = json_encode( $data ); - $title = WikibaseRepo::getDefaultInstance()->getEntityTitleLookup()->getTitleForId( $item->getId() ); + $title = $wikibaseRepo->getEntityTitleLookup()->getTitleForId( $item->getId() ); // try to update the item with valid data via the edit action $this->setExpectedException( 'UsageException' ); diff --git a/repo/tests/phpunit/includes/api/MergeItemsTest.php b/repo/tests/phpunit/includes/api/MergeItemsTest.php index 968eda8..9f2bf6b 100644 --- a/repo/tests/phpunit/includes/api/MergeItemsTest.php +++ b/repo/tests/phpunit/includes/api/MergeItemsTest.php @@ -122,28 +122,28 @@ /** * @param MergeItems $module + * @param EntityRedirect|null $expectedRedirect */ private function overrideServices( MergeItems $module, EntityRedirect $expectedRedirect = null ) { $idParser = new BasicEntityIdParser(); + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); $errorReporter = new ApiErrorReporter( $module, - WikibaseRepo::getDefaultInstance()->getExceptionLocalizer(), + $wikibaseRepo->getExceptionLocalizer(), Language::factory( 'en' ) ); $mockContext = $this->getMock( 'RequestContext' ); - $wikibaseRepo = WikibaseRepo::getDefaultInstance(); $apiHelperFactory = $wikibaseRepo->getApiHelperFactory( $mockContext ); $resultBuilder = $apiHelperFactory->getResultBuilder( $module ); - $summaryFormatter = $wikibaseRepo->getSummaryFormatter(); $changeOpsFactoryProvider = new ChangeOpFactoryProvider( $this->getConstraintProvider(), new GuidGenerator(), - WikibaseRepo::getDefaultInstance()->getStatementGuidValidator(), - WikibaseRepo::getDefaultInstance()->getStatementGuidParser(), + $wikibaseRepo->getStatementGuidValidator(), + $wikibaseRepo->getStatementGuidParser(), $this->getSnakValidator(), $this->getTermValidatorFactory(), new MockSiteStore( TestSites::getSites() ) @@ -158,7 +158,7 @@ $this->mockRepository, $this->mockRepository, $this->getPermissionCheckers(), - $summaryFormatter, + $wikibaseRepo->getSummaryFormatter(), $module->getUser(), $this->getMockRedirectCreationInteractor( $expectedRedirect ) ) diff --git a/repo/tests/phpunit/includes/api/ParseValueTest.php b/repo/tests/phpunit/includes/api/ParseValueTest.php index 734394b..a7012a2 100644 --- a/repo/tests/phpunit/includes/api/ParseValueTest.php +++ b/repo/tests/phpunit/includes/api/ParseValueTest.php @@ -41,8 +41,9 @@ $module = new ParseValue( $main, 'wbparsevalue' ); - $exceptionLocalizer = WikibaseRepo::getDefaultInstance()->getExceptionLocalizer(); - $validatorErrorLocalizer = WikibaseRepo::getDefaultInstance()->getValidatorErrorLocalizer(); + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); + $exceptionLocalizer = $wikibaseRepo->getExceptionLocalizer(); + $validatorErrorLocalizer = $wikibaseRepo->getValidatorErrorLocalizer(); $errorReporter = new ApiErrorReporter( $module, diff --git a/repo/tests/phpunit/includes/api/SetClaimValueTest.php b/repo/tests/phpunit/includes/api/SetClaimValueTest.php index 140c0af..0644110 100644 --- a/repo/tests/phpunit/includes/api/SetClaimValueTest.php +++ b/repo/tests/phpunit/includes/api/SetClaimValueTest.php @@ -122,7 +122,8 @@ } public function doTestValidRequest( Entity $entity, $guid, $value, $expectedSummary ) { - $entityLookup = WikibaseRepo::getDefaultInstance()->getEntityLookup(); + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); + $entityLookup = $wikibaseRepo->getEntityLookup(); $obtainedEntity = $entityLookup->getEntity( $entity->getId() ); $claimCount = count( $obtainedEntity->getClaims() ); @@ -146,7 +147,7 @@ /** @var StatementListProvider $obtainedEntity */ $obtainedEntity = $entityLookup->getEntity( $entity->getId() ); - $page = new WikiPage( WikibaseRepo::getDefaultInstance()->getEntityTitleLookup()->getTitleForId( $entity->getId() ) ); + $page = new WikiPage( $wikibaseRepo->getEntityTitleLookup()->getTitleForId( $entity->getId() ) ); $generatedSummary = $page->getRevision()->getComment( Revision::RAW ); $this->assertEquals( $expectedSummary, $generatedSummary, 'Summary mismatch' ); @@ -158,7 +159,7 @@ $this->assertNotNull( $obtainedClaim ); - $dataValue = WikibaseRepo::getDefaultInstance()->getDataValueFactory()->newFromArray( $claim['mainsnak']['datavalue'] ); + $dataValue = $wikibaseRepo->getDataValueFactory()->newFromArray( $claim['mainsnak']['datavalue'] ); $this->assertTrue( $obtainedClaim->getMainSnak()->getDataValue()->equals( $dataValue ) ); } diff --git a/repo/tests/phpunit/includes/api/SetReferenceTest.php b/repo/tests/phpunit/includes/api/SetReferenceTest.php index a92f019..85d350c 100644 --- a/repo/tests/phpunit/includes/api/SetReferenceTest.php +++ b/repo/tests/phpunit/includes/api/SetReferenceTest.php @@ -58,7 +58,8 @@ protected function setUp() { parent::setUp(); - $store = WikibaseRepo::getDefaultInstance()->getEntityStore(); + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); + $store = $wikibaseRepo->getEntityStore(); if ( !self::$propertyIds ) { self::$propertyIds = array(); @@ -78,8 +79,8 @@ SerializerFactory::OPTION_SERIALIZE_REFERENCE_SNAKS_WITHOUT_HASH ); $this->deserializerFactory = new DeserializerFactory( - WikibaseRepo::getDefaultInstance()->getDataValueDeserializer(), - WikibaseRepo::getDefaultInstance()->getEntityIdParser() + $wikibaseRepo->getDataValueDeserializer(), + $wikibaseRepo->getEntityIdParser() ); } diff --git a/repo/tests/phpunit/includes/api/SetSiteLinkTest.php b/repo/tests/phpunit/includes/api/SetSiteLinkTest.php index 206e1c6..5c5586c 100644 --- a/repo/tests/phpunit/includes/api/SetSiteLinkTest.php +++ b/repo/tests/phpunit/includes/api/SetSiteLinkTest.php @@ -362,7 +362,8 @@ parent::setup(); if ( !isset( self::$hasSetup ) ) { - $store = WikibaseRepo::getDefaultInstance()->getEntityStore(); + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); + $store = $wikibaseRepo->getEntityStore(); $this->initTestEntities( array( 'StringProp', 'Leipzig', 'Berlin' ) ); @@ -378,7 +379,7 @@ $store->saveEntity( $badge, 'SetSiteLinkTestOther', $GLOBALS['wgUser'], EDIT_NEW ); self::$otherItemId = $badge->getId(); - WikibaseRepo::getDefaultInstance()->getSettings()->setSetting( 'badgeItems', array( + $wikibaseRepo->getSettings()->setSetting( 'badgeItems', array( self::$gaItemId->getSerialization() => '', self::$faItemId->getSerialization() => '', 'Q99999' => '', // Just in case we have a wrong config diff --git a/repo/tests/phpunit/includes/api/StatementModificationHelperTest.php b/repo/tests/phpunit/includes/api/StatementModificationHelperTest.php index b435584..3358b13 100644 --- a/repo/tests/phpunit/includes/api/StatementModificationHelperTest.php +++ b/repo/tests/phpunit/includes/api/StatementModificationHelperTest.php @@ -84,6 +84,7 @@ } private function getNewInstance() { + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); $api = new ApiMain(); $errorReporter = new ApiErrorReporter( @@ -92,14 +93,12 @@ $api->getLanguage() ); - $helper = new StatementModificationHelper( - WikibaseRepo::getDefaultInstance()->getSnakConstructionService(), - WikibaseRepo::getDefaultInstance()->getEntityIdParser(), - WikibaseRepo::getDefaultInstance()->getStatementGuidValidator(), + return new StatementModificationHelper( + $wikibaseRepo->getSnakConstructionService(), + $wikibaseRepo->getEntityIdParser(), + $wikibaseRepo->getStatementGuidValidator(), $errorReporter ); - - return $helper; } } diff --git a/repo/tests/phpunit/includes/api/WikibaseApiTestCase.php b/repo/tests/phpunit/includes/api/WikibaseApiTestCase.php index fa475da..6a8110b 100644 --- a/repo/tests/phpunit/includes/api/WikibaseApiTestCase.php +++ b/repo/tests/phpunit/includes/api/WikibaseApiTestCase.php @@ -128,9 +128,10 @@ */ protected function getTestEntityTitle( $handle ) { try { + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); $idString = EntityTestHelper::getId( $handle ); - $id = WikibaseRepo::getDefaultInstance()->getEntityIdParser()->parse( $idString ); - $title = WikibaseRepo::getDefaultInstance()->getEntityTitleLookup()->getTitleForId( $id ); + $id = $wikibaseRepo->getEntityIdParser()->parse( $idString ); + $title = $wikibaseRepo->getEntityTitleLookup()->getTitleForId( $id ); } catch ( OutOfBoundsException $ex ) { $title = null; } diff --git a/repo/tests/phpunit/includes/content/DeferredDecodingEntityHolderTest.php b/repo/tests/phpunit/includes/content/DeferredDecodingEntityHolderTest.php index 8e937a7..3456058 100644 --- a/repo/tests/phpunit/includes/content/DeferredDecodingEntityHolderTest.php +++ b/repo/tests/phpunit/includes/content/DeferredDecodingEntityHolderTest.php @@ -43,10 +43,11 @@ * @return EntityHolder */ private function newHolder( Entity $entity, $expectedEntityType = null, EntityId $expectedEntityId = null ) { + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); $codec = new EntityContentDataCodec( new BasicEntityIdParser(), - WikibaseRepo::getDefaultInstance()->getInternalEntitySerializer(), - WikibaseRepo::getDefaultInstance()->getInternalEntityDeserializer() + $wikibaseRepo->getInternalEntitySerializer(), + $wikibaseRepo->getInternalEntityDeserializer() ); $blob = $codec->encodeEntity( $entity, CONTENT_FORMAT_JSON ); diff --git a/repo/tests/phpunit/includes/specials/SpecialMergeItemsTest.php b/repo/tests/phpunit/includes/specials/SpecialMergeItemsTest.php index 648a786..e178817 100644 --- a/repo/tests/phpunit/includes/specials/SpecialMergeItemsTest.php +++ b/repo/tests/phpunit/includes/specials/SpecialMergeItemsTest.php @@ -98,12 +98,12 @@ * @param User $user */ private function overrideServices( SpecialMergeItems $page, User $user ) { - $idParser = WikibaseRepo::getDefaultInstance()->getEntityIdParser(); - $summaryFormatter = WikibaseRepo::getDefaultInstance()->getSummaryFormatter(); + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); + $summaryFormatter = $wikibaseRepo->getSummaryFormatter(); $changeOpsFactory = new MergeChangeOpsFactory( - WikibaseRepo::getDefaultInstance()->getEntityConstraintProvider(), - WikibaseRepo::getDefaultInstance()->getChangeOpFactoryProvider(), + $wikibaseRepo->getEntityConstraintProvider(), + $wikibaseRepo->getChangeOpFactoryProvider(), MockSiteStore::newFromTestSites() ); @@ -131,7 +131,7 @@ } ) ); $page->initServices( - $idParser, + $wikibaseRepo->getEntityIdParser(), $exceptionLocalizer, new TokenCheckInteractor( $user ), new ItemMergeInteractor( diff --git a/repo/tests/phpunit/includes/specials/SpecialRedirectEntityTest.php b/repo/tests/phpunit/includes/specials/SpecialRedirectEntityTest.php index 53a6d56..6d20227 100644 --- a/repo/tests/phpunit/includes/specials/SpecialRedirectEntityTest.php +++ b/repo/tests/phpunit/includes/specials/SpecialRedirectEntityTest.php @@ -84,8 +84,7 @@ * @param User $user */ private function overrideServices( SpecialRedirectEntity $page, User $user ) { - $idParser = WikibaseRepo::getDefaultInstance()->getEntityIdParser(); - $summaryFormatter = WikibaseRepo::getDefaultInstance()->getSummaryFormatter(); + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); $exceptionLocalizer = $this->getMock( 'Wikibase\Repo\Localizer\ExceptionLocalizer' ); $exceptionLocalizer->expects( $this->any() ) @@ -111,14 +110,14 @@ } ) ); $page->initServices( - $idParser, + $wikibaseRepo->getEntityIdParser(), $exceptionLocalizer, new TokenCheckInteractor( $user ), new RedirectCreationInteractor( $this->mockRepository, $this->mockRepository, $this->getPermissionCheckers(), - $summaryFormatter, + $wikibaseRepo->getSummaryFormatter(), $user, $this->getMockEditFilterHookRunner(), $this->mockRepository diff --git a/repo/tests/phpunit/includes/specials/SpecialSetSiteLinkTest.php b/repo/tests/phpunit/includes/specials/SpecialSetSiteLinkTest.php index f50e236..d155fcb 100644 --- a/repo/tests/phpunit/includes/specials/SpecialSetSiteLinkTest.php +++ b/repo/tests/phpunit/includes/specials/SpecialSetSiteLinkTest.php @@ -80,7 +80,7 @@ private static $redirectId = null; /** - * @var array + * @var string[] */ private static $oldBadgeItemsSetting; @@ -102,12 +102,15 @@ $this->addBadgeMatcher(); } - self::$oldBadgeItemsSetting = WikibaseRepo::getDefaultInstance()->getSettings()->getSetting( 'badgeItems' ); - WikibaseRepo::getDefaultInstance()->getSettings()->setSetting( 'badgeItems', array( self::$badgeId => '' ) ); + $settings = WikibaseRepo::getDefaultInstance()->getSettings(); + self::$oldBadgeItemsSetting = $settings->getSetting( 'badgeItems' ); + $settings->setSetting( 'badgeItems', array( self::$badgeId => '' ) ); } protected function tearDown() { - WikibaseRepo::getDefaultInstance()->getSettings()->setSetting( 'badgeItems', self::$oldBadgeItemsSetting ); + $settings = WikibaseRepo::getDefaultInstance()->getSettings(); + $settings->setSetting( 'badgeItems', self::$oldBadgeItemsSetting ); + parent::tearDown(); } diff --git a/repo/tests/phpunit/includes/store/sql/WikiPageEntityStoreTest.php b/repo/tests/phpunit/includes/store/sql/WikiPageEntityStoreTest.php index 27d5c5c..9200b77 100644 --- a/repo/tests/phpunit/includes/store/sql/WikiPageEntityStoreTest.php +++ b/repo/tests/phpunit/includes/store/sql/WikiPageEntityStoreTest.php @@ -48,10 +48,11 @@ */ protected function createStoreAndLookup() { // make sure the term index is empty to avoid conflicts. - WikibaseRepo::getDefaultInstance()->getStore()->getTermIndex()->clear(); + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); + $wikibaseRepo->getStore()->getTermIndex()->clear(); //NOTE: we want to test integration of WikiPageEntityRevisionLookup and WikiPageEntityStore here! - $contentCodec = WikibaseRepo::getDefaultInstance()->getEntityContentDataCodec(); + $contentCodec = $wikibaseRepo->getEntityContentDataCodec(); $lookup = new WikiPageEntityRevisionLookup( $contentCodec, @@ -59,10 +60,8 @@ false ); - $typeMap = WikibaseRepo::getDefaultInstance()->getContentModelMappings(); - $store = new WikiPageEntityStore( - new EntityContentFactory( $typeMap ), + new EntityContentFactory( $wikibaseRepo->getContentModelMappings() ), new SqlIdGenerator( wfGetLB() ) ); -- To view, visit https://gerrit.wikimedia.org/r/203297 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2777f27acaaf2c0e072c8e703c38adc0864c1c31 Gerrit-PatchSet: 4 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de> Gerrit-Reviewer: Addshore <addshorew...@gmail.com> Gerrit-Reviewer: Adrian Lang <adrian.he...@wikimedia.de> Gerrit-Reviewer: Bene <benestar.wikime...@gmail.com> Gerrit-Reviewer: Hoo man <h...@online.de> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits