MediaWiki
1.33.1
|
XML file reader for the page data importer. More...
Public Member Functions | |
__construct (ImportSource $source, Config $config) | |
Creates an ImportXMLReader drawing from the source provided. More... | |
beforeImportPage ( $titleAndForeignTitle) | |
Default per-page callback. More... | |
debug ( $data) | |
debugRevisionHandler (&$revision) | |
Alternate per-revision callback, for debugging. More... | |
disableStatisticsUpdate () | |
Statistics update can cause a lot of time. More... | |
doImport () | |
Primary entry point. More... | |
finishImportPage ( $title, $foreignTitle, $revCount, $sRevCount, $pageInfo) | |
Mostly for hook use. More... | |
getReader () | |
importLogItem ( $revision) | |
Default per-revision callback, performs the import. More... | |
importRevision ( $revision) | |
Default per-revision callback, performs the import. More... | |
importUpload ( $revision) | |
Dummy for now... More... | |
nodeAttribute ( $attr) | |
Retrieves the contents of the named attribute of the current element. More... | |
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. More... | |
notice ( $msg) | |
pageCallback ( $title) | |
Notify the callback function when a new "<page>" is reached. More... | |
setDebug ( $debug) | |
Set debug mode... More... | |
setImageBasePath ( $dir) | |
setImportTitleFactory ( $factory) | |
Sets the factory object to use to convert ForeignTitle objects into local Title objects. More... | |
setImportUploads ( $import) | |
setLogItemCallback ( $callback) | |
Sets the action to perform as each log item reached. More... | |
setNoticeCallback ( $callback) | |
Set a callback that displays notice messages. More... | |
setNoUpdates ( $noupdates) | |
Set 'no updates' mode. More... | |
setPageCallback ( $callback) | |
Sets the action to perform as each new page in the stream is reached. More... | |
setPageOffset ( $nthPage) | |
Sets 'pageOffset' value. More... | |
setPageOutCallback ( $callback) | |
Sets the action to perform as each page in the stream is completed. More... | |
setRevisionCallback ( $callback) | |
Sets the action to perform as each page revision is reached. More... | |
setSiteInfoCallback ( $callback) | |
Sets the action to perform when site info is encountered. More... | |
setTargetNamespace ( $namespace) | |
Set a target namespace to override the defaults. More... | |
setTargetRootPage ( $rootpage) | |
Set a target root page under which all pages are imported. More... | |
setUploadCallback ( $callback) | |
Sets the action to perform as each file upload version is reached. More... | |
setUsernamePrefix ( $usernamePrefix, $assignKnownUsers) | |
throwXmlError ( $err) | |
warn ( $data) | |
Public Attributes | |
$mDebug | |
$mImageBasePath | |
$mPageCallback | |
$mPageOutCallback | |
$mRevisionCallback | |
$mUploadCallback | |
Private Member Functions | |
dumpTemp ( $contents) | |
handleContributor () | |
handleLogItem () | |
handlePage () | |
handleRevision (&$pageInfo) | |
handleSiteInfo () | |
handleUpload (&$pageInfo) | |
logItemCallback ( $revision) | |
Notify the callback function of a new log item. More... | |
pageOutCallback ( $title, $foreignTitle, $revCount, $sucCount, $pageInfo) | |
Notify the callback function when a "</page>" is closed. More... | |
processLogItem ( $logInfo) | |
processRevision ( $pageInfo, $revisionInfo) | |
processTitle ( $text, $ns=null) | |
processUpload ( $pageInfo, $uploadInfo) | |
revisionCallback ( $revision) | |
Notify the callback function of a revision. More... | |
siteInfoCallback ( $siteInfo) | |
Notify the callback function of site info. More... | |
XML file reader for the page data importer.
implements Special:Import
Definition at line 35 of file WikiImporter.php.
WikiImporter::__construct | ( | ImportSource | $source, |
Config | $config | ||
) |
Creates an ImportXMLReader drawing from the source provided.
ImportSource | $source | |
Config | $config |
Exception |
Definition at line 61 of file WikiImporter.php.
References $config, $source, class, 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 341 of file WikiImporter.php.
References $title, and WikiPage\factory().
WikiImporter::debug | ( | $data | ) |
Definition at line 113 of file WikiImporter.php.
References wfDebug().
Referenced by debugRevisionHandler(), doImport(), handleLogItem(), handlePage(), handleRevision(), handleSiteInfo(), handleUpload(), and throwXmlError().
WikiImporter::debugRevisionHandler | ( | & | $revision | ) |
Alternate per-revision callback, for debugging.
WikiRevision | &$revision |
Definition at line 441 of file WikiImporter.php.
References debug().
WikiImporter::disableStatisticsUpdate | ( | ) |
Statistics update can cause a lot of time.
Definition at line 331 of file WikiImporter.php.
Referenced by finishImportPage().
WikiImporter::doImport | ( | ) |
Primary entry point.
Exception | |
MWException |
Definition at line 566 of file WikiImporter.php.
References $type, debug(), handleLogItem(), handlePage(), handleSiteInfo(), Hooks\run(), and warn().
|
private |
string | $contents |
Definition at line 1001 of file WikiImporter.php.
References wfTempDir().
Referenced by handleUpload().
WikiImporter::finishImportPage | ( | $title, | |
$foreignTitle, | |||
$revCount, | |||
$sRevCount, | |||
$pageInfo | |||
) |
Mostly for hook use.
Title | $title | |
ForeignTitle | $foreignTitle | |
int | $revCount | |
int | $sRevCount | |
array | $pageInfo |
Definition at line 404 of file WikiImporter.php.
References $args, $content, $title, DeferredUpdates\addUpdate(), disableStatisticsUpdate(), SiteStatsUpdate\factory(), WikiPage\factory(), Hooks\run(), and wfDebug().
WikiImporter::getReader | ( | ) |
|
private |
Definition at line 1051 of file WikiImporter.php.
References nodeContents().
Referenced by handleLogItem(), handleRevision(), and handleUpload().
|
private |
Definition at line 666 of file WikiImporter.php.
References debug(), handleContributor(), nodeContents(), processLogItem(), Hooks\run(), and warn().
Referenced by doImport().
|
private |
Definition at line 743 of file WikiImporter.php.
References $title, debug(), handleRevision(), handleUpload(), list, nodeAttribute(), nodeContents(), pageCallback(), pageOutCallback(), processTitle(), Hooks\run(), and warn().
Referenced by doImport().
|
private |
array | $pageInfo |
Definition at line 827 of file WikiImporter.php.
References debug(), handleContributor(), nodeContents(), processRevision(), Hooks\run(), and warn().
Referenced by handlePage().
|
private |
Definition at line 639 of file WikiImporter.php.
References $foreignNamespaces, debug(), nodeAttribute(), nodeContents(), and siteInfoCallback().
Referenced by doImport().
|
private |
array | $pageInfo |
Definition at line 946 of file WikiImporter.php.
References $path, debug(), dumpTemp(), handleContributor(), nodeContents(), processUpload(), Hooks\run(), and warn().
Referenced by handlePage().
WikiImporter::importLogItem | ( | $revision | ) |
Default per-revision callback, performs the import.
WikiRevision | $revision |
Definition at line 382 of file WikiImporter.php.
WikiImporter::importRevision | ( | $revision | ) |
Default per-revision callback, performs the import.
WikiRevision | $revision |
Definition at line 353 of file WikiImporter.php.
References notice().
WikiImporter::importUpload | ( | $revision | ) |
Dummy for now...
WikiRevision | $revision |
Definition at line 391 of file WikiImporter.php.
|
private |
Notify the callback function of a new log item.
WikiRevision | $revision |
Definition at line 513 of file WikiImporter.php.
Referenced by processLogItem().
WikiImporter::nodeAttribute | ( | $attr | ) |
Retrieves the contents of the named attribute of the current element.
string | $attr | The name of the attribute |
Definition at line 528 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 539 of file WikiImporter.php.
References $buffer.
Referenced by handleContributor(), handleLogItem(), handlePage(), handleRevision(), handleSiteInfo(), and handleUpload().
WikiImporter::notice | ( | $msg | ) |
Definition at line 123 of file WikiImporter.php.
References $params, text, wfDebug(), and wfMessage().
Referenced by importRevision(), and processTitle().
WikiImporter::pageCallback | ( | $title | ) |
Notify the callback function when a new "<page>" is reached.
Title | $title |
Definition at line 472 of file WikiImporter.php.
References $title.
Referenced by handlePage().
|
private |
Notify the callback function when a "</page>" is closed.
Title | $title | |
ForeignTitle | $foreignTitle | |
int | $revCount | |
int | $sucCount | Number of revisions for which callback returned true |
array | $pageInfo | Associative array of page information |
Definition at line 486 of file WikiImporter.php.
References $args.
Referenced by handlePage().
|
private |
array | $logInfo |
Definition at line 702 of file WikiImporter.php.
References logItemCallback(), and Title\newFromText().
Referenced by handleLogItem().
|
private |
array | $pageInfo | |
array | $revisionInfo |
MWException |
Definition at line 869 of file WikiImporter.php.
References $handler, $wgMaxArticleSize, revisionCallback(), and wfTimestampNow().
Referenced by handleRevision().
|
private |
string | $text | |
string | null | $ns |
Definition at line 1079 of file WikiImporter.php.
References $title, and notice().
Referenced by handlePage().
|
private |
array | $pageInfo | |
array | $uploadInfo |
Definition at line 1012 of file WikiImporter.php.
Referenced by handleUpload().
|
private |
Notify the callback function of a revision.
WikiRevision | $revision |
Definition at line 499 of file WikiImporter.php.
Referenced by processRevision().
WikiImporter::setDebug | ( | $debug | ) |
Set debug mode...
bool | $debug |
Definition at line 140 of file WikiImporter.php.
References $debug.
Referenced by ImportLinkCacheIntegrationTest\doImport().
WikiImporter::setImageBasePath | ( | $dir | ) |
string | $dir |
Definition at line 307 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 247 of file WikiImporter.php.
Referenced by setTargetNamespace(), and setTargetRootPage().
WikiImporter::setImportUploads | ( | $import | ) |
bool | $import |
Definition at line 314 of file WikiImporter.php.
WikiImporter::setLogItemCallback | ( | $callback | ) |
Sets the action to perform as each log item reached.
callable | $callback |
Definition at line 225 of file WikiImporter.php.
References $mLogItemCallback.
Referenced by __construct().
WikiImporter::setNoticeCallback | ( | $callback | ) |
Set a callback that displays notice messages.
callable | $callback |
Definition at line 168 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 148 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 177 of file WikiImporter.php.
References $mPageCallback.
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 158 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 192 of file WikiImporter.php.
References $mPageOutCallback.
Referenced by __construct().
WikiImporter::setRevisionCallback | ( | $callback | ) |
Sets the action to perform as each page revision is reached.
callable | $callback |
Definition at line 203 of file WikiImporter.php.
References $mRevisionCallback.
Referenced by __construct().
WikiImporter::setSiteInfoCallback | ( | $callback | ) |
Sets the action to perform when site info is encountered.
callable | $callback |
Definition at line 236 of file WikiImporter.php.
References $mSiteInfoCallback.
WikiImporter::setTargetNamespace | ( | $namespace | ) |
Set a target namespace to override the defaults.
null | int | $namespace |
Definition at line 256 of file WikiImporter.php.
References MWNamespace\exists(), and setImportTitleFactory().
Referenced by SpecialImport\doImport(), ApiImport\execute(), and setTargetRootPage().
WikiImporter::setTargetRootPage | ( | $rootpage | ) |
Set a target root page under which all pages are imported.
null | string | $rootpage |
Definition at line 278 of file WikiImporter.php.
References $title, MWNamespace\hasSubpages(), Title\newFromText(), StatusValue\newGood(), 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 214 of file WikiImporter.php.
References $mUploadCallback.
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 323 of file WikiImporter.php.
|
private |
Notify the callback function of site info.
array | $siteInfo |
Definition at line 459 of file WikiImporter.php.
Referenced by handleSiteInfo().
WikiImporter::throwXmlError | ( | $err | ) |
Definition at line 108 of file WikiImporter.php.
WikiImporter::warn | ( | $data | ) |
Definition at line 119 of file WikiImporter.php.
References wfDebug().
Referenced by doImport(), handleLogItem(), handlePage(), handleRevision(), and handleUpload().
|
private |
Definition at line 45 of file WikiImporter.php.
Referenced by __construct().
|
private |
Definition at line 49 of file WikiImporter.php.
|
private |
Definition at line 51 of file WikiImporter.php.
|
private |
Definition at line 53 of file WikiImporter.php.
|
private |
Definition at line 37 of file WikiImporter.php.
Referenced by handleSiteInfo().
|
private |
Definition at line 47 of file WikiImporter.php.
WikiImporter::$mDebug |
Definition at line 40 of file WikiImporter.php.
WikiImporter::$mImageBasePath |
Definition at line 41 of file WikiImporter.php.
|
private |
Definition at line 41 of file WikiImporter.php.
|
private |
Definition at line 38 of file WikiImporter.php.
Referenced by setLogItemCallback().
|
private |
Definition at line 40 of file WikiImporter.php.
|
private |
Definition at line 42 of file WikiImporter.php.
WikiImporter::$mPageCallback |
Definition at line 38 of file WikiImporter.php.
Referenced by setPageCallback().
WikiImporter::$mPageOutCallback |
Definition at line 39 of file WikiImporter.php.
Referenced by setPageOutCallback().
WikiImporter::$mRevisionCallback |
Definition at line 38 of file WikiImporter.php.
Referenced by setRevisionCallback().
|
private |
Definition at line 39 of file WikiImporter.php.
Referenced by setSiteInfoCallback().
WikiImporter::$mUploadCallback |
Definition at line 38 of file WikiImporter.php.
Referenced by setUploadCallback().
|
private |
Definition at line 43 of file WikiImporter.php.
|
private |
Definition at line 36 of file WikiImporter.php.
Referenced by getReader().