Merge "Make autoblocks update with the parent block"
[lhc/web/wiklou.git] / includes / Import.php
index 7b078db..e447e47 100644 (file)
@@ -252,6 +252,16 @@ class WikiImporter {
         * @return bool
         */
        public function importRevision( $revision ) {
+               if ( !$revision->getContent()->getContentHandler()->canBeUsedOn( $revision->getTitle() ) ) {
+                       $this->notice( 'import-error-bad-location',
+                               $revision->getTitle()->getPrefixedText(),
+                               $revision->getID(),
+                               $revision->getModel(),
+                               $revision->getFormat() );
+
+                       return false;
+               }
+
                try {
                        $dbw = wfGetDB( DB_MASTER );
                        return $dbw->deadlockLoop( array( $revision, 'importOldRevision' ) );
@@ -262,6 +272,8 @@ class WikiImporter {
                                $revision->getModel(),
                                $revision->getFormat() );
                }
+
+               return false;
        }
 
        /**
@@ -428,11 +440,11 @@ class WikiImporter {
                        }
                }
 
-               print( var_dump(
+               print var_dump(
                        $lookup[$this->reader->nodeType],
                        $this->reader->name,
                        $this->reader->value
-               ) . "\n\n" );
+               ) . "\n\n";
        }
 
        /**
@@ -1717,7 +1729,7 @@ class ImportStreamSource {
                        return Status::newFatal( 'import-noarticle' );
                }
                $link = Title::newFromText( "$interwiki:Special:Export/$page" );
-               if ( is_null( $link ) || $link->getInterwiki() == '' ) {
+               if ( is_null( $link ) || !$link->isExternal() ) {
                        return Status::newFatal( 'importbadinterwiki' );
                } else {
                        $params = array();