MediaWiki  master
LinkBatchFactory.php
Go to the documentation of this file.
1 <?php
24 namespace MediaWiki\Cache;
25 
26 use GenderCache;
27 use Language;
28 use LinkBatch;
29 use LinkCache;
32 use TitleFormatter;
34 
40 
44  private $linkCache;
45 
49  private $titleFormatter;
50 
55 
59  private $genderCache;
60 
64  private $loadBalancer;
65 
66  public function __construct(
72  ) {
73  $this->linkCache = $linkCache;
74  $this->titleFormatter = $titleFormatter;
75  $this->contentLanguage = $contentLanguage;
76  $this->genderCache = $genderCache;
77  $this->loadBalancer = $loadBalancer;
78  }
79 
85  public function newLinkBatch( iterable $initialItems = [] ): LinkBatch {
86  $batch = new LinkBatch(
87  [],
88  $this->linkCache,
89  $this->titleFormatter,
90  $this->contentLanguage,
91  $this->genderCache,
92  $this->loadBalancer
93  );
94 
95  foreach ( $initialItems as $item ) {
96  $batch->addObj( $item );
97  }
98 
99  return $batch;
100  }
101 }
LinkCache
Cache for article titles (prefixed DB keys) and ids linked from one source.
Definition: LinkCache.php:40
MediaWiki\Cache\LinkBatchFactory\$genderCache
GenderCache $genderCache
Definition: LinkBatchFactory.php:59
MediaWiki\Cache
Definition: CacheKeyHelper.php:22
MediaWiki\Cache\LinkBatchFactory\$linkCache
LinkCache $linkCache
Definition: LinkBatchFactory.php:44
LinkBatch
Class representing a list of titles The execute() method checks them all for existence and adds them ...
Definition: LinkBatch.php:42
GenderCache
Caches user genders when needed to use correct namespace aliases.
Definition: GenderCache.php:36
MediaWiki\Cache\LinkBatchFactory\newLinkBatch
newLinkBatch(iterable $initialItems=[])
Definition: LinkBatchFactory.php:85
Page\PageReference
Interface for objects (potentially) representing a page that can be viewable and linked to on a wiki.
Definition: PageReference.php:49
MediaWiki\Cache\LinkBatchFactory\__construct
__construct(LinkCache $linkCache, TitleFormatter $titleFormatter, Language $contentLanguage, GenderCache $genderCache, ILoadBalancer $loadBalancer)
Definition: LinkBatchFactory.php:66
MediaWiki\Cache\LinkBatchFactory\$titleFormatter
TitleFormatter $titleFormatter
Definition: LinkBatchFactory.php:49
MediaWiki\Cache\LinkBatchFactory\$contentLanguage
Language $contentLanguage
Definition: LinkBatchFactory.php:54
MediaWiki\Cache\LinkBatchFactory
Definition: LinkBatchFactory.php:39
MediaWiki\Cache\LinkBatchFactory\$loadBalancer
ILoadBalancer $loadBalancer
Definition: LinkBatchFactory.php:64
TitleFormatter
A title formatter service for MediaWiki.
Definition: TitleFormatter.php:35
MediaWiki\Linker\LinkTarget
Definition: LinkTarget.php:26
Language
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
Definition: Language.php:42
Wikimedia\Rdbms\ILoadBalancer
Database cluster connection, tracking, load balancing, and transaction manager interface.
Definition: ILoadBalancer.php:81