2018-06-27 12:16:35 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
|
*
|
|
|
|
|
* Attribution notice: when this file was created, much of its content was taken
|
|
|
|
|
* from the Revision.php file as present in release 1.30. Refer to the history
|
2021-05-02 23:55:07 +00:00
|
|
|
* of that file for original authorship (that file was removed entirely in 1.37,
|
|
|
|
|
* but its history can still be found in prior versions of MediaWiki).
|
2018-06-27 12:16:35 +00:00
|
|
|
*
|
|
|
|
|
* @file
|
|
|
|
|
*/
|
|
|
|
|
|
2018-09-20 17:29:04 +00:00
|
|
|
namespace MediaWiki\Revision;
|
2018-06-27 12:16:35 +00:00
|
|
|
|
|
|
|
|
use ActorMigration;
|
|
|
|
|
use CommentStore;
|
2020-01-18 20:25:04 +00:00
|
|
|
use MediaWiki\Content\IContentHandlerFactory;
|
Hooks::run() call site migration
Migrate all callers of Hooks::run() to use the new
HookContainer/HookRunner system.
General principles:
* Use DI if it is already used. We're not changing the way state is
managed in this patch.
* HookContainer is always injected, not HookRunner. HookContainer
is a service, it's a more generic interface, it is the only
thing that provides isRegistered() which is needed in some cases,
and a HookRunner can be efficiently constructed from it
(confirmed by benchmark). Because HookContainer is needed
for object construction, it is also needed by all factories.
* "Ask your friendly local base class". Big hierarchies like
SpecialPage and ApiBase have getHookContainer() and getHookRunner()
methods in the base class, and classes that extend that base class
are not expected to know or care where the base class gets its
HookContainer from.
* ProtectedHookAccessorTrait provides protected getHookContainer() and
getHookRunner() methods, getting them from the global service
container. The point of this is to ease migration to DI by ensuring
that call sites ask their local friendly base class rather than
getting a HookRunner from the service container directly.
* Private $this->hookRunner. In some smaller classes where accessor
methods did not seem warranted, there is a private HookRunner property
which is accessed directly. Very rarely (two cases), there is a
protected property, for consistency with code that conventionally
assumes protected=private, but in cases where the class might actually
be overridden, a protected accessor is preferred over a protected
property.
* The last resort: Hooks::runner(). Mostly for static, file-scope and
global code. In a few cases it was used for objects with broken
construction schemes, out of horror or laziness.
Constructors with new required arguments:
* AuthManager
* BadFileLookup
* BlockManager
* ClassicInterwikiLookup
* ContentHandlerFactory
* ContentSecurityPolicy
* DefaultOptionsManager
* DerivedPageDataUpdater
* FullSearchResultWidget
* HtmlCacheUpdater
* LanguageFactory
* LanguageNameUtils
* LinkRenderer
* LinkRendererFactory
* LocalisationCache
* MagicWordFactory
* MessageCache
* NamespaceInfo
* PageEditStash
* PageHandlerFactory
* PageUpdater
* ParserFactory
* PermissionManager
* RevisionStore
* RevisionStoreFactory
* SearchEngineConfig
* SearchEngineFactory
* SearchFormWidget
* SearchNearMatcher
* SessionBackend
* SpecialPageFactory
* UserNameUtils
* UserOptionsManager
* WatchedItemQueryService
* WatchedItemStore
Constructors with new optional arguments:
* DefaultPreferencesFactory
* Language
* LinkHolderArray
* MovePage
* Parser
* ParserCache
* PasswordReset
* Router
setHookContainer() now required after construction:
* AuthenticationProvider
* ResourceLoaderModule
* SearchEngine
Change-Id: Id442b0dbe43aba84bd5cf801d86dedc768b082c7
2020-03-19 02:42:09 +00:00
|
|
|
use MediaWiki\HookContainer\HookContainer;
|
2021-03-17 22:13:35 +00:00
|
|
|
use MediaWiki\Page\PageStoreFactory;
|
2018-09-20 17:29:04 +00:00
|
|
|
use MediaWiki\Storage\BlobStoreFactory;
|
|
|
|
|
use MediaWiki\Storage\NameTableStoreFactory;
|
2021-02-04 02:43:09 +00:00
|
|
|
use MediaWiki\User\ActorStoreFactory;
|
2020-01-10 00:00:51 +00:00
|
|
|
use Psr\Log\LoggerInterface;
|
2021-03-15 18:09:19 +00:00
|
|
|
use TitleFactory;
|
2018-06-27 12:16:35 +00:00
|
|
|
use WANObjectCache;
|
|
|
|
|
use Wikimedia\Assert\Assert;
|
|
|
|
|
use Wikimedia\Rdbms\ILBFactory;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Factory service for RevisionStore instances. This allows RevisionStores to be created for
|
|
|
|
|
* cross-wiki access.
|
|
|
|
|
*
|
|
|
|
|
* @warning Beware compatibility issues with schema migration in the context of cross-wiki access!
|
|
|
|
|
* This class assumes that all wikis are at compatible migration stages for all relevant schemas.
|
|
|
|
|
* Relevant schemas are: revision storage (MCR), the revision comment table, and the actor table.
|
|
|
|
|
* Migration stages are compatible as long as a) there are no wikis in the cluster that only write
|
|
|
|
|
* the old schema or b) there are no wikis that read only the new schema.
|
|
|
|
|
*
|
|
|
|
|
* @since 1.32
|
|
|
|
|
*/
|
|
|
|
|
class RevisionStoreFactory {
|
|
|
|
|
|
|
|
|
|
/** @var BlobStoreFactory */
|
|
|
|
|
private $blobStoreFactory;
|
|
|
|
|
/** @var ILBFactory */
|
|
|
|
|
private $dbLoadBalancerFactory;
|
|
|
|
|
/** @var WANObjectCache */
|
|
|
|
|
private $cache;
|
2019-09-10 02:24:18 +00:00
|
|
|
/** @var LoggerInterface */
|
|
|
|
|
private $logger;
|
2018-06-27 12:16:35 +00:00
|
|
|
|
|
|
|
|
/** @var CommentStore */
|
|
|
|
|
private $commentStore;
|
|
|
|
|
/** @var ActorMigration */
|
|
|
|
|
private $actorMigration;
|
2021-02-04 02:43:09 +00:00
|
|
|
/** @var ActorStoreFactory */
|
|
|
|
|
private $actorStoreFactory;
|
2018-09-04 01:59:03 +00:00
|
|
|
/** @var NameTableStoreFactory */
|
|
|
|
|
private $nameTables;
|
|
|
|
|
|
2018-11-19 11:39:56 +00:00
|
|
|
/** @var SlotRoleRegistry */
|
|
|
|
|
private $slotRoleRegistry;
|
|
|
|
|
|
2020-01-18 20:25:04 +00:00
|
|
|
/** @var IContentHandlerFactory */
|
|
|
|
|
private $contentHandlerFactory;
|
|
|
|
|
|
2021-03-17 22:13:35 +00:00
|
|
|
/** @var PageStoreFactory */
|
|
|
|
|
private $pageStoreFactory;
|
|
|
|
|
|
2021-03-15 18:09:19 +00:00
|
|
|
/** @var TitleFactory */
|
|
|
|
|
private $titleFactory;
|
|
|
|
|
|
Hooks::run() call site migration
Migrate all callers of Hooks::run() to use the new
HookContainer/HookRunner system.
General principles:
* Use DI if it is already used. We're not changing the way state is
managed in this patch.
* HookContainer is always injected, not HookRunner. HookContainer
is a service, it's a more generic interface, it is the only
thing that provides isRegistered() which is needed in some cases,
and a HookRunner can be efficiently constructed from it
(confirmed by benchmark). Because HookContainer is needed
for object construction, it is also needed by all factories.
* "Ask your friendly local base class". Big hierarchies like
SpecialPage and ApiBase have getHookContainer() and getHookRunner()
methods in the base class, and classes that extend that base class
are not expected to know or care where the base class gets its
HookContainer from.
* ProtectedHookAccessorTrait provides protected getHookContainer() and
getHookRunner() methods, getting them from the global service
container. The point of this is to ease migration to DI by ensuring
that call sites ask their local friendly base class rather than
getting a HookRunner from the service container directly.
* Private $this->hookRunner. In some smaller classes where accessor
methods did not seem warranted, there is a private HookRunner property
which is accessed directly. Very rarely (two cases), there is a
protected property, for consistency with code that conventionally
assumes protected=private, but in cases where the class might actually
be overridden, a protected accessor is preferred over a protected
property.
* The last resort: Hooks::runner(). Mostly for static, file-scope and
global code. In a few cases it was used for objects with broken
construction schemes, out of horror or laziness.
Constructors with new required arguments:
* AuthManager
* BadFileLookup
* BlockManager
* ClassicInterwikiLookup
* ContentHandlerFactory
* ContentSecurityPolicy
* DefaultOptionsManager
* DerivedPageDataUpdater
* FullSearchResultWidget
* HtmlCacheUpdater
* LanguageFactory
* LanguageNameUtils
* LinkRenderer
* LinkRendererFactory
* LocalisationCache
* MagicWordFactory
* MessageCache
* NamespaceInfo
* PageEditStash
* PageHandlerFactory
* PageUpdater
* ParserFactory
* PermissionManager
* RevisionStore
* RevisionStoreFactory
* SearchEngineConfig
* SearchEngineFactory
* SearchFormWidget
* SearchNearMatcher
* SessionBackend
* SpecialPageFactory
* UserNameUtils
* UserOptionsManager
* WatchedItemQueryService
* WatchedItemStore
Constructors with new optional arguments:
* DefaultPreferencesFactory
* Language
* LinkHolderArray
* MovePage
* Parser
* ParserCache
* PasswordReset
* Router
setHookContainer() now required after construction:
* AuthenticationProvider
* ResourceLoaderModule
* SearchEngine
Change-Id: Id442b0dbe43aba84bd5cf801d86dedc768b082c7
2020-03-19 02:42:09 +00:00
|
|
|
/** @var HookContainer */
|
|
|
|
|
private $hookContainer;
|
|
|
|
|
|
2018-06-27 12:16:35 +00:00
|
|
|
/**
|
|
|
|
|
* @param ILBFactory $dbLoadBalancerFactory
|
|
|
|
|
* @param BlobStoreFactory $blobStoreFactory
|
2018-09-04 01:59:03 +00:00
|
|
|
* @param NameTableStoreFactory $nameTables
|
2018-11-19 11:39:56 +00:00
|
|
|
* @param SlotRoleRegistry $slotRoleRegistry
|
2018-06-27 12:16:35 +00:00
|
|
|
* @param WANObjectCache $cache
|
|
|
|
|
* @param CommentStore $commentStore
|
|
|
|
|
* @param ActorMigration $actorMigration
|
2021-02-04 02:43:09 +00:00
|
|
|
* @param ActorStoreFactory $actorStoreFactory
|
2019-09-10 02:24:18 +00:00
|
|
|
* @param LoggerInterface $logger
|
2020-01-18 20:25:04 +00:00
|
|
|
* @param IContentHandlerFactory $contentHandlerFactory
|
2021-03-17 22:13:35 +00:00
|
|
|
* @param PageStoreFactory $pageStoreFactory
|
2021-03-15 18:09:19 +00:00
|
|
|
* @param TitleFactory $titleFactory
|
Hooks::run() call site migration
Migrate all callers of Hooks::run() to use the new
HookContainer/HookRunner system.
General principles:
* Use DI if it is already used. We're not changing the way state is
managed in this patch.
* HookContainer is always injected, not HookRunner. HookContainer
is a service, it's a more generic interface, it is the only
thing that provides isRegistered() which is needed in some cases,
and a HookRunner can be efficiently constructed from it
(confirmed by benchmark). Because HookContainer is needed
for object construction, it is also needed by all factories.
* "Ask your friendly local base class". Big hierarchies like
SpecialPage and ApiBase have getHookContainer() and getHookRunner()
methods in the base class, and classes that extend that base class
are not expected to know or care where the base class gets its
HookContainer from.
* ProtectedHookAccessorTrait provides protected getHookContainer() and
getHookRunner() methods, getting them from the global service
container. The point of this is to ease migration to DI by ensuring
that call sites ask their local friendly base class rather than
getting a HookRunner from the service container directly.
* Private $this->hookRunner. In some smaller classes where accessor
methods did not seem warranted, there is a private HookRunner property
which is accessed directly. Very rarely (two cases), there is a
protected property, for consistency with code that conventionally
assumes protected=private, but in cases where the class might actually
be overridden, a protected accessor is preferred over a protected
property.
* The last resort: Hooks::runner(). Mostly for static, file-scope and
global code. In a few cases it was used for objects with broken
construction schemes, out of horror or laziness.
Constructors with new required arguments:
* AuthManager
* BadFileLookup
* BlockManager
* ClassicInterwikiLookup
* ContentHandlerFactory
* ContentSecurityPolicy
* DefaultOptionsManager
* DerivedPageDataUpdater
* FullSearchResultWidget
* HtmlCacheUpdater
* LanguageFactory
* LanguageNameUtils
* LinkRenderer
* LinkRendererFactory
* LocalisationCache
* MagicWordFactory
* MessageCache
* NamespaceInfo
* PageEditStash
* PageHandlerFactory
* PageUpdater
* ParserFactory
* PermissionManager
* RevisionStore
* RevisionStoreFactory
* SearchEngineConfig
* SearchEngineFactory
* SearchFormWidget
* SearchNearMatcher
* SessionBackend
* SpecialPageFactory
* UserNameUtils
* UserOptionsManager
* WatchedItemQueryService
* WatchedItemStore
Constructors with new optional arguments:
* DefaultPreferencesFactory
* Language
* LinkHolderArray
* MovePage
* Parser
* ParserCache
* PasswordReset
* Router
setHookContainer() now required after construction:
* AuthenticationProvider
* ResourceLoaderModule
* SearchEngine
Change-Id: Id442b0dbe43aba84bd5cf801d86dedc768b082c7
2020-03-19 02:42:09 +00:00
|
|
|
* @param HookContainer $hookContainer
|
2018-06-27 12:16:35 +00:00
|
|
|
*/
|
|
|
|
|
public function __construct(
|
|
|
|
|
ILBFactory $dbLoadBalancerFactory,
|
|
|
|
|
BlobStoreFactory $blobStoreFactory,
|
2018-09-04 01:59:03 +00:00
|
|
|
NameTableStoreFactory $nameTables,
|
2018-11-19 11:39:56 +00:00
|
|
|
SlotRoleRegistry $slotRoleRegistry,
|
2018-06-27 12:16:35 +00:00
|
|
|
WANObjectCache $cache,
|
|
|
|
|
CommentStore $commentStore,
|
|
|
|
|
ActorMigration $actorMigration,
|
2021-02-04 02:43:09 +00:00
|
|
|
ActorStoreFactory $actorStoreFactory,
|
2019-09-10 02:24:18 +00:00
|
|
|
LoggerInterface $logger,
|
Hooks::run() call site migration
Migrate all callers of Hooks::run() to use the new
HookContainer/HookRunner system.
General principles:
* Use DI if it is already used. We're not changing the way state is
managed in this patch.
* HookContainer is always injected, not HookRunner. HookContainer
is a service, it's a more generic interface, it is the only
thing that provides isRegistered() which is needed in some cases,
and a HookRunner can be efficiently constructed from it
(confirmed by benchmark). Because HookContainer is needed
for object construction, it is also needed by all factories.
* "Ask your friendly local base class". Big hierarchies like
SpecialPage and ApiBase have getHookContainer() and getHookRunner()
methods in the base class, and classes that extend that base class
are not expected to know or care where the base class gets its
HookContainer from.
* ProtectedHookAccessorTrait provides protected getHookContainer() and
getHookRunner() methods, getting them from the global service
container. The point of this is to ease migration to DI by ensuring
that call sites ask their local friendly base class rather than
getting a HookRunner from the service container directly.
* Private $this->hookRunner. In some smaller classes where accessor
methods did not seem warranted, there is a private HookRunner property
which is accessed directly. Very rarely (two cases), there is a
protected property, for consistency with code that conventionally
assumes protected=private, but in cases where the class might actually
be overridden, a protected accessor is preferred over a protected
property.
* The last resort: Hooks::runner(). Mostly for static, file-scope and
global code. In a few cases it was used for objects with broken
construction schemes, out of horror or laziness.
Constructors with new required arguments:
* AuthManager
* BadFileLookup
* BlockManager
* ClassicInterwikiLookup
* ContentHandlerFactory
* ContentSecurityPolicy
* DefaultOptionsManager
* DerivedPageDataUpdater
* FullSearchResultWidget
* HtmlCacheUpdater
* LanguageFactory
* LanguageNameUtils
* LinkRenderer
* LinkRendererFactory
* LocalisationCache
* MagicWordFactory
* MessageCache
* NamespaceInfo
* PageEditStash
* PageHandlerFactory
* PageUpdater
* ParserFactory
* PermissionManager
* RevisionStore
* RevisionStoreFactory
* SearchEngineConfig
* SearchEngineFactory
* SearchFormWidget
* SearchNearMatcher
* SessionBackend
* SpecialPageFactory
* UserNameUtils
* UserOptionsManager
* WatchedItemQueryService
* WatchedItemStore
Constructors with new optional arguments:
* DefaultPreferencesFactory
* Language
* LinkHolderArray
* MovePage
* Parser
* ParserCache
* PasswordReset
* Router
setHookContainer() now required after construction:
* AuthenticationProvider
* ResourceLoaderModule
* SearchEngine
Change-Id: Id442b0dbe43aba84bd5cf801d86dedc768b082c7
2020-03-19 02:42:09 +00:00
|
|
|
IContentHandlerFactory $contentHandlerFactory,
|
2021-03-17 22:13:35 +00:00
|
|
|
PageStoreFactory $pageStoreFactory,
|
2021-03-15 18:09:19 +00:00
|
|
|
TitleFactory $titleFactory,
|
Hooks::run() call site migration
Migrate all callers of Hooks::run() to use the new
HookContainer/HookRunner system.
General principles:
* Use DI if it is already used. We're not changing the way state is
managed in this patch.
* HookContainer is always injected, not HookRunner. HookContainer
is a service, it's a more generic interface, it is the only
thing that provides isRegistered() which is needed in some cases,
and a HookRunner can be efficiently constructed from it
(confirmed by benchmark). Because HookContainer is needed
for object construction, it is also needed by all factories.
* "Ask your friendly local base class". Big hierarchies like
SpecialPage and ApiBase have getHookContainer() and getHookRunner()
methods in the base class, and classes that extend that base class
are not expected to know or care where the base class gets its
HookContainer from.
* ProtectedHookAccessorTrait provides protected getHookContainer() and
getHookRunner() methods, getting them from the global service
container. The point of this is to ease migration to DI by ensuring
that call sites ask their local friendly base class rather than
getting a HookRunner from the service container directly.
* Private $this->hookRunner. In some smaller classes where accessor
methods did not seem warranted, there is a private HookRunner property
which is accessed directly. Very rarely (two cases), there is a
protected property, for consistency with code that conventionally
assumes protected=private, but in cases where the class might actually
be overridden, a protected accessor is preferred over a protected
property.
* The last resort: Hooks::runner(). Mostly for static, file-scope and
global code. In a few cases it was used for objects with broken
construction schemes, out of horror or laziness.
Constructors with new required arguments:
* AuthManager
* BadFileLookup
* BlockManager
* ClassicInterwikiLookup
* ContentHandlerFactory
* ContentSecurityPolicy
* DefaultOptionsManager
* DerivedPageDataUpdater
* FullSearchResultWidget
* HtmlCacheUpdater
* LanguageFactory
* LanguageNameUtils
* LinkRenderer
* LinkRendererFactory
* LocalisationCache
* MagicWordFactory
* MessageCache
* NamespaceInfo
* PageEditStash
* PageHandlerFactory
* PageUpdater
* ParserFactory
* PermissionManager
* RevisionStore
* RevisionStoreFactory
* SearchEngineConfig
* SearchEngineFactory
* SearchFormWidget
* SearchNearMatcher
* SessionBackend
* SpecialPageFactory
* UserNameUtils
* UserOptionsManager
* WatchedItemQueryService
* WatchedItemStore
Constructors with new optional arguments:
* DefaultPreferencesFactory
* Language
* LinkHolderArray
* MovePage
* Parser
* ParserCache
* PasswordReset
* Router
setHookContainer() now required after construction:
* AuthenticationProvider
* ResourceLoaderModule
* SearchEngine
Change-Id: Id442b0dbe43aba84bd5cf801d86dedc768b082c7
2020-03-19 02:42:09 +00:00
|
|
|
HookContainer $hookContainer
|
2018-06-27 12:16:35 +00:00
|
|
|
) {
|
|
|
|
|
$this->dbLoadBalancerFactory = $dbLoadBalancerFactory;
|
|
|
|
|
$this->blobStoreFactory = $blobStoreFactory;
|
2018-11-19 11:39:56 +00:00
|
|
|
$this->slotRoleRegistry = $slotRoleRegistry;
|
2018-09-04 01:59:03 +00:00
|
|
|
$this->nameTables = $nameTables;
|
2018-06-27 12:16:35 +00:00
|
|
|
$this->cache = $cache;
|
|
|
|
|
$this->commentStore = $commentStore;
|
|
|
|
|
$this->actorMigration = $actorMigration;
|
2021-02-04 02:43:09 +00:00
|
|
|
$this->actorStoreFactory = $actorStoreFactory;
|
2019-09-10 02:24:18 +00:00
|
|
|
$this->logger = $logger;
|
2020-01-18 20:25:04 +00:00
|
|
|
$this->contentHandlerFactory = $contentHandlerFactory;
|
2021-03-17 22:13:35 +00:00
|
|
|
$this->pageStoreFactory = $pageStoreFactory;
|
2021-03-15 18:09:19 +00:00
|
|
|
$this->titleFactory = $titleFactory;
|
Hooks::run() call site migration
Migrate all callers of Hooks::run() to use the new
HookContainer/HookRunner system.
General principles:
* Use DI if it is already used. We're not changing the way state is
managed in this patch.
* HookContainer is always injected, not HookRunner. HookContainer
is a service, it's a more generic interface, it is the only
thing that provides isRegistered() which is needed in some cases,
and a HookRunner can be efficiently constructed from it
(confirmed by benchmark). Because HookContainer is needed
for object construction, it is also needed by all factories.
* "Ask your friendly local base class". Big hierarchies like
SpecialPage and ApiBase have getHookContainer() and getHookRunner()
methods in the base class, and classes that extend that base class
are not expected to know or care where the base class gets its
HookContainer from.
* ProtectedHookAccessorTrait provides protected getHookContainer() and
getHookRunner() methods, getting them from the global service
container. The point of this is to ease migration to DI by ensuring
that call sites ask their local friendly base class rather than
getting a HookRunner from the service container directly.
* Private $this->hookRunner. In some smaller classes where accessor
methods did not seem warranted, there is a private HookRunner property
which is accessed directly. Very rarely (two cases), there is a
protected property, for consistency with code that conventionally
assumes protected=private, but in cases where the class might actually
be overridden, a protected accessor is preferred over a protected
property.
* The last resort: Hooks::runner(). Mostly for static, file-scope and
global code. In a few cases it was used for objects with broken
construction schemes, out of horror or laziness.
Constructors with new required arguments:
* AuthManager
* BadFileLookup
* BlockManager
* ClassicInterwikiLookup
* ContentHandlerFactory
* ContentSecurityPolicy
* DefaultOptionsManager
* DerivedPageDataUpdater
* FullSearchResultWidget
* HtmlCacheUpdater
* LanguageFactory
* LanguageNameUtils
* LinkRenderer
* LinkRendererFactory
* LocalisationCache
* MagicWordFactory
* MessageCache
* NamespaceInfo
* PageEditStash
* PageHandlerFactory
* PageUpdater
* ParserFactory
* PermissionManager
* RevisionStore
* RevisionStoreFactory
* SearchEngineConfig
* SearchEngineFactory
* SearchFormWidget
* SearchNearMatcher
* SessionBackend
* SpecialPageFactory
* UserNameUtils
* UserOptionsManager
* WatchedItemQueryService
* WatchedItemStore
Constructors with new optional arguments:
* DefaultPreferencesFactory
* Language
* LinkHolderArray
* MovePage
* Parser
* ParserCache
* PasswordReset
* Router
setHookContainer() now required after construction:
* AuthenticationProvider
* ResourceLoaderModule
* SearchEngine
Change-Id: Id442b0dbe43aba84bd5cf801d86dedc768b082c7
2020-03-19 02:42:09 +00:00
|
|
|
$this->hookContainer = $hookContainer;
|
2018-06-27 12:16:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @since 1.32
|
|
|
|
|
*
|
2019-06-27 01:33:18 +00:00
|
|
|
* @param bool|string $dbDomain DB domain of the relevant wiki or false for the current one
|
2018-06-27 12:16:35 +00:00
|
|
|
*
|
2019-09-10 02:24:18 +00:00
|
|
|
* @return RevisionStore for the given wikiId with all necessary services
|
2018-06-27 12:16:35 +00:00
|
|
|
*/
|
2019-06-27 01:33:18 +00:00
|
|
|
public function getRevisionStore( $dbDomain = false ) {
|
|
|
|
|
Assert::parameterType( 'string|boolean', $dbDomain, '$dbDomain' );
|
2018-06-27 12:16:35 +00:00
|
|
|
|
|
|
|
|
$store = new RevisionStore(
|
2019-06-27 01:33:18 +00:00
|
|
|
$this->dbLoadBalancerFactory->getMainLB( $dbDomain ),
|
|
|
|
|
$this->blobStoreFactory->newSqlBlobStore( $dbDomain ),
|
2018-06-27 12:16:35 +00:00
|
|
|
$this->cache, // Pass local cache instance; Leave cache sharing to RevisionStore.
|
|
|
|
|
$this->commentStore,
|
2019-06-27 01:33:18 +00:00
|
|
|
$this->nameTables->getContentModels( $dbDomain ),
|
|
|
|
|
$this->nameTables->getSlotRoles( $dbDomain ),
|
2018-11-19 11:39:56 +00:00
|
|
|
$this->slotRoleRegistry,
|
2018-06-27 12:16:35 +00:00
|
|
|
$this->actorMigration,
|
2021-02-04 02:43:09 +00:00
|
|
|
$this->actorStoreFactory->getActorStore( $dbDomain ),
|
2020-01-18 20:25:04 +00:00
|
|
|
$this->contentHandlerFactory,
|
2021-03-17 22:13:35 +00:00
|
|
|
$this->pageStoreFactory->getPageStore( $dbDomain ),
|
2021-03-15 18:09:19 +00:00
|
|
|
$this->titleFactory,
|
Hooks::run() call site migration
Migrate all callers of Hooks::run() to use the new
HookContainer/HookRunner system.
General principles:
* Use DI if it is already used. We're not changing the way state is
managed in this patch.
* HookContainer is always injected, not HookRunner. HookContainer
is a service, it's a more generic interface, it is the only
thing that provides isRegistered() which is needed in some cases,
and a HookRunner can be efficiently constructed from it
(confirmed by benchmark). Because HookContainer is needed
for object construction, it is also needed by all factories.
* "Ask your friendly local base class". Big hierarchies like
SpecialPage and ApiBase have getHookContainer() and getHookRunner()
methods in the base class, and classes that extend that base class
are not expected to know or care where the base class gets its
HookContainer from.
* ProtectedHookAccessorTrait provides protected getHookContainer() and
getHookRunner() methods, getting them from the global service
container. The point of this is to ease migration to DI by ensuring
that call sites ask their local friendly base class rather than
getting a HookRunner from the service container directly.
* Private $this->hookRunner. In some smaller classes where accessor
methods did not seem warranted, there is a private HookRunner property
which is accessed directly. Very rarely (two cases), there is a
protected property, for consistency with code that conventionally
assumes protected=private, but in cases where the class might actually
be overridden, a protected accessor is preferred over a protected
property.
* The last resort: Hooks::runner(). Mostly for static, file-scope and
global code. In a few cases it was used for objects with broken
construction schemes, out of horror or laziness.
Constructors with new required arguments:
* AuthManager
* BadFileLookup
* BlockManager
* ClassicInterwikiLookup
* ContentHandlerFactory
* ContentSecurityPolicy
* DefaultOptionsManager
* DerivedPageDataUpdater
* FullSearchResultWidget
* HtmlCacheUpdater
* LanguageFactory
* LanguageNameUtils
* LinkRenderer
* LinkRendererFactory
* LocalisationCache
* MagicWordFactory
* MessageCache
* NamespaceInfo
* PageEditStash
* PageHandlerFactory
* PageUpdater
* ParserFactory
* PermissionManager
* RevisionStore
* RevisionStoreFactory
* SearchEngineConfig
* SearchEngineFactory
* SearchFormWidget
* SearchNearMatcher
* SessionBackend
* SpecialPageFactory
* UserNameUtils
* UserOptionsManager
* WatchedItemQueryService
* WatchedItemStore
Constructors with new optional arguments:
* DefaultPreferencesFactory
* Language
* LinkHolderArray
* MovePage
* Parser
* ParserCache
* PasswordReset
* Router
setHookContainer() now required after construction:
* AuthenticationProvider
* ResourceLoaderModule
* SearchEngine
Change-Id: Id442b0dbe43aba84bd5cf801d86dedc768b082c7
2020-03-19 02:42:09 +00:00
|
|
|
$this->hookContainer,
|
2019-06-27 01:33:18 +00:00
|
|
|
$dbDomain
|
2018-06-27 12:16:35 +00:00
|
|
|
);
|
|
|
|
|
|
2019-09-10 02:24:18 +00:00
|
|
|
$store->setLogger( $this->logger );
|
2018-06-27 12:16:35 +00:00
|
|
|
|
|
|
|
|
return $store;
|
|
|
|
|
}
|
|
|
|
|
}
|