MediaWiki REL1_37
|
XML file reader for the page data importer. More...
Public Member Functions | |
__construct (ImportSource $source, Config $config, HookContainer $hookContainer, Language $contentLanguage, NamespaceInfo $namespaceInfo, TitleFactory $titleFactory, WikiPageFactory $wikiPageFactory, UploadRevisionImporter $uploadRevisionImporter, PermissionManager $permissionManager, IContentHandlerFactory $contentHandlerFactory, 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) | |
Private Member Functions | |
dumpTemp ( $contents) | |
getContentHandler ( $model) | |
getDefaultContentModel ( $title, $role) | |
handleContent () | |
handleContributor () | |
handleLogItem () | |
handlePage () | |
handleRevision (&$pageInfo) | |
handleSiteInfo () | |
handleUpload (&$pageInfo) | |
logItemCallback ( $revision) | |
Notify the callback function of a new log item. | |
makeContent (Title $title, $revisionId, $contentInfo) | |
pageOutCallback (PageIdentity $pageIdentity, $foreignTitle, $revCount, $sucCount, $pageInfo) | |
Notify the callback function when a "</page>" is closed. | |
processLogItem ( $logInfo) | |
processRevision ( $pageInfo, $revisionInfo) | |
processTitle ( $text, $ns=null) | |
processUpload ( $pageInfo, $uploadInfo) | |
revisionCallback ( $revision) | |
Notify the callback function of a revision. | |
siteInfoCallback ( $siteInfo) | |
Notify the callback function of site info. | |
Private Attributes | |
Config | $config |
IContentHandlerFactory | $contentHandlerFactory |
Language | $contentLanguage |
array | $countableCache = [] |
bool | $disableStatisticsUpdate = false |
ExternalUserNames | $externalUserNames |
array null | $foreignNamespaces = null |
HookRunner | $hookRunner |
ImportTitleFactory | $importTitleFactory |
bool null | $mDebug |
string null | $mImageBasePath |
bool null | $mImportUploads |
callable | $mLogItemCallback |
callable null | $mNoticeCallback |
bool | $mNoUpdates = false |
callable | $mPageCallback |
callable | $mPageOutCallback |
callable | $mRevisionCallback |
callable null | $mSiteInfoCallback |
callable | $mUploadCallback |
NamespaceInfo | $namespaceInfo |
int | $pageOffset = 0 |
PermissionManager | $permissionManager |
XMLReader | $reader |
SlotRoleRegistry | $slotRoleRegistry |
TitleFactory | $titleFactory |
UploadRevisionImporter | $uploadRevisionImporter |
WikiPageFactory | $wikiPageFactory |
XML file reader for the page data importer.
implements Special:Import
Definition at line 43 of file WikiImporter.php.
WikiImporter::__construct | ( | ImportSource | $source, |
Config | $config, | ||
HookContainer | $hookContainer, | ||
Language | $contentLanguage, | ||
NamespaceInfo | $namespaceInfo, | ||
TitleFactory | $titleFactory, | ||
WikiPageFactory | $wikiPageFactory, | ||
UploadRevisionImporter | $uploadRevisionImporter, | ||
PermissionManager | $permissionManager, | ||
IContentHandlerFactory | $contentHandlerFactory, | ||
SlotRoleRegistry | $slotRoleRegistry | ||
) |
Creates an ImportXMLReader drawing from the source provided.
ImportSource | $source | |
Config | $config | |
HookContainer | $hookContainer | |
Language | $contentLanguage | |
NamespaceInfo | $namespaceInfo | |
TitleFactory | $titleFactory | |
WikiPageFactory | $wikiPageFactory | |
UploadRevisionImporter | $uploadRevisionImporter | |
PermissionManager | $permissionManager | |
IContentHandlerFactory | $contentHandlerFactory | |
SlotRoleRegistry | $slotRoleRegistry |
MWException |
Definition at line 143 of file WikiImporter.php.
References $source, UploadSourceAdapter\registerSource(), setLogItemCallback(), setPageCallback(), setPageOutCallback(), setRevisionCallback(), and setUploadCallback().
WikiImporter::beforeImportPage | ( | $titleAndForeignTitle | ) |
Default per-page callback.
Sets up some things related to site statistics
array | $titleAndForeignTitle | Two-element array, with Title object at index 0 and ForeignTitle object at index 1 |
Definition at line 481 of file WikiImporter.php.
References $title.
WikiImporter::debug | ( | $data | ) |
string | $data |
Definition at line 225 of file WikiImporter.php.
References wfDebug().
Referenced by doImport(), handleContent(), handleContributor(), handleLogItem(), handlePage(), handleRevision(), handleSiteInfo(), handleUpload(), and throwXmlError().
WikiImporter::disableStatisticsUpdate | ( | ) |
Statistics update can cause a lot of time.
Definition at line 471 of file WikiImporter.php.
References disableStatisticsUpdate().
Referenced by disableStatisticsUpdate(), and finishImportPage().
WikiImporter::doImport | ( | ) |
Primary entry point.
Exception | |
MWException |
Definition at line 701 of file WikiImporter.php.
References $type, debug(), handleLogItem(), handlePage(), handleSiteInfo(), and warn().
|
private |
string | $contents |
Definition at line 1187 of file WikiImporter.php.
References wfTempDir().
Referenced by handleUpload().
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 547 of file WikiImporter.php.
References $content, $title, disableStatisticsUpdate(), and wfDebug().
|
private |
string | $model |
Definition at line 1316 of file WikiImporter.php.
Referenced by makeContent().
|
private |
Title | $title | |
string | $role |
Definition at line 1326 of file WikiImporter.php.
References $title.
Referenced by makeContent().
WikiImporter::getReader | ( | ) |
Definition at line 210 of file WikiImporter.php.
|
private |
Definition at line 999 of file WikiImporter.php.
References debug(), nodeContents(), and warn().
Referenced by handleRevision().
|
private |
Definition at line 1240 of file WikiImporter.php.
References debug(), and nodeContents().
Referenced by handleLogItem(), handleRevision(), and handleUpload().
|
private |
Definition at line 796 of file WikiImporter.php.
References debug(), handleContributor(), nodeContents(), processLogItem(), and warn().
Referenced by doImport().
|
private |
Definition at line 871 of file WikiImporter.php.
References $title, debug(), handleRevision(), handleUpload(), nodeAttribute(), nodeContents(), pageCallback(), pageOutCallback(), processTitle(), and warn().
Referenced by doImport().
|
private |
array | &$pageInfo |
Definition at line 959 of file WikiImporter.php.
References debug(), handleContent(), handleContributor(), nodeContents(), processRevision(), and warn().
Referenced by handlePage().
|
private |
Definition at line 769 of file WikiImporter.php.
References debug(), nodeAttribute(), nodeContents(), and siteInfoCallback().
Referenced by doImport().
|
private |
array | &$pageInfo |
Definition at line 1134 of file WikiImporter.php.
References $path, debug(), dumpTemp(), handleContributor(), nodeContents(), processUpload(), and warn().
Referenced by handlePage().
WikiImporter::importLogItem | ( | $revision | ) |
Default per-revision callback, performs the import.
WikiRevision | $revision |
Definition at line 524 of file WikiImporter.php.
WikiImporter::importRevision | ( | $revision | ) |
Default per-revision callback, performs the import.
WikiRevision | $revision |
Definition at line 493 of file WikiImporter.php.
References notice().
WikiImporter::importUpload | ( | $revision | ) |
Dummy for now...
WikiRevision | $revision |
Definition at line 533 of file WikiImporter.php.
|
private |
Notify the callback function of a new log item.
WikiRevision | $revision |
Definition at line 646 of file WikiImporter.php.
Referenced by processLogItem().
|
private |
Title | $title | |
int | $revisionId | |
array | $contentInfo |
MWException |
Definition at line 1038 of file WikiImporter.php.
References $title, $wgMaxArticleSize, getContentHandler(), and getDefaultContentModel().
Referenced by processRevision(), and processUpload().
WikiImporter::nodeAttribute | ( | $attr | ) |
Retrieves the contents of the named attribute of the current element.
string | $attr | The name of the attribute |
Definition at line 663 of file WikiImporter.php.
Referenced by handlePage(), and handleSiteInfo().
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 674 of file WikiImporter.php.
Referenced by handleContent(), handleContributor(), handleLogItem(), handlePage(), handleRevision(), handleSiteInfo(), and handleUpload().
WikiImporter::notice | ( | $msg, | |
$params | |||
) |
string | $msg | |
mixed | ...$params |
Definition at line 242 of file WikiImporter.php.
References wfDebug(), and wfMessage().
Referenced by importRevision(), and processTitle().
WikiImporter::pageCallback | ( | $title | ) |
Notify the callback function when a new "<page>" is reached.
array | $title |
Definition at line 604 of file WikiImporter.php.
References $title.
Referenced by handlePage().
|
private |
Notify the callback function when a "</page>" is closed.
PageIdentity | $pageIdentity | |
ForeignTitle | $foreignTitle | |
int | $revCount | |
int | $sucCount | Number of revisions for which callback returned true |
array | $pageInfo | Associative array of page information |
Definition at line 618 of file WikiImporter.php.
Referenced by handlePage().
|
private |
array | $logInfo |
Definition at line 830 of file WikiImporter.php.
References logItemCallback().
Referenced by handleLogItem().
|
private |
array | $pageInfo | |
array | $revisionInfo |
MWException |
Definition at line 1082 of file WikiImporter.php.
References $content, $title, makeContent(), revisionCallback(), and wfTimestampNow().
Referenced by handleRevision().
|
private |
string | $text | |
string | null | $ns |
Definition at line 1271 of file WikiImporter.php.
References $title, and notice().
Referenced by handlePage().
|
private |
array | $pageInfo | |
array | $uploadInfo |
Definition at line 1198 of file WikiImporter.php.
References $content, $title, and makeContent().
Referenced by handleUpload().
|
private |
Notify the callback function of a revision.
WikiRevision | $revision |
Definition at line 630 of file WikiImporter.php.
Referenced by processRevision().
WikiImporter::setDebug | ( | $debug | ) |
Set debug mode...
bool | $debug |
Definition at line 256 of file WikiImporter.php.
References $debug.
WikiImporter::setImageBasePath | ( | $dir | ) |
string | $dir |
Definition at line 447 of file WikiImporter.php.
WikiImporter::setImportTitleFactory | ( | $factory | ) |
Sets the factory object to use to convert ForeignTitle objects into local Title objects.
ImportTitleFactory | $factory |
Definition at line 363 of file WikiImporter.php.
Referenced by setTargetNamespace(), and setTargetRootPage().
WikiImporter::setImportUploads | ( | $import | ) |
bool | $import |
Definition at line 454 of file WikiImporter.php.
WikiImporter::setLogItemCallback | ( | $callback | ) |
Sets the action to perform as each log item reached.
callable | $callback |
Definition at line 341 of file WikiImporter.php.
Referenced by __construct().
WikiImporter::setNoticeCallback | ( | $callback | ) |
Set a callback that displays notice messages.
callable | $callback |
Definition at line 284 of file WikiImporter.php.
References wfSetVar().
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 264 of file WikiImporter.php.
WikiImporter::setPageCallback | ( | $callback | ) |
Sets the action to perform as each new page in the stream is reached.
callable | $callback |
Definition at line 293 of file WikiImporter.php.
Referenced by __construct().
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 274 of file WikiImporter.php.
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 | $callback |
Definition at line 308 of file WikiImporter.php.
Referenced by __construct().
WikiImporter::setRevisionCallback | ( | $callback | ) |
Sets the action to perform as each page revision is reached.
callable | $callback |
Definition at line 319 of file WikiImporter.php.
Referenced by __construct().
WikiImporter::setSiteInfoCallback | ( | $callback | ) |
Sets the action to perform when site info is encountered.
callable | $callback |
Definition at line 352 of file WikiImporter.php.
WikiImporter::setTargetNamespace | ( | $namespace | ) |
Set a target namespace to override the defaults.
null | int | $namespace |
Definition at line 372 of file WikiImporter.php.
References setImportTitleFactory().
Referenced by setTargetRootPage().
WikiImporter::setTargetRootPage | ( | $rootpage | ) |
Set a target root page under which all pages are imported.
null | string | $rootpage |
Definition at line 406 of file WikiImporter.php.
References $title, NS_MAIN, setImportTitleFactory(), setTargetNamespace(), and wfMessage().
WikiImporter::setUploadCallback | ( | $callback | ) |
Sets the action to perform as each file upload version is reached.
callable | $callback |
Definition at line 330 of file WikiImporter.php.
Referenced by __construct().
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 463 of file WikiImporter.php.
|
private |
Notify the callback function of site info.
array | $siteInfo |
Definition at line 589 of file WikiImporter.php.
Referenced by handleSiteInfo().
WikiImporter::throwXmlError | ( | $err | ) |
string | $err |
Definition at line 217 of file WikiImporter.php.
WikiImporter::warn | ( | $data | ) |
string | $data |
Definition at line 234 of file WikiImporter.php.
References wfDebug().
Referenced by doImport(), handleContent(), handleLogItem(), handlePage(), handleRevision(), and handleUpload().
|
private |
Definition at line 87 of file WikiImporter.php.
|
private |
Definition at line 123 of file WikiImporter.php.
|
private |
Definition at line 105 of file WikiImporter.php.
|
private |
Definition at line 96 of file WikiImporter.php.
|
private |
Definition at line 99 of file WikiImporter.php.
|
private |
Definition at line 102 of file WikiImporter.php.
|
private |
Definition at line 48 of file WikiImporter.php.
|
private |
Definition at line 93 of file WikiImporter.php.
|
private |
Definition at line 90 of file WikiImporter.php.
|
private |
Definition at line 72 of file WikiImporter.php.
|
private |
Definition at line 78 of file WikiImporter.php.
|
private |
Definition at line 75 of file WikiImporter.php.
|
private |
Definition at line 51 of file WikiImporter.php.
|
private |
Definition at line 69 of file WikiImporter.php.
|
private |
Definition at line 81 of file WikiImporter.php.
|
private |
Definition at line 60 of file WikiImporter.php.
|
private |
Definition at line 66 of file WikiImporter.php.
|
private |
Definition at line 57 of file WikiImporter.php.
|
private |
Definition at line 63 of file WikiImporter.php.
|
private |
Definition at line 54 of file WikiImporter.php.
|
private |
Definition at line 108 of file WikiImporter.php.
|
private |
Definition at line 84 of file WikiImporter.php.
|
private |
Definition at line 120 of file WikiImporter.php.
|
private |
Definition at line 45 of file WikiImporter.php.
|
private |
Definition at line 126 of file WikiImporter.php.
|
private |
Definition at line 111 of file WikiImporter.php.
|
private |
Definition at line 117 of file WikiImporter.php.
|
private |
Definition at line 114 of file WikiImporter.php.