|
MediaWiki master
|
XML file reader for the page data importer. More...
Public Member Functions | |
| __construct (ImportSource $source, Authority $performer, private readonly Config $config, HookContainer $hookContainer, private readonly Language $contentLanguage, private readonly NamespaceInfo $namespaceInfo, private readonly TitleFactory $titleFactory, private readonly WikiPageFactory $wikiPageFactory, private readonly UploadRevisionImporter $uploadRevisionImporter, private readonly IContentHandlerFactory $contentHandlerFactory, private readonly SlotRoleRegistry $slotRoleRegistry,) | |
| Creates an ImportXMLReader drawing from the source provided. | |
| beforeImportPage ( $titleAndForeignTitle) | |
| Default per-page callback. | |
| debug ( $data) | |
| disableStatisticsUpdate () | |
| Statistics update can cause a lot of time. | |
| doImport () | |
| Primary entry point. | |
| finishImportPage (PageIdentity $pageIdentity, $foreignTitle, $revCount, $sRevCount, $pageInfo) | |
| Mostly for hook use. | |
| getReader () | |
| importLogItem ( $revision) | |
| Default per-revision callback, performs the import. | |
| importRevision ( $revision) | |
| Default per-revision callback, performs the import. | |
| importUpload ( $revision) | |
| Dummy for now... | |
| nodeAttribute ( $attr) | |
| Retrieves the contents of the named attribute of the current element. | |
| nodeContents () | |
| Shouldn't something like this be built-in to XMLReader? Fetches text contents of the current element, assuming no sub-elements or such scary things. | |
| notice ( $msg,... $params) | |
| pageCallback ( $title) | |
| Notify the callback function when a new "<page>" is reached. | |
| setDebug ( $debug) | |
| Set debug mode... | |
| setImageBasePath ( $dir) | |
| setImportTitleFactory ( $factory) | |
| Sets the factory object to use to convert ForeignTitle objects into local Title objects. | |
| setImportUploads ( $import) | |
| setLogItemCallback ( $callback) | |
| Sets the action to perform as each log item reached. | |
| setNoticeCallback ( $callback) | |
| Set a callback that displays notice messages. | |
| setNoUpdates ( $noupdates) | |
| Set 'no updates' mode. | |
| setPageCallback ( $callback) | |
| Sets the action to perform as each new page in the stream is reached. | |
| setPageOffset ( $nthPage) | |
| Sets 'pageOffset' value. | |
| setPageOutCallback ( $callback) | |
| Sets the action to perform as each page in the stream is completed. | |
| setRevisionCallback ( $callback) | |
| Sets the action to perform as each page revision is reached. | |
| setSiteInfoCallback ( $callback) | |
| Sets the action to perform when site info is encountered. | |
| setTargetNamespace ( $namespace) | |
| Set a target namespace to override the defaults. | |
| setTargetRootPage ( $rootpage) | |
| Set a target root page under which all pages are imported. | |
| setUploadCallback ( $callback) | |
| Sets the action to perform as each file upload version is reached. | |
| setUsernamePrefix ( $usernamePrefix, $assignKnownUsers) | |
| throwXmlError ( $err) | |
| warn ( $data) | |
XML file reader for the page data importer.
implements Special:Import
Definition at line 59 of file WikiImporter.php.
| MediaWiki\Import\WikiImporter::__construct | ( | ImportSource | $source, |
| Authority | $performer, | ||
| private readonly Config | $config, | ||
| HookContainer | $hookContainer, | ||
| private readonly Language | $contentLanguage, | ||
| private readonly NamespaceInfo | $namespaceInfo, | ||
| private readonly TitleFactory | $titleFactory, | ||
| private readonly WikiPageFactory | $wikiPageFactory, | ||
| private readonly UploadRevisionImporter | $uploadRevisionImporter, | ||
| private readonly IContentHandlerFactory | $contentHandlerFactory, | ||
| private readonly SlotRoleRegistry | $slotRoleRegistry ) |
Creates an ImportXMLReader drawing from the source provided.
Definition at line 127 of file WikiImporter.php.
References $source, MediaWiki\Import\WikiImporter\beforeImportPage(), MediaWiki\Import\WikiImporter\finishImportPage(), MediaWiki\Import\WikiImporter\importLogItem(), MediaWiki\Import\WikiImporter\importRevision(), MediaWiki\Import\WikiImporter\importUpload(), MediaWiki\Import\UploadSourceAdapter\registerSource(), MediaWiki\Import\WikiImporter\setLogItemCallback(), MediaWiki\Import\WikiImporter\setPageCallback(), MediaWiki\Import\WikiImporter\setPageOutCallback(), MediaWiki\Import\WikiImporter\setRevisionCallback(), and MediaWiki\Import\WikiImporter\setUploadCallback().
| MediaWiki\Import\WikiImporter::beforeImportPage | ( | $titleAndForeignTitle | ) |
Default per-page callback.
Sets up some things related to site statistics
| array{0:Title,1:ForeignTitle} | $titleAndForeignTitle |
Definition at line 440 of file WikiImporter.php.
Referenced by MediaWiki\Import\WikiImporter\__construct().
| MediaWiki\Import\WikiImporter::debug | ( | $data | ) |
| string | $data |
Definition at line 183 of file WikiImporter.php.
References wfDebug().
Referenced by MediaWiki\Import\WikiImporter\doImport(), and MediaWiki\Import\WikiImporter\throwXmlError().
| MediaWiki\Import\WikiImporter::disableStatisticsUpdate | ( | ) |
Statistics update can cause a lot of time.
Definition at line 431 of file WikiImporter.php.
References MediaWiki\Import\WikiImporter\disableStatisticsUpdate().
Referenced by MediaWiki\Import\WikiImporter\disableStatisticsUpdate(), and MediaWiki\Import\WikiImporter\finishImportPage().
| MediaWiki\Import\WikiImporter::doImport | ( | ) |
Primary entry point.
\Exception
Definition at line 649 of file WikiImporter.php.
References MediaWiki\Import\WikiImporter\debug(), and MediaWiki\Import\WikiImporter\warn().
| MediaWiki\Import\WikiImporter::finishImportPage | ( | PageIdentity | $pageIdentity, |
| $foreignTitle, | |||
| $revCount, | |||
| $sRevCount, | |||
| $pageInfo ) |
Mostly for hook use.
| PageIdentity | $pageIdentity | |
| ForeignTitle | $foreignTitle | |
| int | $revCount | |
| int | $sRevCount | |
| array | $pageInfo |
Definition at line 506 of file WikiImporter.php.
References MediaWiki\Import\WikiImporter\disableStatisticsUpdate(), and wfDebug().
Referenced by MediaWiki\Import\WikiImporter\__construct().
| MediaWiki\Import\WikiImporter::getReader | ( | ) |
Definition at line 168 of file WikiImporter.php.
| MediaWiki\Import\WikiImporter::importLogItem | ( | $revision | ) |
Default per-revision callback, performs the import.
| WikiRevision | $revision |
Definition at line 483 of file WikiImporter.php.
Referenced by MediaWiki\Import\WikiImporter\__construct().
| MediaWiki\Import\WikiImporter::importRevision | ( | $revision | ) |
Default per-revision callback, performs the import.
| WikiRevision | $revision |
Definition at line 452 of file WikiImporter.php.
References MediaWiki\Import\WikiImporter\notice().
Referenced by MediaWiki\Import\WikiImporter\__construct().
| MediaWiki\Import\WikiImporter::importUpload | ( | $revision | ) |
Dummy for now...
| WikiRevision | $revision |
Definition at line 492 of file WikiImporter.php.
Referenced by MediaWiki\Import\WikiImporter\__construct().
| MediaWiki\Import\WikiImporter::nodeAttribute | ( | $attr | ) |
Retrieves the contents of the named attribute of the current element.
| string | $attr | The name of the attribute |
Definition at line 612 of file WikiImporter.php.
| MediaWiki\Import\WikiImporter::nodeContents | ( | ) |
Shouldn't something like this be built-in to XMLReader? Fetches text contents of the current element, assuming no sub-elements or such scary things.
Definition at line 623 of file WikiImporter.php.
| MediaWiki\Import\WikiImporter::notice | ( | $msg, | |
| $params ) |
| string | $msg | |
| MessageParam|MessageSpecifier|string|int|float|list<MessageParam|MessageSpecifier|string|int|float> | ...$params See Message::params() |
Definition at line 202 of file WikiImporter.php.
References wfDebug(), and wfMessage().
Referenced by MediaWiki\Import\WikiImporter\importRevision().
| MediaWiki\Import\WikiImporter::pageCallback | ( | $title | ) |
Notify the callback function when a new "<page>" is reached.
| array | $title |
Definition at line 559 of file WikiImporter.php.
| MediaWiki\Import\WikiImporter::setDebug | ( | $debug | ) |
| MediaWiki\Import\WikiImporter::setImageBasePath | ( | $dir | ) |
| string | $dir |
Definition at line 407 of file WikiImporter.php.
| MediaWiki\Import\WikiImporter::setImportTitleFactory | ( | $factory | ) |
Sets the factory object to use to convert ForeignTitle objects into local Title objects.
| ImportTitleFactory | $factory |
Definition at line 323 of file WikiImporter.php.
Referenced by MediaWiki\Import\WikiImporter\setTargetNamespace(), and MediaWiki\Import\WikiImporter\setTargetRootPage().
| MediaWiki\Import\WikiImporter::setImportUploads | ( | $import | ) |
| bool | $import |
Definition at line 414 of file WikiImporter.php.
| MediaWiki\Import\WikiImporter::setLogItemCallback | ( | $callback | ) |
Sets the action to perform as each log item reached.
| callable | $callback |
Definition at line 301 of file WikiImporter.php.
Referenced by MediaWiki\Import\WikiImporter\__construct(), and MediaWiki\Specials\Helpers\ImportReporter\__construct().
| MediaWiki\Import\WikiImporter::setNoticeCallback | ( | $callback | ) |
Set a callback that displays notice messages.
| callable | $callback |
Definition at line 244 of file WikiImporter.php.
References wfSetVar().
Referenced by MediaWiki\Specials\Helpers\ImportReporter\__construct().
| MediaWiki\Import\WikiImporter::setNoUpdates | ( | $noupdates | ) |
Set 'no updates' mode.
In this mode, the link tables will not be updated by the importer
| bool | $noupdates |
Definition at line 224 of file WikiImporter.php.
| MediaWiki\Import\WikiImporter::setPageCallback | ( | $callback | ) |
Sets the action to perform as each new page in the stream is reached.
| callable | null | $callback |
Definition at line 253 of file WikiImporter.php.
Referenced by MediaWiki\Import\WikiImporter\__construct().
| MediaWiki\Import\WikiImporter::setPageOffset | ( | $nthPage | ) |
Sets 'pageOffset' value.
So it will skip the first n-1 pages and start from the nth page. It's 1-based indexing.
| int | $nthPage |
Definition at line 234 of file WikiImporter.php.
| MediaWiki\Import\WikiImporter::setPageOutCallback | ( | $callback | ) |
Sets the action to perform as each page in the stream is completed.
Callback accepts the page title (as a Title object), a second object with the original title form (in case it's been overridden into a local namespace), and a count of revisions.
| callable | null | $callback |
Definition at line 268 of file WikiImporter.php.
Referenced by MediaWiki\Import\WikiImporter\__construct(), and MediaWiki\Specials\Helpers\ImportReporter\__construct().
| MediaWiki\Import\WikiImporter::setRevisionCallback | ( | $callback | ) |
Sets the action to perform as each page revision is reached.
| callable | null | $callback |
Definition at line 279 of file WikiImporter.php.
Referenced by MediaWiki\Import\WikiImporter\__construct().
| MediaWiki\Import\WikiImporter::setSiteInfoCallback | ( | $callback | ) |
Sets the action to perform when site info is encountered.
| callable | $callback |
Definition at line 312 of file WikiImporter.php.
| MediaWiki\Import\WikiImporter::setTargetNamespace | ( | $namespace | ) |
Set a target namespace to override the defaults.
| null | int | $namespace |
Definition at line 332 of file WikiImporter.php.
References MediaWiki\Import\WikiImporter\setImportTitleFactory().
Referenced by MediaWiki\Import\WikiImporter\setTargetRootPage().
| MediaWiki\Import\WikiImporter::setTargetRootPage | ( | $rootpage | ) |
Set a target root page under which all pages are imported.
| null | string | $rootpage |
Definition at line 366 of file WikiImporter.php.
References NS_MAIN, MediaWiki\Import\WikiImporter\setImportTitleFactory(), MediaWiki\Import\WikiImporter\setTargetNamespace(), and wfMessage().
| MediaWiki\Import\WikiImporter::setUploadCallback | ( | $callback | ) |
Sets the action to perform as each file upload version is reached.
| callable | $callback |
Definition at line 290 of file WikiImporter.php.
Referenced by MediaWiki\Import\WikiImporter\__construct().
| MediaWiki\Import\WikiImporter::setUsernamePrefix | ( | $usernamePrefix, | |
| $assignKnownUsers ) |
| string | $usernamePrefix | Prefix to apply to unknown (and possibly also known) usernames |
| bool | $assignKnownUsers | Whether to apply the prefix to usernames that exist locally |
Definition at line 423 of file WikiImporter.php.
| MediaWiki\Import\WikiImporter::throwXmlError | ( | $err | ) |
| string | $err |
Definition at line 175 of file WikiImporter.php.
References MediaWiki\Import\WikiImporter\debug(), and wfDebug().
| MediaWiki\Import\WikiImporter::warn | ( | $data | ) |
| string | $data |
Definition at line 192 of file WikiImporter.php.
References wfDebug().
Referenced by MediaWiki\Import\WikiImporter\doImport().