MediaWiki REL1_39
PageUpdaterFactory.php
Go to the documentation of this file.
1<?php
23namespace MediaWiki\Storage;
24
26use Language;
44use MessageCache;
45use ParserCache;
46use Psr\Log\LoggerInterface;
50use WikiPage;
51
59
65 public const CONSTRUCTOR_OPTIONS = [
73 ];
74
76 private $revisionStore;
77
79 private $revisionRenderer;
80
82 private $slotRoleRegistry;
83
85 private $parserCache;
86
88 private $jobQueueGroup;
89
91 private $messageCache;
92
94 private $contLang;
95
97 private $loadbalancerFactory;
98
100 private $contentHandlerFactory;
101
103 private $hookContainer;
104
106 private $editResultCache;
107
109 private $userNameUtils;
110
112 private $logger;
113
115 private $options;
116
118 private $userEditTracker;
119
121 private $userGroupManager;
122
124 private $titleFormatter;
125
127 private $contentTransformer;
128
130 private $pageEditStash;
131
133 private $talkPageNotificationManager;
134
136 private $mainWANObjectCache;
137
139 private $permissionManager;
140
142 private $wikiPageFactory;
143
145 private $softwareTags;
146
148 private $parsoidOutputAccess;
149
177 public function __construct(
178 RevisionStore $revisionStore,
179 RevisionRenderer $revisionRenderer,
180 SlotRoleRegistry $slotRoleRegistry,
181 ParserCache $parserCache,
182 ParsoidOutputAccess $parsoidOutputAccess,
183 JobQueueGroup $jobQueueGroup,
184 MessageCache $messageCache,
185 Language $contLang,
186 ILBFactory $loadbalancerFactory,
187 IContentHandlerFactory $contentHandlerFactory,
188 HookContainer $hookContainer,
189 EditResultCache $editResultCache,
190 UserNameUtils $userNameUtils,
191 LoggerInterface $logger,
192 ServiceOptions $options,
193 UserEditTracker $userEditTracker,
194 UserGroupManager $userGroupManager,
195 TitleFormatter $titleFormatter,
196 ContentTransformer $contentTransformer,
197 PageEditStash $pageEditStash,
198 TalkPageNotificationManager $talkPageNotificationManager,
199 WANObjectCache $mainWANObjectCache,
200 PermissionManager $permissionManager,
201 WikiPageFactory $wikiPageFactory,
202 array $softwareTags
203 ) {
204 $options->assertRequiredOptions( self::CONSTRUCTOR_OPTIONS );
205
206 $this->revisionStore = $revisionStore;
207 $this->revisionRenderer = $revisionRenderer;
208 $this->slotRoleRegistry = $slotRoleRegistry;
209 $this->parserCache = $parserCache;
210 $this->parsoidOutputAccess = $parsoidOutputAccess;
211 $this->jobQueueGroup = $jobQueueGroup;
212 $this->messageCache = $messageCache;
213 $this->contLang = $contLang;
214 $this->loadbalancerFactory = $loadbalancerFactory;
215 $this->contentHandlerFactory = $contentHandlerFactory;
216 $this->hookContainer = $hookContainer;
217 $this->editResultCache = $editResultCache;
218 $this->userNameUtils = $userNameUtils;
219 $this->logger = $logger;
220 $this->options = $options;
221 $this->userEditTracker = $userEditTracker;
222 $this->userGroupManager = $userGroupManager;
223 $this->titleFormatter = $titleFormatter;
224 $this->contentTransformer = $contentTransformer;
225 $this->pageEditStash = $pageEditStash;
226 $this->talkPageNotificationManager = $talkPageNotificationManager;
227 $this->mainWANObjectCache = $mainWANObjectCache;
228 $this->permissionManager = $permissionManager;
229 $this->softwareTags = $softwareTags;
230 $this->wikiPageFactory = $wikiPageFactory;
231 }
232
247 public function newPageUpdater(
248 PageIdentity $page,
249 UserIdentity $user
250 ): PageUpdater {
251 $page = $this->wikiPageFactory->newFromTitle( $page );
252
254 $page,
255 $user,
256 $this->newDerivedPageDataUpdater( $page )
257 );
258 }
259
274 WikiPage $page,
275 UserIdentity $user,
276 DerivedPageDataUpdater $derivedPageDataUpdater
277 ): PageUpdater {
278 $pageUpdater = new PageUpdater(
279 $user,
280 $page, // NOTE: eventually, PageUpdater should not know about WikiPage
281 $derivedPageDataUpdater,
282 $this->loadbalancerFactory->getMainLB(),
283 $this->revisionStore,
284 $this->slotRoleRegistry,
285 $this->contentHandlerFactory,
286 $this->hookContainer,
287 $this->userEditTracker,
288 $this->userGroupManager,
289 $this->titleFormatter,
290 new ServiceOptions(
291 PageUpdater::CONSTRUCTOR_OPTIONS,
292 $this->options
293 ),
294 $this->softwareTags,
295 $this->logger
296 );
297
298 $pageUpdater->setUsePageCreationLog(
299 $this->options->get( MainConfigNames::PageCreationLog ) );
300 $pageUpdater->setUseAutomaticEditSummaries(
301 $this->options->get( MainConfigNames::UseAutomaticEditSummaries )
302 );
303
304 return $pageUpdater;
305 }
306
316 $derivedDataUpdater = new DerivedPageDataUpdater(
317 $this->options,
318 $page, // NOTE: eventually, PageUpdater should not know about WikiPage
319 $this->revisionStore,
320 $this->revisionRenderer,
321 $this->slotRoleRegistry,
322 $this->parserCache,
323 $this->parsoidOutputAccess,
324 $this->jobQueueGroup,
325 $this->messageCache,
326 $this->contLang,
327 $this->loadbalancerFactory,
328 $this->contentHandlerFactory,
329 $this->hookContainer,
330 $this->editResultCache,
331 $this->userNameUtils,
332 $this->contentTransformer,
333 $this->pageEditStash,
334 $this->talkPageNotificationManager,
335 $this->mainWANObjectCache,
336 $this->permissionManager
337 );
338
339 $derivedDataUpdater->setLogger( $this->logger );
340 $derivedDataUpdater->setArticleCountMethod(
341 $this->options->get( MainConfigNames::ArticleCountMethod ) );
342 $derivedDataUpdater->setRcWatchCategoryMembership(
343 $this->options->get( MainConfigNames::RCWatchCategoryMembership )
344 );
345
346 return $derivedDataUpdater;
347 }
348
349}
Class to handle enqueueing of background jobs.
Base class for language-specific code.
Definition Language.php:53
A class for passing options to services.
assertRequiredOptions(array $expectedKeys)
Assert that the list of options provided in this instance exactly match $expectedKeys,...
A class containing constants representing the names of configuration variables.
const UseRCPatrol
Name constant for the UseRCPatrol setting, for use with Config::get()
const ArticleCountMethod
Name constant for the ArticleCountMethod setting, for use with Config::get()
const ManualRevertSearchRadius
Name constant for the ManualRevertSearchRadius setting, for use with Config::get()
const PageCreationLog
Name constant for the PageCreationLog setting, for use with Config::get()
const RCWatchCategoryMembership
Name constant for the RCWatchCategoryMembership setting, for use with Config::get()
const ParsoidCacheConfig
Name constant for the ParsoidCacheConfig setting, for use with Config::get()
const UseAutomaticEditSummaries
Name constant for the UseAutomaticEditSummaries setting, for use with Config::get()
Service for creating WikiPage objects.
MediaWiki service for getting Parsoid Output objects.
A service class for checking permissions To obtain an instance, use MediaWikiServices::getInstance()-...
The RevisionRenderer service provides access to rendered output for revisions.
Service for looking up page revisions.
A registry service for SlotRoleHandlers, used to define which slot roles are available on which page.
A handle for managing updates for derived page data on edit, import, purge, etc.
Class allowing easy storage and retrieval of EditResults associated with revisions.
Manage the pre-emptive page parsing for edits to wiki pages.
A factory for PageUpdater instances.
__construct(RevisionStore $revisionStore, RevisionRenderer $revisionRenderer, SlotRoleRegistry $slotRoleRegistry, ParserCache $parserCache, ParsoidOutputAccess $parsoidOutputAccess, JobQueueGroup $jobQueueGroup, MessageCache $messageCache, Language $contLang, ILBFactory $loadbalancerFactory, IContentHandlerFactory $contentHandlerFactory, HookContainer $hookContainer, EditResultCache $editResultCache, UserNameUtils $userNameUtils, LoggerInterface $logger, ServiceOptions $options, UserEditTracker $userEditTracker, UserGroupManager $userGroupManager, TitleFormatter $titleFormatter, ContentTransformer $contentTransformer, PageEditStash $pageEditStash, TalkPageNotificationManager $talkPageNotificationManager, WANObjectCache $mainWANObjectCache, PermissionManager $permissionManager, WikiPageFactory $wikiPageFactory, array $softwareTags)
newPageUpdaterForDerivedPageDataUpdater(WikiPage $page, UserIdentity $user, DerivedPageDataUpdater $derivedPageDataUpdater)
Return a PageUpdater for building an update to a page, reusing the state of an existing DerivedPageDa...
newPageUpdater(PageIdentity $page, UserIdentity $user)
Return a PageUpdater for building an update to a page.
const CONSTRUCTOR_OPTIONS
Options that have to be present in the ServiceOptions object passed to the constructor.
Controller-like object for creating and updating pages by creating new revisions.
setUsePageCreationLog( $use)
Whether to create a log entry for new page creations.
Track info about user edit counts and timings.
UserNameUtils service.
Cache messages that are defined by MediaWiki-namespace pages or by hooks.
Cache for ParserOutput objects corresponding to the latest page revisions.
Multi-datacenter aware caching interface.
Base representation for an editable wiki page.
Definition WikiPage.php:62
Interface for objects (potentially) representing an editable wiki page.
Interface for objects representing user identity.
A title formatter service for MediaWiki.
Manager of ILoadBalancer objects, and indirectly of IDatabase connections.