Jeroen De Dauw has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/208160

Change subject: Move service construction code to factory
......................................................................

Move service construction code to factory

Change-Id: I6592d67e8841dea234ec59386f06c69f38700d76
---
M repo/includes/WikibaseRepo.php
M repo/includes/specials/SpecialRedirectEntity.php
2 files changed, 21 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/60/208160/1

diff --git a/repo/includes/WikibaseRepo.php b/repo/includes/WikibaseRepo.php
index 0c7198b..af16b56 100644
--- a/repo/includes/WikibaseRepo.php
+++ b/repo/includes/WikibaseRepo.php
@@ -7,11 +7,13 @@
 use DataValues\Deserializers\DataValueDeserializer;
 use DataValues\Serializers\DataValueSerializer;
 use Deserializers\Deserializer;
+use IContextSource;
 use RuntimeException;
 use Serializers\Serializer;
 use SiteSQLStore;
 use SiteStore;
 use StubObject;
+use User;
 use ValueFormatters\FormatterOptions;
 use ValueFormatters\ValueFormatter;
 use Wikibase\Api\ApiHelperFactory;
@@ -64,6 +66,8 @@
 use Wikibase\Repo\Content\EntityContentFactory;
 use Wikibase\Repo\Content\ItemHandler;
 use Wikibase\Repo\Content\PropertyHandler;
+use Wikibase\Repo\Hooks\EditFilterHookRunner;
+use Wikibase\Repo\Interactors\RedirectCreationInteractor;
 use Wikibase\Repo\Localizer\ChangeOpValidationExceptionLocalizer;
 use Wikibase\Repo\Localizer\MessageParameterFormatter;
 use Wikibase\Repo\Notifications\ChangeNotifier;
@@ -306,6 +310,21 @@
                return $this->getStore()->getEntityRevisionLookup( $uncached );
        }
 
+       public function getRedirectCreator( User $user, IContextSource $context 
) {
+               return new RedirectCreationInteractor(
+                       $this->getEntityRevisionLookup( 'uncached' ),
+                       $this->getEntityStore(),
+                       $this->getEntityPermissionChecker(),
+                       $this->getSummaryFormatter(),
+                       $user,
+                       new EditFilterHookRunner(
+                               $this->getEntityTitleLookup(),
+                               $this->getEntityContentFactory(),
+                               $context
+                       )
+               );
+       }
+
        /**
         * @since 0.5
         *
diff --git a/repo/includes/specials/SpecialRedirectEntity.php 
b/repo/includes/specials/SpecialRedirectEntity.php
index 378e45c..01910ac 100644
--- a/repo/includes/specials/SpecialRedirectEntity.php
+++ b/repo/includes/specials/SpecialRedirectEntity.php
@@ -57,17 +57,9 @@
                        new TokenCheckInteractor(
                                $this->getUser()
                        ),
-                       new RedirectCreationInteractor(
-                               $wikibaseRepo->getEntityRevisionLookup( 
'uncached' ),
-                               $wikibaseRepo->getEntityStore(),
-                               $wikibaseRepo->getEntityPermissionChecker(),
-                               $wikibaseRepo->getSummaryFormatter(),
+                       $wikibaseRepo->getRedirectCreator(
                                $this->getUser(),
-                               new EditFilterHookRunner(
-                                       $wikibaseRepo->getEntityTitleLookup(),
-                                       
$wikibaseRepo->getEntityContentFactory(),
-                                       $this->getContext()
-                               )
+                               $this->getContext()
                        )
                );
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/208160
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6592d67e8841dea234ec59386f06c69f38700d76
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <jeroended...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to