MediaWiki  REL1_19
WikiImporter Class Reference

XML file reader for the page data importer. More...

List of all members.

Public Member Functions

 __construct ($source)
 Creates an ImportXMLReader drawing from the source provided.
 debugRevisionHandler (&$revision)
 Alternate per-revision callback, for debugging.
 doImport ()
 Primary entry point.
 finishImportPage ($title, $origTitle, $revCount, $sRevCount, $pageInfo)
 Mostly for hook use.
 importLogItem ($rev)
 Default per-revision callback, performs the import.
 importRevision ($revision)
 Default per-revision callback, performs the import.
 importUpload ($revision)
 Dummy for now...
 pageCallback ($title)
 Notify the callback function when a new <page> is reached.
 setDebug ($debug)
 Set debug mode...
 setImageBasePath ($dir)
 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.
 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.
 setUploadCallback ($callback)
 Sets the action to perform as each file upload version is reached.

Public Attributes

 $mDebug
 $mImageBasePath
 $mPageCallback
 $mPageOutCallback
 $mRevisionCallback
 $mTargetNamespace
 $mUploadCallback

Private Member Functions

 debug ($data)
 dumpElement ()
 Left in for debugging.
 dumpTemp ($contents)
 handleContributor ()
 handleLogItem ()
 handlePage ()
 handleRevision (&$pageInfo)
 handleSiteInfo ()
 handleUpload (&$pageInfo)
 logItemCallback ($revision)
 Notify the callback function of a new log item.
 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)
 pageOutCallback ($title, $origTitle, $revCount, $sucCount, $pageInfo)
 Notify the callback function when a </page> is closed.
 processLogItem ($logInfo)
 processRevision ($pageInfo, $revisionInfo)
 processTitle ($text)
 processUpload ($pageInfo, $uploadInfo)
 revisionCallback ($revision)
 Notify the callback function of a revision.
 throwXmlError ($err)
 warn ($data)

Private Attributes

 $mImportUploads
 $mLogItemCallback
 $mNoticeCallback
 $mNoUpdates = false
 $mSiteInfoCallback
 $reader = null

Detailed Description

XML file reader for the page data importer.

implements Special:Import

Definition at line 33 of file Import.php.


Constructor & Destructor Documentation

Creates an ImportXMLReader drawing from the source provided.

Parameters:
$source

Definition at line 45 of file Import.php.

References UploadSourceAdapter\registerSource(), setLogItemCallback(), setPageOutCallback(), setRevisionCallback(), and setUploadCallback().

Here is the call graph for this function:


Member Function Documentation

WikiImporter::debug ( data) [private]

Definition at line 68 of file Import.php.

References wfDebug().

Referenced by debugRevisionHandler(), doImport(), handleLogItem(), handlePage(), handleRevision(), handleUpload(), and throwXmlError().

Here is the call graph for this function:

Here is the caller graph for this function:

Alternate per-revision callback, for debugging.

Parameters:
$revisionWikiRevision

Definition at line 264 of file Import.php.

References debug().

Here is the call graph for this function:

Primary entry point.

Definition at line 398 of file Import.php.

References debug(), handleLogItem(), handlePage(), handleSiteInfo(), warn(), and wfRunHooks().

Here is the call graph for this function:

Left in for debugging.

Definition at line 358 of file Import.php.

References print.

WikiImporter::dumpTemp ( contents) [private]
Parameters:
$contents
Returns:
string

Definition at line 714 of file Import.php.

References wfTempDir().

Referenced by handleUpload().

Here is the call graph for this function:

Here is the caller graph for this function:

WikiImporter::finishImportPage ( title,
origTitle,
revCount,
sRevCount,
pageInfo 
)

Mostly for hook use.

Parameters:
$title
$origTitle
$revCount
$sRevCount
$pageInfo
Returns:

Definition at line 255 of file Import.php.

References wfRunHooks().

Here is the call graph for this function:

Returns:
array

Definition at line 762 of file Import.php.

References nodeContents().

Referenced by handleLogItem(), handleRevision(), and handleUpload().

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 464 of file Import.php.

