[MediaWiki-commits] [Gerrit] Stop using ApiWikibase in GetEntities - change (mediawiki...Wikibase)
jenkins-bot has submitted this change and it was merged. Change subject: Stop using ApiWikibase in GetEntities .. Stop using ApiWikibase in GetEntities Change-Id: I846d71dd5357d88104df010f70f51096aea802ae --- M repo/includes/api/GetEntities.php 1 file changed, 34 insertions(+), 8 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved jenkins-bot: Verified diff --git a/repo/includes/api/GetEntities.php b/repo/includes/api/GetEntities.php index 3751b23..9a02832 100644 --- a/repo/includes/api/GetEntities.php +++ b/repo/includes/api/GetEntities.php @@ -5,12 +5,14 @@ use ApiBase; use ApiMain; use Wikibase\DataModel\Entity\EntityId; +use Wikibase\DataModel\Entity\EntityIdParser; use Wikibase\DataModel\Entity\EntityIdParsingException; use Wikibase\EntityRevision; use Wikibase\LanguageFallbackChainFactory; use Wikibase\Lib\Serializers\EntitySerializer; use Wikibase\Lib\Serializers\SerializationOptions; use Wikibase\Lib\Store\EntityPrefetcher; +use Wikibase\Lib\Store\EntityRevisionLookup; use Wikibase\Lib\Store\UnresolvedRedirectException; use Wikibase\Repo\SiteLinkTargetProvider; use Wikibase\Repo\WikibaseRepo; @@ -27,7 +29,7 @@ * @author Michał Łazowik * @author Adam Shorland */ -class GetEntities extends ApiWikibase { +class GetEntities extends ApiBase { /** * @var StringNormalizer @@ -60,6 +62,21 @@ private $errorReporter; /** +* @var ResultBuilder +*/ + private $resultBuilder; + + /** +* @var EntityRevisionLookup +*/ + private $entityRevisionLookup; + + /** +* @var EntityIdParser +*/ + private $idParser; + + /** * @param ApiMain $mainModule * @param string $moduleName * @param string $modulePrefix @@ -72,8 +89,11 @@ $apiHelperFactory = $wikibaseRepo->getApiHelperFactory( $this->getContext() ); $this->errorReporter = $apiHelperFactory->getErrorReporter( $this ); + $this->resultBuilder = $apiHelperFactory->getResultBuilder( $this ); $this->stringNormalizer = $wikibaseRepo->getStringNormalizer(); $this->languageFallbackChainFactory = $wikibaseRepo->getLanguageFallbackChainFactory(); + $this->entityRevisionLookup = $wikibaseRepo->getEntityRevisionLookup(); + $this->idParser = $wikibaseRepo->getEntityIdParser(); $this->siteLinkTargetProvider = new SiteLinkTargetProvider( $wikibaseRepo->getSiteStore(), @@ -109,7 +129,7 @@ //todo remove once result builder is used... (what exactly does this do?) $this->getResult()->addIndexedTagName( array( 'entities' ), 'entity' ); - $this->getResultBuilder()->markSuccess( 1 ); + $this->resultBuilder->markSuccess( 1 ); } /** @@ -135,7 +155,7 @@ if ( isset( $params['ids'] ) ) { foreach ( $params['ids'] as $id ) { try { - $ids[] = $this->getIdParser()->parse( $id ); + $ids[] = $this->idParser->parse( $id ); } catch ( EntityIdParsingException $e ) { $this->errorReporter->dieError( "Invalid id: $id", 'no-such-entity' ); } @@ -165,7 +185,7 @@ $siteLinkStore = WikibaseRepo::getDefaultInstance()->getStore()->newSiteLinkStore(); $siteStore = WikibaseRepo::getDefaultInstance()->getSiteStore(); return new ItemByTitleHelper( - $this->getResultBuilder(), + $this->resultBuilder, $siteLinkStore, $siteStore, $this->stringNormalizer @@ -177,7 +197,7 @@ */ private function addMissingItemsToResult( $missingItems ) { foreach ( $missingItems as $missingItem ) { - $this->getResultBuilder()->addMissingEntity( null, $missingItem ); + $this->resultBuilder->addMissingEntity( null, $missingItem ); } } @@ -227,7 +247,7 @@ $entityRevision = null; try { - $entityRevision = $this->getEntityRevisionLookup()->getEntityRevision( $entityId ); + $entityRevision = $this->entityRevisionLookup->getEntityRevision( $entityId ); } catch ( UnresolvedRedirectException $ex ) { if ( $resolveRedirects ) { $entityId = $ex->getRedirectTargetId(); @@ -247,13 +267,19 @@ */ private function handleEntity( $sourceEntityId, EntityRevision $entityRevision = null, ar
[MediaWiki-commits] [Gerrit] Stop using ApiWikibase in GetEntities - change (mediawiki...Wikibase)
Addshore has uploaded a new change for review. https://gerrit.wikimedia.org/r/222905 Change subject: Stop using ApiWikibase in GetEntities .. Stop using ApiWikibase in GetEntities Change-Id: I846d71dd5357d88104df010f70f51096aea802ae --- M repo/includes/api/GetEntities.php 1 file changed, 34 insertions(+), 8 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/05/222905/1 diff --git a/repo/includes/api/GetEntities.php b/repo/includes/api/GetEntities.php index 3751b23..9a02832 100644 --- a/repo/includes/api/GetEntities.php +++ b/repo/includes/api/GetEntities.php @@ -5,12 +5,14 @@ use ApiBase; use ApiMain; use Wikibase\DataModel\Entity\EntityId; +use Wikibase\DataModel\Entity\EntityIdParser; use Wikibase\DataModel\Entity\EntityIdParsingException; use Wikibase\EntityRevision; use Wikibase\LanguageFallbackChainFactory; use Wikibase\Lib\Serializers\EntitySerializer; use Wikibase\Lib\Serializers\SerializationOptions; use Wikibase\Lib\Store\EntityPrefetcher; +use Wikibase\Lib\Store\EntityRevisionLookup; use Wikibase\Lib\Store\UnresolvedRedirectException; use Wikibase\Repo\SiteLinkTargetProvider; use Wikibase\Repo\WikibaseRepo; @@ -27,7 +29,7 @@ * @author Michał Łazowik * @author Adam Shorland */ -class GetEntities extends ApiWikibase { +class GetEntities extends ApiBase { /** * @var StringNormalizer @@ -60,6 +62,21 @@ private $errorReporter; /** +* @var ResultBuilder +*/ + private $resultBuilder; + + /** +* @var EntityRevisionLookup +*/ + private $entityRevisionLookup; + + /** +* @var EntityIdParser +*/ + private $idParser; + + /** * @param ApiMain $mainModule * @param string $moduleName * @param string $modulePrefix @@ -72,8 +89,11 @@ $apiHelperFactory = $wikibaseRepo->getApiHelperFactory( $this->getContext() ); $this->errorReporter = $apiHelperFactory->getErrorReporter( $this ); + $this->resultBuilder = $apiHelperFactory->getResultBuilder( $this ); $this->stringNormalizer = $wikibaseRepo->getStringNormalizer(); $this->languageFallbackChainFactory = $wikibaseRepo->getLanguageFallbackChainFactory(); + $this->entityRevisionLookup = $wikibaseRepo->getEntityRevisionLookup(); + $this->idParser = $wikibaseRepo->getEntityIdParser(); $this->siteLinkTargetProvider = new SiteLinkTargetProvider( $wikibaseRepo->getSiteStore(), @@ -109,7 +129,7 @@ //todo remove once result builder is used... (what exactly does this do?) $this->getResult()->addIndexedTagName( array( 'entities' ), 'entity' ); - $this->getResultBuilder()->markSuccess( 1 ); + $this->resultBuilder->markSuccess( 1 ); } /** @@ -135,7 +155,7 @@ if ( isset( $params['ids'] ) ) { foreach ( $params['ids'] as $id ) { try { - $ids[] = $this->getIdParser()->parse( $id ); + $ids[] = $this->idParser->parse( $id ); } catch ( EntityIdParsingException $e ) { $this->errorReporter->dieError( "Invalid id: $id", 'no-such-entity' ); } @@ -165,7 +185,7 @@ $siteLinkStore = WikibaseRepo::getDefaultInstance()->getStore()->newSiteLinkStore(); $siteStore = WikibaseRepo::getDefaultInstance()->getSiteStore(); return new ItemByTitleHelper( - $this->getResultBuilder(), + $this->resultBuilder, $siteLinkStore, $siteStore, $this->stringNormalizer @@ -177,7 +197,7 @@ */ private function addMissingItemsToResult( $missingItems ) { foreach ( $missingItems as $missingItem ) { - $this->getResultBuilder()->addMissingEntity( null, $missingItem ); + $this->resultBuilder->addMissingEntity( null, $missingItem ); } } @@ -227,7 +247,7 @@ $entityRevision = null; try { - $entityRevision = $this->getEntityRevisionLookup()->getEntityRevision( $entityId ); + $entityRevision = $this->entityRevisionLookup->getEntityRevision( $entityId ); } catch ( UnresolvedRedirectException $ex ) { if ( $resolveRedirects ) { $entityId = $ex->getRedirectTargetId(); @@ -247,13 +267,19 @@ */ private function handleEntity( $sourceEnt