Merge "Proper namespace handling for WikiImporter"
[lhc/web/wiklou.git] / includes / Import.php
index 5922c69..c3caecc 100644 (file)
@@ -350,7 +350,7 @@ class WikiImporter {
        public function finishImportPage( $title, $foreignTitle, $revCount,
                        $sRevCount, $pageInfo ) {
                $args = func_get_args();
-               return wfRunHooks( 'AfterImportPage', $args );
+               return Hooks::run( 'AfterImportPage', $args );
        }
 
        /**
@@ -461,11 +461,11 @@ class WikiImporter {
                $buffer = "";
                while ( $this->reader->read() ) {
                        switch ( $this->reader->nodeType ) {
-                       case XmlReader::TEXT:
-                       case XmlReader::SIGNIFICANT_WHITESPACE:
+                       case XMLReader::TEXT:
+                       case XMLReader::SIGNIFICANT_WHITESPACE:
                                $buffer .= $this->reader->value;
                                break;
-                       case XmlReader::END_ELEMENT:
+                       case XMLReader::END_ELEMENT:
                                return $buffer;
                        }
                }
@@ -501,9 +501,9 @@ class WikiImporter {
                        $tag = $this->reader->name;
                        $type = $this->reader->nodeType;
 
-                       if ( !wfRunHooks( 'ImportHandleToplevelXMLTag', array( $this ) ) ) {
+                       if ( !Hooks::run( 'ImportHandleToplevelXMLTag', array( $this ) ) ) {
                                // Do nothing
-                       } elseif ( $tag == 'mediawiki' && $type == XmlReader::END_ELEMENT ) {
+                       } elseif ( $tag == 'mediawiki' && $type == XMLReader::END_ELEMENT ) {
                                break;
                        } elseif ( $tag == 'siteinfo' ) {
                                $this->handleSiteInfo();
@@ -566,14 +566,14 @@ class WikiImporter {
                                        'logtitle', 'params' );
 
                while ( $this->reader->read() ) {
-                       if ( $this->reader->nodeType == XmlReader::END_ELEMENT &&
+                       if ( $this->reader->nodeType == XMLReader::END_ELEMENT &&
                                        $this->reader->name == 'logitem' ) {
                                break;
                        }
 
                        $tag = $this->reader->name;
 
-                       if ( !wfRunHooks( 'ImportHandleLogItemXMLTag', array(
+                       if ( !Hooks::run( 'ImportHandleLogItemXMLTag', array(
                                $this, $logInfo
                        ) ) ) {
                                // Do nothing
@@ -630,7 +630,7 @@ class WikiImporter {
                $badTitle = false;
 
                while ( $skip ? $this->reader->next() : $this->reader->read() ) {
-                       if ( $this->reader->nodeType == XmlReader::END_ELEMENT &&
+                       if ( $this->reader->nodeType == XMLReader::END_ELEMENT &&
                                        $this->reader->name == 'page' ) {
                                break;
                        }
@@ -642,7 +642,7 @@ class WikiImporter {
                        if ( $badTitle ) {
                                // The title is invalid, bail out of this page
                                $skip = true;
-                       } elseif ( !wfRunHooks( 'ImportHandlePageXMLTag', array( $this,
+                       } elseif ( !Hooks::run( 'ImportHandlePageXMLTag', array( $this,
                                                &$pageInfo ) ) ) {
                                // Do nothing
                        } elseif ( in_array( $tag, $normalFields ) ) {
@@ -703,14 +703,14 @@ class WikiImporter {
                $skip = false;
 
                while ( $skip ? $this->reader->next() : $this->reader->read() ) {
-                       if ( $this->reader->nodeType == XmlReader::END_ELEMENT &&
+                       if ( $this->reader->nodeType == XMLReader::END_ELEMENT &&
                                        $this->reader->name == 'revision' ) {
                                break;
                        }
 
                        $tag = $this->reader->name;
 
-                       if ( !wfRunHooks( 'ImportHandleRevisionXMLTag', array(
+                       if ( !Hooks::run( 'ImportHandleRevisionXMLTag', array(
                                $this, $pageInfo, $revisionInfo
                        ) ) ) {
                                // Do nothing
@@ -795,14 +795,14 @@ class WikiImporter {
                $skip = false;
 
                while ( $skip ? $this->reader->next() : $this->reader->read() ) {
-                       if ( $this->reader->nodeType == XmlReader::END_ELEMENT &&
+                       if ( $this->reader->nodeType == XMLReader::END_ELEMENT &&
                                        $this->reader->name == 'upload' ) {
                                break;
                        }
 
                        $tag = $this->reader->name;
 
-                       if ( !wfRunHooks( 'ImportHandleUploadXMLTag', array(
+                       if ( !Hooks::run( 'ImportHandleUploadXMLTag', array(
                                $this, $pageInfo
                        ) ) ) {
                                // Do nothing
@@ -893,7 +893,7 @@ class WikiImporter {
                $info = array();
 
                while ( $this->reader->read() ) {
-                       if ( $this->reader->nodeType == XmlReader::END_ELEMENT &&
+                       if ( $this->reader->nodeType == XMLReader::END_ELEMENT &&
                                        $this->reader->name == 'contributor' ) {
                                break;
                        }
@@ -1709,7 +1709,10 @@ class WikiRevision {
 }
 
 /**
- * @todo document (e.g. one-sentence class description).
+ * Used for importing XML dumps where the content of the dump is in a string.
+ * This class is ineffecient, and should only be used for small dumps.
+ * For larger dumps, ImportStreamSource should be used instead.
+ *
  * @ingroup SpecialPage
  */
 class ImportStringSource {
@@ -1738,7 +1741,7 @@ class ImportStringSource {
 }
 
 /**
- * @todo document (e.g. one-sentence class description).
+ * Imports a XML dump from a file (either from file upload, files on disk, or HTTP)
  * @ingroup SpecialPage
  */
 class ImportStreamSource {