References debug(), handleContributor(), nodeContents(), processLogItem(), warn(), and wfRunHooks().

Referenced by doImport().

Here is the call graph for this function:

Here is the caller graph for this function:

WikiImporter::handlePage ( ) [private]

Definition at line 524 of file Import.php.

References $title, debug(), handleRevision(), handleUpload(), nodeContents(), pageCallback(), pageOutCallback(), processTitle(), warn(), and wfRunHooks().

Referenced by doImport().

Here is the call graph for this function:

Here is the caller graph for this function:

WikiImporter::handleRevision ( &$  pageInfo) [private]
Parameters:
$pageInfoarray

Definition at line 581 of file Import.php.

References debug(), handleContributor(), nodeContents(), processRevision(), warn(), and wfRunHooks().

Referenced by handlePage().

Here is the call graph for this function:

Here is the caller graph for this function:

Returns:
bool
Exceptions:
MWException

Definition at line 454 of file Import.php.

Referenced by doImport().

Here is the caller graph for this function:

WikiImporter::handleUpload ( &$  pageInfo) [private]
Parameters:
$pageInfo
Returns:
mixed

Definition at line 660 of file Import.php.

References $path, debug(), dumpTemp(), handleContributor(), nodeContents(), processUpload(), warn(), and wfRunHooks().

Referenced by handlePage().

Here is the call graph for this function:

Here is the caller graph for this function:

Default per-revision callback, performs the import.

Parameters:
$revWikiRevision
Returns:
bool

Definition at line 231 of file Import.php.

References wfGetDB().

Here is the call graph for this function:

Default per-revision callback, performs the import.

Parameters:
$revisionWikiRevision
Returns:
bool

Definition at line 221 of file Import.php.

References wfGetDB().

Here is the call graph for this function:

WikiImporter::importUpload ( revision)

Dummy for now...

Parameters:
$revision
Returns:
bool

Definition at line 241 of file Import.php.

References wfGetDB().

Here is the call graph for this function:

WikiImporter::logItemCallback ( revision) [private]

Notify the callback function of a new log item.

Parameters:
$revisionA WikiRevision object

Definition at line 319 of file Import.php.

Referenced by processLogItem().

Here is the caller graph for this function:

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.

Returns:
string
Access:
private

Definition at line 335 of file Import.php.

Referenced by handleContributor(), handleLogItem(), handlePage(), handleRevision(), and handleUpload().

Here is the caller graph for this function:

WikiImporter::notice ( msg) [private]

Definition at line 78 of file Import.php.

References echo, and wfMessage().

Referenced by processTitle().

Here is the call graph for this function:

Here is the caller graph for this function:

Notify the callback function when a new <page> is reached.

Parameters:
$titleTitle

Definition at line 281 of file Import.php.

References $title.

Referenced by handlePage().

Here is the caller graph for this function:

WikiImporter::pageOutCallback ( title,
origTitle,
revCount,
sucCount,
pageInfo 
) [private]

Notify the callback function when a </page> is closed.

Parameters:
$titleTitle
$origTitleTitle
$revCountInteger
$sucCountInt: number of revisions for which callback returned true
$pageInfoArray: associative array of page information

Definition at line 295 of file Import.php.

Referenced by handlePage().

Here is the caller graph for this function:

WikiImporter::processLogItem ( logInfo) [private]
Parameters:
$logInfo
Returns:
bool|mixed

Definition at line 499 of file Import.php.

References logItemCallback(), Title\newFromText(), and WikiRevision\setID().

Referenced by handleLogItem().

Here is the call graph for this function:

Here is the caller graph for this function:

WikiImporter::processRevision ( pageInfo,
revisionInfo 
) [private]
Parameters:
$pageInfo
$revisionInfo
Returns:
bool|mixed

Definition at line 621 of file Import.php.

References revisionCallback(), WikiRevision\setID(), and wfTimestampNow().

Referenced by handleRevision().

Here is the call graph for this function:

Here is the caller graph for this function:

WikiImporter::processTitle ( text) [private]
Parameters:
$textstring
Returns:
Array or false

Definition at line 786 of file Import.php.

References $title, $wgCommandLineMode, Title\makeTitle(), Title\newFromText(), and notice().

Referenced by handlePage().

Here is the call graph for this function:

Here is the caller graph for this function:

WikiImporter::processUpload ( pageInfo,
uploadInfo 
) [private]
Parameters:
$pageInfo
$uploadInfo
Returns:
mixed

Definition at line 725 of file Import.php.

References WikiRevision\setTitle().

Referenced by handleUpload().

Here is the call graph for this function:

Here is the caller graph for this function:

WikiImporter::revisionCallback ( revision) [private]

Notify the callback function of a revision.

Parameters:
$revisionA WikiRevision object

Definition at line 306 of file Import.php.

Referenced by processRevision().

Here is the caller graph for this function:

WikiImporter::setDebug ( debug)

Set debug mode...

Parameters:
$debugbool

Definition at line 93 of file Import.php.

Parameters:
$dir

Definition at line 205 of file Import.php.

References $dir.

Parameters:
$import

Definition at line 212 of file Import.php.

Sets the action to perform as each log item reached.

Parameters:
$callbackcallback
Returns:
callback

Definition at line 168 of file Import.php.

Referenced by __construct().

Here is the caller graph for this function:

Set a callback that displays notice messages.

Parameters:
$callbackcallback
Returns:
callback

Definition at line 111 of file Import.php.

References wfSetVar().

Here is the call graph for this function:

WikiImporter::setNoUpdates ( noupdates)

Set 'no updates' mode.

In this mode, the link tables will not be updated by the importer

Parameters:
$noupdatesbool

Definition at line 101 of file Import.php.

Sets the action to perform as each new page in the stream is reached.

Parameters:
$callbackcallback
Returns:
callback

Definition at line 120 of file Import.php.

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.

Parameters:
$callbackcallback
Returns:
callback

Definition at line 135 of file Import.php.

Referenced by __construct().

Here is the caller graph for this function:

Sets the action to perform as each page revision is reached.

Parameters:
$callbackcallback
Returns:
callback

Definition at line 146 of file Import.php.

Referenced by __construct().

Here is the caller graph for this function:

Sets the action to perform when site info is encountered.

Parameters:
$callbackcallback
Returns:
callback

Definition at line 179 of file Import.php.

Set a target namespace to override the defaults.

Parameters:
$namespace
Returns:
bool

Definition at line 190 of file Import.php.

Sets the action to perform as each file upload version is reached.

Parameters:
$callbackcallback
Returns:
callback

Definition at line 157 of file Import.php.

Referenced by __construct().

Here is the caller graph for this function:

WikiImporter::throwXmlError ( err) [private]

Definition at line 63 of file Import.php.

References debug(), and wfDebug().

Here is the call graph for this function:

WikiImporter::warn ( data) [private]

Definition at line 74 of file Import.php.

References wfDebug().

Referenced by doImport(), handleLogItem(), handlePage(), handleRevision(), and handleUpload().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

WikiImporter::$mDebug

Definition at line 37 of file Import.php.

WikiImporter::$mImageBasePath

Definition at line 38 of file Import.php.

WikiImporter::$mImportUploads [private]

Definition at line 38 of file Import.php.

WikiImporter::$mLogItemCallback [private]

Definition at line 35 of file Import.php.

WikiImporter::$mNoticeCallback [private]

Definition at line 37 of file Import.php.

WikiImporter::$mNoUpdates = false [private]

Definition at line 39 of file Import.php.

WikiImporter::$mPageCallback

Definition at line 35 of file Import.php.

WikiImporter::$mPageOutCallback

Definition at line 36 of file Import.php.

WikiImporter::$mRevisionCallback

Definition at line 35 of file Import.php.

WikiImporter::$mSiteInfoCallback [private]

Definition at line 36 of file Import.php.

WikiImporter::$mTargetNamespace

Definition at line 36 of file Import.php.

WikiImporter::$mUploadCallback

Definition at line 35 of file Import.php.

WikiImporter::$reader = null [private]

Definition at line 34 of file Import.php.


The documentation for this class was generated from the following file: