Merge "Remove parameter 'options' from hook 'SkinEditSectionLinks'"
[lhc/web/wiklou.git] / includes / import / WikiImporter.php
index 9098981..8f58344 100644 (file)
@@ -120,10 +120,7 @@ class WikiImporter {
                wfDebug( "IMPORT: $data\n" );
        }
 
-       public function notice( $msg /*, $param, ...*/ ) {
-               $params = func_get_args();
-               array_shift( $params );
-
+       public function notice( $msg, ...$params ) {
                if ( is_callable( $this->mNoticeCallback ) ) {
                        call_user_func( $this->mNoticeCallback, $msg, $params );
                } else { # No ImportReporter -> CLI
@@ -260,7 +257,7 @@ class WikiImporter {
                        return true;
                } elseif (
                        $namespace >= 0 &&
-                       MWNamespace::exists( intval( $namespace ) )
+                       MediaWikiServices::getInstance()->getNamespaceInfo()->exists( intval( $namespace ) )
                ) {
                        $namespace = intval( $namespace );
                        $this->setImportTitleFactory( new NamespaceImportTitleFactory( $namespace ) );
@@ -286,18 +283,19 @@ class WikiImporter {
 
                        if ( !$title || $title->isExternal() ) {
                                $status->fatal( 'import-rootpage-invalid' );
+                       } elseif (
+                               !MediaWikiServices::getInstance()->getNamespaceInfo()->
+                               hasSubpages( $title->getNamespace() )
+                       ) {
+                               $displayNSText = $title->getNamespace() == NS_MAIN
+                                       ? wfMessage( 'blanknamespace' )->text()
+                                       : MediaWikiServices::getInstance()->getContentLanguage()->
+                                               getNsText( $title->getNamespace() );
+                               $status->fatal( 'import-rootpage-nosubpage', $displayNSText );
                        } else {
-                               if ( !MWNamespace::hasSubpages( $title->getNamespace() ) ) {
-                                       $displayNSText = $title->getNamespace() == NS_MAIN
-                                               ? wfMessage( 'blanknamespace' )->text()
-                                               : MediaWikiServices::getInstance()->getContentLanguage()->
-                                                       getNsText( $title->getNamespace() );
-                                       $status->fatal( 'import-rootpage-nosubpage', $displayNSText );
-                               } else {
-                                       // set namespace to 'all', so the namespace check in processTitle() can pass
-                                       $this->setTargetNamespace( null );
-                                       $this->setImportTitleFactory( new SubpageImportTitleFactory( $title ) );
-                               }
+                               // set namespace to 'all', so the namespace check in processTitle() can pass
+                               $this->setTargetNamespace( null );
+                               $this->setImportTitleFactory( new SubpageImportTitleFactory( $title ) );
                        }
                }
                return $status;
@@ -432,8 +430,7 @@ class WikiImporter {
                        }
                }
 
-               $args = func_get_args();
-               return Hooks::run( 'AfterImportPage', $args );
+               return Hooks::run( 'AfterImportPage', func_get_args() );
        }
 
        /**
@@ -488,8 +485,7 @@ class WikiImporter {
        private function pageOutCallback( $title, $foreignTitle, $revCount,
                        $sucCount, $pageInfo ) {
                if ( isset( $this->mPageOutCallback ) ) {
-                       $args = func_get_args();
-                       call_user_func_array( $this->mPageOutCallback, $args );
+                       call_user_func_array( $this->mPageOutCallback, func_get_args() );
                }
        }
 
@@ -536,7 +532,7 @@ class WikiImporter {
         * Fetches text contents of the current element, assuming
         * no sub-elements or such scary things.
         * @return string
-        * @access private
+        * @private
         */
        public function nodeContents() {
                if ( $this->reader->isEmptyElement ) {
@@ -893,6 +889,7 @@ class WikiImporter {
                                ) . " exceeds the maximum allowable size ($wgMaxArticleSize KB)" );
                }
 
+               // FIXME: process schema version 11!
                $revision = new WikiRevision( $this->config );
 
                if ( isset( $revisionInfo['id'] ) ) {