Ladsgroup has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/333965 )
Change subject: Inject SetSiteLink dependencies ...................................................................... Inject SetSiteLink dependencies Bug: T156162 Change-Id: I26ba097e012870261f0829ea8e0a76047d171faa --- M repo/Wikibase.php M repo/includes/Api/SetSiteLink.php 2 files changed, 19 insertions(+), 9 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/65/333965/1 diff --git a/repo/Wikibase.php b/repo/Wikibase.php index 95e1359..b285940 100644 --- a/repo/Wikibase.php +++ b/repo/Wikibase.php @@ -217,7 +217,17 @@ ]; $wgAPIModules['wbeditentity'] = Wikibase\Repo\Api\EditEntity::class; $wgAPIModules['wblinktitles'] = Wikibase\Repo\Api\LinkTitles::class; - $wgAPIModules['wbsetsitelink'] = Wikibase\Repo\Api\SetSiteLink::class; + $wgAPIModules['wbsetsitelink'] = [ + 'class' => Wikibase\Repo\Api\SetSiteLink::class, + 'factory' => function ( ApiMain $mainModule, $moduleName ) { + return new Wikibase\Repo\Api\SetSiteLink( + $mainModule, + $moduleName, + Wikibase\Repo\WikibaseRepo::getDefaultInstance()->getChangeOpFactoryProvider() + ->getSiteLinkChangeOpFactory() + ); + } + ]; $wgAPIModules['wbcreateclaim'] = Wikibase\Repo\Api\CreateClaim::class; $wgAPIModules['wbgetclaims'] = Wikibase\Repo\Api\GetClaims::class; $wgAPIModules['wbremoveclaims'] = Wikibase\Repo\Api\RemoveClaims::class; diff --git a/repo/includes/Api/SetSiteLink.php b/repo/includes/Api/SetSiteLink.php index 3acc7f0..3e46880 100644 --- a/repo/includes/Api/SetSiteLink.php +++ b/repo/includes/Api/SetSiteLink.php @@ -8,7 +8,6 @@ use Wikibase\DataModel\Entity\EntityDocument; use Wikibase\DataModel\Entity\Item; use Wikibase\DataModel\SiteLinkList; -use Wikibase\Repo\WikibaseRepo; /** * API module to associate a page on a site with a Wikibase entity or remove an already made such association. @@ -32,15 +31,16 @@ /** * @param ApiMain $mainModule * @param string $moduleName - * @param string $modulePrefix + * @param SiteLinkChangeOpFactory $siteLinkChangeOpFactory */ - public function __construct( ApiMain $mainModule, $moduleName, $modulePrefix = '' ) { - parent::__construct( $mainModule, $moduleName, $modulePrefix ); + public function __construct( + ApiMain $mainModule, + $moduleName, + SiteLinkChangeOpFactory $siteLinkChangeOpFactory + ) { + parent::__construct( $mainModule, $moduleName ); - $wikibaseRepo = WikibaseRepo::getDefaultInstance(); - $changeOpFactoryProvider = $wikibaseRepo->getChangeOpFactoryProvider(); - - $this->siteLinkChangeOpFactory = $changeOpFactoryProvider->getSiteLinkChangeOpFactory(); + $this->siteLinkChangeOpFactory = $siteLinkChangeOpFactory; } /** -- To view, visit https://gerrit.wikimedia.org/r/333965 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I26ba097e012870261f0829ea8e0a76047d171faa Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Ladsgroup <ladsgr...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits