assertRequiredOptions( self::CONSTRUCTOR_OPTIONS ); $this->revisionStore = $revisionStore; $this->revisionRenderer = $revisionRenderer; $this->slotRoleRegistry = $slotRoleRegistry; $this->parserCache = $parserCache; $this->jobQueueGroup = $jobQueueGroup; $this->messageCache = $messageCache; $this->contLang = $contLang; $this->loadbalancerFactory = $loadbalancerFactory; $this->contentHandlerFactory = $contentHandlerFactory; $this->hookContainer = $hookContainer; $this->editResultCache = $editResultCache; $this->userNameUtils = $userNameUtils; $this->logger = $logger; $this->options = $options; $this->userEditTracker = $userEditTracker; $this->userGroupManager = $userGroupManager; $this->softwareTags = $softwareTags; } /** * 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 WikiPage $page * @param UserIdentity $user * * @return PageUpdater * @since 1.37 */ public function newPageUpdater( WikiPage $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 WikiPage $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( WikiPage $page, UserIdentity $user, DerivedPageDataUpdater $derivedPageDataUpdater ): PageUpdater { Assert::precondition( $page->canExist(), 'The WikiPage instance does not represent a proper page!' ); $pageUpdater = new PageUpdater( $user, $page, // NOTE: eventually, PageUpdater should not know about WikiPage $derivedPageDataUpdater, $this->loadbalancerFactory->getMainLB(), $this->revisionStore, $this->slotRoleRegistry, $this->contentHandlerFactory, $this->hookContainer, $this->userEditTracker, $this->userGroupManager, new ServiceOptions( PageUpdater::CONSTRUCTOR_OPTIONS, $this->options ), $this->softwareTags ); $pageUpdater->setUsePageCreationLog( $this->options->get( 'PageCreationLog' ) ); $pageUpdater->setAjaxEditStash( $this->options->get( 'AjaxEditStash' ) ); $pageUpdater->setUseAutomaticEditSummaries( $this->options->get( 'UseAutomaticEditSummaries' ) ); return $pageUpdater; } /** * @param WikiPage $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( WikiPage $page ): DerivedPageDataUpdater { $derivedDataUpdater = new DerivedPageDataUpdater( $page, // NOTE: eventually, PageUpdater should not know about WikiPage $this->revisionStore, $this->revisionRenderer, $this->slotRoleRegistry, $this->parserCache, $this->jobQueueGroup, $this->messageCache, $this->contLang, $this->loadbalancerFactory, $this->contentHandlerFactory, $this->hookContainer, $this->editResultCache, $this->userNameUtils ); $derivedDataUpdater->setLogger( $this->logger ); $derivedDataUpdater->setArticleCountMethod( $this->options->get( 'ArticleCountMethod' ) ); $derivedDataUpdater->setRcWatchCategoryMembership( $this->options->get( 'RCWatchCategoryMembership' ) ); return $derivedDataUpdater; } }