assertRequiredOptions( self::CONSTRUCTOR_OPTIONS ); $this->revisionStore = $revisionStore; $this->revisionRenderer = $revisionRenderer; $this->slotRoleRegistry = $slotRoleRegistry; $this->parserCache = $parserCache; $this->jobQueueGroup = $jobQueueGroup; $this->contLang = $contLang; $this->loadbalancerFactory = $loadbalancerFactory; $this->contentHandlerFactory = $contentHandlerFactory; $this->eventDispatcher = $eventDispatcher; $this->hookContainer = $hookContainer; $this->editResultCache = $editResultCache; $this->logger = $logger; $this->options = $options; $this->userGroupManager = $userGroupManager; $this->titleFormatter = $titleFormatter; $this->contentTransformer = $contentTransformer; $this->pageEditStash = $pageEditStash; $this->mainWANObjectCache = $mainWANObjectCache; $this->softwareTags = $softwareTags; $this->wikiPageFactory = $wikiPageFactory; $this->changeTagsStore = $changeTagsStore; } /** * Return a PageUpdater for building an update to a page. * * @internal For now, most code should keep using WikiPage::newPageUpdater() instead. * @note We can only start using this method everywhere when WikiPage::prepareContentForEdit() * and WikiPage::getCurrentUpdate() have been removed. For now, the WikiPage instance is * used to make the state of an ongoing edit available to hook handlers. * * @param PageIdentity $page * @param UserIdentity $user * * @return PageUpdater * @since 1.37 */ public function newPageUpdater( PageIdentity $page, UserIdentity $user ): PageUpdater { return $this->newPageUpdaterForDerivedPageDataUpdater( $page, $user, $this->newDerivedPageDataUpdater( $page ) ); } /** * Return a PageUpdater for building an update to a page, reusing the state of * an existing DerivedPageDataUpdater. * * @param PageIdentity $page * @param UserIdentity $user * @param DerivedPageDataUpdater $derivedPageDataUpdater * * @return PageUpdater * @internal needed by WikiPage to back the WikiPage::newPageUpdater method. * * @since 1.37 */ public function newPageUpdaterForDerivedPageDataUpdater( PageIdentity $page, UserIdentity $user, DerivedPageDataUpdater $derivedPageDataUpdater ): PageUpdater { $pageUpdater = new PageUpdater( $user, $page, $derivedPageDataUpdater, $this->loadbalancerFactory, $this->revisionStore, $this->slotRoleRegistry, $this->contentHandlerFactory, $this->hookContainer, $this->userGroupManager, $this->titleFormatter, new ServiceOptions( PageUpdater::CONSTRUCTOR_OPTIONS, $this->options ), $this->softwareTags, $this->logger, $this->wikiPageFactory ); $pageUpdater->setUsePageCreationLog( $this->options->get( MainConfigNames::PageCreationLog ) ); $pageUpdater->setUseAutomaticEditSummaries( $this->options->get( MainConfigNames::UseAutomaticEditSummaries ) ); return $pageUpdater; } /** * @param PageIdentity $page * * @return DerivedPageDataUpdater * @internal Needed by WikiPage to back the deprecated prepareContentForEdit() method. * @note Avoid direct usage of DerivedPageDataUpdater. * @see docs/pageupdater.md for more information. */ public function newDerivedPageDataUpdater( PageIdentity $page ): DerivedPageDataUpdater { $derivedDataUpdater = new DerivedPageDataUpdater( $this->options, $page, $this->revisionStore, $this->revisionRenderer, $this->slotRoleRegistry, $this->parserCache, $this->jobQueueGroup, $this->contLang, $this->loadbalancerFactory, $this->contentHandlerFactory, $this->hookContainer, $this->eventDispatcher, $this->editResultCache, $this->contentTransformer, $this->pageEditStash, $this->mainWANObjectCache, $this->wikiPageFactory, $this->changeTagsStore, ); $derivedDataUpdater->setLogger( $this->logger ); $derivedDataUpdater->setArticleCountMethod( $this->options->get( MainConfigNames::ArticleCountMethod ) ); return $derivedDataUpdater; } }