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;
31 use TitleFormatter;
33 
39 
43  private $linkCache;
44 
48  private $titleFormatter;
49 
54 
58  private $genderCache;
59 
63  private $loadBalancer;
64 
65  public function __construct(
71  ) {
72  $this->linkCache = $linkCache;
73  $this->titleFormatter = $titleFormatter;
74  $this->contentLanguage = $contentLanguage;
75  $this->genderCache = $genderCache;
76  $this->loadBalancer = $loadBalancer;
77  }
78 
83  public function newLinkBatch( iterable $initialItems = [] ) : LinkBatch {
84  $batch = new LinkBatch(
85  [],
86  $this->linkCache,
87  $this->titleFormatter,
88  $this->contentLanguage,
89  $this->genderCache,
90  $this->loadBalancer
91  );
92 
93  foreach ( $initialItems as $item ) {
94  $batch->addObj( $item );
95  }
96 
97  return $batch;
98  }
99 }
LinkCache
Cache for article titles (prefixed DB keys) and ids linked from one source.
Definition: LinkCache.php:34
MediaWiki\Cache\LinkBatchFactory\$genderCache
GenderCache $genderCache
Definition: LinkBatchFactory.php:58
MediaWiki\Cache
MediaWiki\Cache\LinkBatchFactory\$linkCache
LinkCache $linkCache
Definition: LinkBatchFactory.php:43
LinkBatch
Class representing a list of titles The execute() method checks them all for existence and adds them ...
Definition: LinkBatch.php:35
GenderCache
Caches user genders when needed to use correct namespace aliases.
Definition: GenderCache.php:35
MediaWiki\Cache\LinkBatchFactory\newLinkBatch
newLinkBatch(iterable $initialItems=[])
Definition: LinkBatchFactory.php:83
MediaWiki\Cache\LinkBatchFactory\__construct
__construct(LinkCache $linkCache, TitleFormatter $titleFormatter, Language $contentLanguage, GenderCache $genderCache, ILoadBalancer $loadBalancer)
Definition: LinkBatchFactory.php:65
MediaWiki\Cache\LinkBatchFactory\$titleFormatter
TitleFormatter $titleFormatter
Definition: LinkBatchFactory.php:48
MediaWiki\Cache\LinkBatchFactory\$contentLanguage
Language $contentLanguage
Definition: LinkBatchFactory.php:53
MediaWiki\Cache\LinkBatchFactory
Definition: LinkBatchFactory.php:38
MediaWiki\Cache\LinkBatchFactory\$loadBalancer
ILoadBalancer $loadBalancer
Definition: LinkBatchFactory.php:63
TitleFormatter
A title formatter service for MediaWiki.
Definition: TitleFormatter.php:34
MediaWiki\Linker\LinkTarget
Definition: LinkTarget.php:26
Language
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
Definition: Language.php:41
Wikimedia\Rdbms\ILoadBalancer
Database cluster connection, tracking, load balancing, and transaction manager interface.
Definition: ILoadBalancer.php:81