Merge ".mailmap: Correct two contributor names"
[mediawiki.git] / includes / export / WikiExporterFactory.php
blob7f95a9907bb1dfcef0bf2725c98a2b64c60d52e1
1 <?php
2 /**
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
18 * @file
21 namespace MediaWiki\Export;
23 use MediaWiki\CommentStore\CommentStore;
24 use MediaWiki\HookContainer\HookContainer;
25 use MediaWiki\Revision\RevisionStore;
26 use MediaWiki\Title\TitleParser;
27 use WikiExporter;
28 use Wikimedia\Rdbms\IReadableDatabase;
30 /**
31 * Factory service for WikiExporter instances.
33 * @author Zabe
34 * @since 1.38
36 class WikiExporterFactory {
37 /** @var HookContainer */
38 private $hookContainer;
40 /** @var RevisionStore */
41 private $revisionStore;
43 /** @var TitleParser */
44 private $titleParser;
46 /** @var CommentStore */
47 private $commentStore;
49 /**
50 * @param HookContainer $hookContainer
51 * @param RevisionStore $revisionStore
52 * @param TitleParser $titleParser
53 * @param CommentStore $commentStore
55 public function __construct(
56 HookContainer $hookContainer,
57 RevisionStore $revisionStore,
58 TitleParser $titleParser,
59 CommentStore $commentStore
60 ) {
61 $this->hookContainer = $hookContainer;
62 $this->revisionStore = $revisionStore;
63 $this->titleParser = $titleParser;
64 $this->commentStore = $commentStore;
67 /**
68 * @param IReadableDatabase $db
69 * @param int|array $history
70 * @param int $text
71 * @param null|array $limitNamespaces
73 * @return WikiExporter
75 public function getWikiExporter(
76 IReadableDatabase $db,
77 $history = WikiExporter::CURRENT,
78 $text = WikiExporter::TEXT,
79 $limitNamespaces = null
80 ): WikiExporter {
81 return new WikiExporter(
82 $db,
83 $this->commentStore,
84 $this->hookContainer,
85 $this->revisionStore,
86 $this->titleParser,
87 $history,
88 $text,
89 $limitNamespaces