blob: c93dfa6d0d6162986b968897082fb9d76ff71711 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
<?php
namespace MediaWiki\Page;
use MediaWiki\Config\ServiceOptions;
use MediaWiki\DAO\WikiAwareEntity;
use NamespaceInfo;
use TitleParser;
use Wikimedia\Rdbms\ILBFactory;
/**
* @since 1.36
*/
class PageStoreFactory {
/**
* @internal for use by service wiring
*/
public const CONSTRUCTOR_OPTIONS = PageStore::CONSTRUCTOR_OPTIONS;
/** @var ServiceOptions */
private $options;
/** @var ILBFactory */
private $dbLoadBalancerFactory;
/** @var NamespaceInfo */
private $namespaceInfo;
/** @var TitleParser */
private $titleParser;
/**
* @param ServiceOptions $options
* @param ILBFactory $dbLoadBalancerFactory
* @param NamespaceInfo $namespaceInfo
* @param TitleParser $titleParser
*/
public function __construct(
ServiceOptions $options,
ILBFactory $dbLoadBalancerFactory,
NamespaceInfo $namespaceInfo,
TitleParser $titleParser
) {
$options->assertRequiredOptions( self::CONSTRUCTOR_OPTIONS );
$this->options = $options;
$this->dbLoadBalancerFactory = $dbLoadBalancerFactory;
$this->namespaceInfo = $namespaceInfo;
$this->titleParser = $titleParser;
}
/**
* @param string|false $wikiId
*
* @return PageStore
*/
public function getPageStore( $wikiId = WikiAwareEntity::LOCAL ): PageStore {
return new PageStore(
$this->options,
$this->dbLoadBalancerFactory->getMainLB( $wikiId ),
$this->namespaceInfo,
$this->titleParser,
$wikiId
);
}
}
|