MediaWiki REL1_40
PageUpdaterFactory.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\Storage;
22
24use Language;
42use MessageCache;
43use ParserCache;
44use Psr\Log\LoggerInterface;
48use WikiPage;
49
57
63 public const CONSTRUCTOR_OPTIONS = [
71 ];
72
74 private $revisionStore;
75
77 private $revisionRenderer;
78
80 private $slotRoleRegistry;
81
83 private $parserCache;
84
86 private $jobQueueGroup;
87
89 private $messageCache;
90
92 private $contLang;
93
95 private $loadbalancerFactory;
96
98 private $contentHandlerFactory;
99
101 private $hookContainer;
102
104 private $editResultCache;
105
107 private $userNameUtils;
108
110 private $logger;
111
113 private $options;
114
116 private $userEditTracker;
117
119 private $userGroupManager;
120
122 private $titleFormatter;
123
125 private $contentTransformer;
126
128 private $pageEditStash;
129
131 private $talkPageNotificationManager;
132
134 private $mainWANObjectCache;
135
137 private $permissionManager;
138
140 private $wikiPageFactory;
141
143 private $softwareTags;
144
146 private $parsoidOutputAccess;
147
175 public function __construct(
176 RevisionStore $revisionStore,
177 RevisionRenderer $revisionRenderer,
178 SlotRoleRegistry $slotRoleRegistry,
179 ParserCache $parserCache,
180 ParsoidOutputAccess $parsoidOutputAccess,
181 JobQueueGroup $jobQueueGroup,
182 MessageCache $messageCache,
183 Language $contLang,
184 ILBFactory $loadbalancerFactory,
185 IContentHandlerFactory $contentHandlerFactory,
186 HookContainer $hookContainer,
187 EditResultCache $editResultCache,
188 UserNameUtils $userNameUtils,
189 LoggerInterface $logger,
190 ServiceOptions $options,
191 UserEditTracker $userEditTracker,
192 UserGroupManager $userGroupManager,
193 TitleFormatter $titleFormatter,
194 ContentTransformer $contentTransformer,
195 PageEditStash $pageEditStash,
196 TalkPageNotificationManager $talkPageNotificationManager,
197 WANObjectCache $mainWANObjectCache,
198 PermissionManager $permissionManager,
199 WikiPageFactory $wikiPageFactory,
200 array $softwareTags
201 ) {
202 $options->assertRequiredOptions( self::CONSTRUCTOR_OPTIONS );
203
204 $this->revisionStore = $revisionStore;
205 $this->revisionRenderer = $revisionRenderer;
206 $this->slotRoleRegistry = $slotRoleRegistry;
207 $this->parserCache = $parserCache;
208 $this->parsoidOutputAccess = $parsoidOutputAccess;
209 $this->jobQueueGroup = $jobQueueGroup;
210 $this->messageCache = $messageCache;
211 $this->contLang = $contLang;
212 $this->loadbalancerFactory = $loadbalancerFactory;
213 $this->contentHandlerFactory = $contentHandlerFactory;
214 $this->hookContainer = $hookContainer;
215 $this->editResultCache = $editResultCache;
216 $this->userNameUtils = $userNameUtils;
217 $this->logger = $logger;
218 $this->options = $options;
219 $this->userEditTracker = $userEditTracker;
220 $this->userGroupManager = $userGroupManager;
221 $this->titleFormatter = $titleFormatter;
222 $this->contentTransformer = $contentTransformer;
223 $this->pageEditStash = $pageEditStash;
224 $this->talkPageNotificationManager = $talkPageNotificationManager;
225 $this->mainWANObjectCache = $mainWANObjectCache;
226 $this->permissionManager = $permissionManager;
227 $this->softwareTags = $softwareTags;
228 $this->wikiPageFactory = $wikiPageFactory;
229 }
230
245 public function newPageUpdater(
246 PageIdentity $page,
247 UserIdentity $user
248 ): PageUpdater {
249 $page = $this->wikiPageFactory->newFromTitle( $page );
250
252 $page,
253 $user,
254 $this->newDerivedPageDataUpdater( $page )
255 );
256 }
257
272 WikiPage $page,
273 UserIdentity $user,
274 DerivedPageDataUpdater $derivedPageDataUpdater
275 ): PageUpdater {
276 $pageUpdater = new PageUpdater(
277 $user,
278 $page, // NOTE: eventually, PageUpdater should not know about WikiPage
279 $derivedPageDataUpdater,
280 $this->loadbalancerFactory->getMainLB(),
281 $this->revisionStore,
282 $this->slotRoleRegistry,
283 $this->contentHandlerFactory,
284 $this->hookContainer,
285 $this->userEditTracker,
286 $this->userGroupManager,
287 $this->titleFormatter,
288 new ServiceOptions(
289 PageUpdater::CONSTRUCTOR_OPTIONS,
290 $this->options
291 ),
292 $this->softwareTags,
293 $this->logger
294 );
295
296 $pageUpdater->setUsePageCreationLog(
297 $this->options->get( MainConfigNames::PageCreationLog ) );
298 $pageUpdater->setUseAutomaticEditSummaries(
299 $this->options->get( MainConfigNames::UseAutomaticEditSummaries )
300 );
301
302 return $pageUpdater;
303 }
304
314 $derivedDataUpdater = new DerivedPageDataUpdater(
315 $this->options,
316 $page, // NOTE: eventually, PageUpdater should not know about WikiPage
317 $this->revisionStore,
318 $this->revisionRenderer,
319 $this->slotRoleRegistry,
320 $this->parserCache,
321 $this->parsoidOutputAccess,
322 $this->jobQueueGroup,
323 $this->messageCache,
324 $this->contLang,
325 $this->loadbalancerFactory,
326 $this->contentHandlerFactory,
327 $this->hookContainer,
328 $this->editResultCache,
329 $this->userNameUtils,
330 $this->contentTransformer,
331 $this->pageEditStash,
332 $this->talkPageNotificationManager,
333 $this->mainWANObjectCache,
334 $this->permissionManager
335 );
336
337 $derivedDataUpdater->setLogger( $this->logger );
338 $derivedDataUpdater->setArticleCountMethod(
339 $this->options->get( MainConfigNames::ArticleCountMethod ) );
340 $derivedDataUpdater->setRcWatchCategoryMembership(
341 $this->options->get( MainConfigNames::RCWatchCategoryMembership )
342 );
343
344 return $derivedDataUpdater;
345 }
346
347}
Handle enqueueing of background jobs.
Base class for language-specific code.
Definition Language.php:56
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 and DerivedPageDataUpdater 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:75
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, IDatabase connections.