MediaWiki master
RevisionStoreFactory.php
Go to the documentation of this file.
1<?php
2
27namespace MediaWiki\Revision;
28
29use BagOStuff;
39use Psr\Log\LoggerInterface;
41use Wikimedia\Assert\Assert;
43
57
59 private $blobStoreFactory;
61 private $dbLoadBalancerFactory;
63 private $cache;
65 private $localCache;
67 private $logger;
68
70 private $commentStore;
72 private $actorStoreFactory;
74 private $nameTables;
75
77 private $slotRoleRegistry;
78
80 private $contentHandlerFactory;
81
83 private $pageStoreFactory;
84
86 private $titleFactory;
87
89 private $hookContainer;
90
106 public function __construct(
107 ILBFactory $dbLoadBalancerFactory,
108 BlobStoreFactory $blobStoreFactory,
109 NameTableStoreFactory $nameTables,
110 SlotRoleRegistry $slotRoleRegistry,
111 WANObjectCache $cache,
112 BagOStuff $localCache,
113 CommentStore $commentStore,
114 ActorStoreFactory $actorStoreFactory,
115 LoggerInterface $logger,
116 IContentHandlerFactory $contentHandlerFactory,
117 PageStoreFactory $pageStoreFactory,
118 TitleFactory $titleFactory,
119 HookContainer $hookContainer
120 ) {
121 $this->dbLoadBalancerFactory = $dbLoadBalancerFactory;
122 $this->blobStoreFactory = $blobStoreFactory;
123 $this->slotRoleRegistry = $slotRoleRegistry;
124 $this->nameTables = $nameTables;
125 $this->cache = $cache;
126 $this->localCache = $localCache;
127 $this->commentStore = $commentStore;
128 $this->actorStoreFactory = $actorStoreFactory;
129 $this->logger = $logger;
130 $this->contentHandlerFactory = $contentHandlerFactory;
131 $this->pageStoreFactory = $pageStoreFactory;
132 $this->titleFactory = $titleFactory;
133 $this->hookContainer = $hookContainer;
134 }
135
143 public function getRevisionStore( $dbDomain = false ) {
144 return $this->getStore(
145 $dbDomain,
146 $this->actorStoreFactory->getActorStore( $dbDomain )
147 );
148 }
149
157 public function getRevisionStoreForImport( $dbDomain = false ) {
158 return $this->getStore(
159 $dbDomain,
160 $this->actorStoreFactory->getActorStoreForImport( $dbDomain )
161 );
162 }
163
170 private function getStore( $dbDomain, ActorStore $actorStore ) {
171 Assert::parameterType( [ 'string', 'false' ], $dbDomain, '$dbDomain' );
172
173 $store = new RevisionStore(
174 $this->dbLoadBalancerFactory->getMainLB( $dbDomain ),
175 $this->blobStoreFactory->newSqlBlobStore( $dbDomain ),
176 $this->cache, // Pass cache local to wiki; Leave cache sharing to RevisionStore.
177 $this->localCache,
178 $this->commentStore,
179 $this->nameTables->getContentModels( $dbDomain ),
180 $this->nameTables->getSlotRoles( $dbDomain ),
181 $this->slotRoleRegistry,
182 $actorStore,
183 $this->contentHandlerFactory,
184 $this->pageStoreFactory->getPageStore( $dbDomain ),
185 $this->titleFactory,
186 $this->hookContainer,
187 $dbDomain
188 );
189
190 $store->setLogger( $this->logger );
191
192 return $store;
193 }
194}
Class representing a cache/ephemeral data store.
Definition BagOStuff.php:85
Handle database storage of comments such as edit summaries and log reasons.
Factory service for RevisionStore instances.
__construct(ILBFactory $dbLoadBalancerFactory, BlobStoreFactory $blobStoreFactory, NameTableStoreFactory $nameTables, SlotRoleRegistry $slotRoleRegistry, WANObjectCache $cache, BagOStuff $localCache, CommentStore $commentStore, ActorStoreFactory $actorStoreFactory, LoggerInterface $logger, IContentHandlerFactory $contentHandlerFactory, PageStoreFactory $pageStoreFactory, TitleFactory $titleFactory, HookContainer $hookContainer)
Service for looking up page revisions.
A registry service for SlotRoleHandlers, used to define which slot roles are available on which page.
Service for instantiating BlobStores.
Creates Title objects.
Multi-datacenter aware caching interface.
Manager of ILoadBalancer objects and, indirectly, IDatabase connections.