(bug 15283) Interwiki imports should fetch included templates
authorChad Horohoe <demon@users.mediawiki.org>
Fri, 6 Feb 2009 00:02:44 +0000 (00:02 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Fri, 6 Feb 2009 00:02:44 +0000 (00:02 +0000)
RELEASE-NOTES
includes/Import.php
includes/specials/SpecialImport.php
languages/messages/MessagesEn.php
maintenance/language/messages.inc

index 7574a82..bbea054 100644 (file)
@@ -82,6 +82,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 17236) Suppress 'watch user page link' for IP range blocks
 * Wrap message 'searchresulttext' (Special:Search) into a div with
   class "mw-searchresult"
+* (bug 15283) Interwiki imports can now fetch included templates
 
 === Bug fixes in 1.15 ===
 * (bug 16968) Special:Upload no longer throws useless warnings.
index 56e7a7f..17560a7 100644 (file)
@@ -1116,7 +1116,7 @@ class ImportStreamSource {
                }
        }
 
-       public static function newFromInterwiki( $interwiki, $page, $history=false ) {
+       public static function newFromInterwiki( $interwiki, $page, $history = false, $templates = false ) {
                if( $page == '' ) {
                        return new WikiErrorMsg( 'import-noarticle' );
                }
@@ -1124,7 +1124,9 @@ class ImportStreamSource {
                if( is_null( $link ) || $link->getInterwiki() == '' ) {
                        return new WikiErrorMsg( 'importbadinterwiki' );
                } else {
-                       $params = $history ? 'history=1' : '';
+                       $params = array();
+                       if ( $history ) $params['history'] = 1;
+                       if ( $templates ) $params['templates'] = 1;
                        $url = $link->getFullUrl( $params );
                        # For interwikis, use POST to avoid redirects.
                        return ImportStreamSource::newFromURL( $url, "POST" );
index 5e1a653..b6318c6 100644 (file)
@@ -30,6 +30,7 @@ class SpecialImport extends SpecialPage {
        private $frompage = '';
        private $logcomment= false;
        private $history = true;
+       private $includeTemplates = false;
        
        /**
         * Constructor
@@ -88,10 +89,12 @@ class SpecialImport extends SpecialPage {
                        } else {
                                $this->history = $wgRequest->getCheck( 'interwikiHistory' );
                                $this->frompage = $wgRequest->getText( "frompage" );
+                               $this->includeTemplates = $wgRequest->getCheck( 'interwikiTemplates' );
                                $source = ImportStreamSource::newFromInterwiki(
                                        $this->interwiki,
                                        $this->frompage,
-                                       $this->history );
+                                       $this->history,
+                                       $this->includeTemplates );
                        }
                } else {
                        $source = new WikiErrorMsg( "importunknownsource" );
@@ -212,6 +215,12 @@ class SpecialImport extends SpecialPage {
                                                Xml::checkLabel( wfMsg( 'import-interwiki-history' ), 'interwikiHistory', 'interwikiHistory', $this->history ) .
                                        "</td>
                                </tr>
+                               <tr>
+                                       <td>
+                                       </td>
+                                       <td class='mw-input'>" .
+                                               Xml::checkLabel( wfMsg( 'import-interwiki-templates' ), 'interwikiTemplates', 'interwikiTemplates', $this->includeTemplates ) .
+                                       "</td>
                                <tr>
                                        <td>" .
                                                Xml::label( wfMsg( 'import-interwiki-namespace' ), 'namespace' ) .
index 5e09fdd..7df8980 100644 (file)
@@ -2820,6 +2820,7 @@ Revision dates and editors' names will be preserved.
 All transwiki import actions are logged at the [[Special:Log/import|import log]].",
 'import-interwiki-source'    => 'Source wiki/page:',
 'import-interwiki-history'   => 'Copy all history versions for this page',
+'import-interwiki-templates' => 'Include all templates',
 'import-interwiki-submit'    => 'Import',
 'import-interwiki-namespace' => 'Destination namespace:',
 'import-upload-filename'     => 'Filename:',
index 31b4684..a3a41eb 100644 (file)
@@ -1975,6 +1975,7 @@ $wgMessageStructure = array(
                'import-interwiki-text',
                'import-interwiki-source',
                'import-interwiki-history',
+               'import-interwiki-templates',
                'import-interwiki-submit',
                'import-interwiki-namespace',
                'import-upload-filename',