MediaWiki
master
Toggle main menu visibility
BacklinkCacheFactory.php
Go to the documentation of this file.
1
<?php
9
10
namespace
MediaWiki\Cache;
11
12
use MediaWiki\Config\ServiceOptions;
13
use MediaWiki\HookContainer\HookContainer;
14
use MediaWiki\Linker\LinksMigration;
15
use MediaWiki\Page\PageReference;
16
use MediaWiki\Permissions\RestrictionStore;
17
use Psr\Log\LoggerInterface;
18
use Wikimedia\ObjectCache\WANObjectCache;
19
use Wikimedia\Rdbms\IConnectionProvider;
20
24
class
BacklinkCacheFactory
{
26
private
$latestBacklinkCache;
27
29
private
$wanCache;
30
32
private
$hookContainer;
33
34
private
IConnectionProvider
$dbProvider;
35
private
ServiceOptions
$options;
36
private
LinksMigration
$linksMigration;
37
private
RestrictionStore
$restrictionStore;
38
private
LoggerInterface $logger;
39
40
public
function
__construct
(
41
ServiceOptions
$options,
42
LinksMigration
$linksMigration,
43
WANObjectCache
$wanCache,
44
HookContainer
$hookContainer,
45
IConnectionProvider
$dbProvider,
46
RestrictionStore
$restrictionStore,
47
LoggerInterface $logger
48
) {
49
$this->options = $options;
50
$this->linksMigration = $linksMigration;
51
$this->wanCache = $wanCache;
52
$this->hookContainer = $hookContainer;
53
$this->dbProvider = $dbProvider;
54
$this->restrictionStore = $restrictionStore;
55
$this->logger = $logger;
56
}
57
68
public
function
getBacklinkCache
(
PageReference
$page ):
BacklinkCache
{
69
if
( !$this->latestBacklinkCache || !$this->latestBacklinkCache->getPage()->isSamePageAs( $page ) ) {
70
$this->latestBacklinkCache =
new
BacklinkCache
(
71
$this->options,
72
$this->linksMigration,
73
$this->wanCache,
74
$this->hookContainer,
75
$this->dbProvider,
76
$this->restrictionStore,
77
$this->logger,
78
$page
79
);
80
}
81
return
$this->latestBacklinkCache;
82
}
83
}
if
if(!defined('MW_SETUP_CALLBACK'))
Definition
WebStart.php:72
MediaWiki\Cache\BacklinkCacheFactory
Definition
BacklinkCacheFactory.php:24
MediaWiki\Cache\BacklinkCacheFactory\getBacklinkCache
getBacklinkCache(PageReference $page)
Returns a BacklinkCache for $page.
Definition
BacklinkCacheFactory.php:68
MediaWiki\Cache\BacklinkCacheFactory\__construct
__construct(ServiceOptions $options, LinksMigration $linksMigration, WANObjectCache $wanCache, HookContainer $hookContainer, IConnectionProvider $dbProvider, RestrictionStore $restrictionStore, LoggerInterface $logger)
Definition
BacklinkCacheFactory.php:40
MediaWiki\Cache\BacklinkCache
Class for fetching backlink lists, approximate backlink counts and partitions.
Definition
BacklinkCache.php:54
MediaWiki\Config\ServiceOptions
A class for passing options to services.
Definition
ServiceOptions.php:27
MediaWiki\HookContainer\HookContainer
HookContainer class.
Definition
HookContainer.php:42
MediaWiki\Linker\LinksMigration
Service for compat reading of links tables.
Definition
LinksMigration.php:17
MediaWiki\Permissions\RestrictionStore
Definition
RestrictionStore.php:31
Wikimedia\ObjectCache\WANObjectCache
Multi-datacenter aware caching interface.
Definition
WANObjectCache.php:154
MediaWiki\Page\PageReference
Interface for objects (potentially) representing a page that can be viewable and linked to on a wiki.
Definition
PageReference.php:38
Wikimedia\Rdbms\IConnectionProvider
Provide primary and replica IDatabase connections.
Definition
IConnectionProvider.php:21
includes
Cache
BacklinkCacheFactory.php
Generated on
for MediaWiki by
1.18.0