| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
use MediaWiki\Config\Config; |
| 23 |
use MediaWiki\Content\IContentHandlerFactory; |
| 24 |
use MediaWiki\Context\RequestContext; |
| 25 |
use MediaWiki\HookContainer\HookContainer; |
| 26 |
use MediaWiki\Language\Language; |
| 27 |
use MediaWiki\Page\WikiPageFactory; |
| 28 |
use MediaWiki\Permissions\Authority; |
| 29 |
use MediaWiki\Revision\SlotRoleRegistry; |
| 30 |
use MediaWiki\Title\NamespaceInfo; |
| 31 |
use MediaWiki\Title\TitleFactory; |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
class WikiImporterFactory { |
| 39 |
private Config $config; |
| 40 |
private HookContainer $hookContainer; |
| 41 |
private Language $contentLanguage; |
| 42 |
private NamespaceInfo $namespaceInfo; |
| 43 |
private TitleFactory $titleFactory; |
| 44 |
private WikiPageFactory $wikiPageFactory; |
| 45 |
private UploadRevisionImporter $uploadRevisionImporter; |
| 46 |
private IContentHandlerFactory $contentHandlerFactory; |
| 47 |
private SlotRoleRegistry $slotRoleRegistry; |
| 48 |
|
| 49 |
public function __construct( |
| 50 |
Config $config, |
| 51 |
HookContainer $hookContainer, |
| 52 |
Language $contentLanguage, |
| 53 |
NamespaceInfo $namespaceInfo, |
| 54 |
TitleFactory $titleFactory, |
| 55 |
WikiPageFactory $wikiPageFactory, |
| 56 |
UploadRevisionImporter $uploadRevisionImporter, |
| 57 |
IContentHandlerFactory $contentHandlerFactory, |
| 58 |
SlotRoleRegistry $slotRoleRegistry |
| 59 |
) { |
| 60 |
$this->config = $config; |
| 61 |
$this->hookContainer = $hookContainer; |
| 62 |
$this->contentLanguage = $contentLanguage; |
| 63 |
$this->namespaceInfo = $namespaceInfo; |
| 64 |
$this->titleFactory = $titleFactory; |
| 65 |
$this->wikiPageFactory = $wikiPageFactory; |
| 66 |
$this->uploadRevisionImporter = $uploadRevisionImporter; |
| 67 |
$this->contentHandlerFactory = $contentHandlerFactory; |
| 68 |
$this->slotRoleRegistry = $slotRoleRegistry; |
| 69 |
} |
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
public function getWikiImporter( ImportSource $source, ?Authority $performer = null ): WikiImporter { |
| 83 |
if ( !$performer ) { |
| 84 |
wfDeprecated( __METHOD__ . ' without $performer', '1.42' ); |
| 85 |
$performer = RequestContext::getMain()->getAuthority(); |
| 86 |
} |
| 87 |
|
| 88 |
return new WikiImporter( |
| 89 |
$source, |
| 90 |
$performer, |
| 91 |
$this->config, |
| 92 |
$this->hookContainer, |
| 93 |
$this->contentLanguage, |
| 94 |
$this->namespaceInfo, |
| 95 |
$this->titleFactory, |
| 96 |
$this->wikiPageFactory, |
| 97 |
$this->uploadRevisionImporter, |
| 98 |
$this->contentHandlerFactory, |
| 99 |
$this->slotRoleRegistry |
| 100 |
); |
| 101 |
} |
| 102 |
} |