MediaWiki master
BacklinkCacheFactory.php
Go to the documentation of this file.
1<?php
10namespace MediaWiki\Cache;
11
17use Psr\Log\LoggerInterface;
20
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(!defined('MW_SETUP_CALLBACK'))
Definition WebStart.php:68
getBacklinkCache(PageReference $page)
Returns a BacklinkCache for $page.
__construct(ServiceOptions $options, LinksMigration $linksMigration, WANObjectCache $wanCache, HookContainer $hookContainer, IConnectionProvider $dbProvider, RestrictionStore $restrictionStore, LoggerInterface $logger)
Class for fetching backlink lists, approximate backlink counts and partitions.
A class for passing options to services.
Service for compat reading of links tables.
Multi-datacenter aware caching interface.
Interface for objects (potentially) representing a page that can be viewable and linked to on a wiki.
Provide primary and replica IDatabase connections.