3 * Factory to create LinkBatch objects for querying page existence.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
24 namespace MediaWiki\Cache
;
26 use MediaWiki\Language\Language
;
27 use MediaWiki\Linker\LinksMigration
;
28 use MediaWiki\Linker\LinkTarget
;
29 use MediaWiki\Page\PageReference
;
30 use MediaWiki\Title\TitleFormatter
;
31 use Psr\Log\LoggerInterface
;
32 use Wikimedia\Rdbms\IConnectionProvider
;
38 class LinkBatchFactory
{
48 private $titleFormatter;
53 private $contentLanguage;
61 * @var IConnectionProvider
65 /** @var LinksMigration */
66 private $linksMigration;
68 /** @var LoggerInterface */
71 public function __construct(
73 TitleFormatter
$titleFormatter,
74 Language
$contentLanguage,
75 GenderCache
$genderCache,
76 IConnectionProvider
$dbProvider,
77 LinksMigration
$linksMigration,
78 LoggerInterface
$logger
80 $this->linkCache
= $linkCache;
81 $this->titleFormatter
= $titleFormatter;
82 $this->contentLanguage
= $contentLanguage;
83 $this->genderCache
= $genderCache;
84 $this->dbProvider
= $dbProvider;
85 $this->linksMigration
= $linksMigration;
86 $this->logger
= $logger;
90 * @param iterable<LinkTarget>|iterable<PageReference> $initialItems items to be added
94 public function newLinkBatch( iterable
$initialItems = [] ): LinkBatch
{
98 $this->titleFormatter
,
99 $this->contentLanguage
,
102 $this->linksMigration
,