Merge "Import.php: Use Config instead of globals"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 30 Oct 2014 22:42:00 +0000 (22:42 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 30 Oct 2014 22:42:00 +0000 (22:42 +0000)
1  2 
includes/api/ApiImport.php
includes/specials/SpecialImport.php

@@@ -60,7 -60,7 +60,7 @@@ class ApiImport extends ApiBase 
                        $this->dieStatus( $source );
                }
  
-               $importer = new WikiImporter( $source->value );
+               $importer = new WikiImporter( $source->value, $this->getConfig() );
                if ( isset( $params['namespace'] ) ) {
                        $importer->setTargetNamespace( $params['namespace'] );
                }
                );
        }
  
 -      public function getParamDescription() {
 -              return array(
 -                      'summary' => 'Import summary',
 -                      'xml' => 'Uploaded XML file',
 -                      'interwikisource' => 'For interwiki imports: wiki to import from',
 -                      'interwikipage' => 'For interwiki imports: page to import',
 -                      'fullhistory' => 'For interwiki imports: import the full history, not just the current version',
 -                      'templates' => 'For interwiki imports: import all included templates as well',
 -                      'namespace' => 'For interwiki imports: import to this namespace',
 -                      'rootpage' => 'Import as subpage of this page',
 -              );
 -      }
 -
 -      public function getDescription() {
 -              return array(
 -                      'Import a page from another wiki, or an XML file.',
 -                      'Note that the HTTP POST must be done as a file upload (i.e. using multipart/form-data) when',
 -                      'sending a file for the "xml" parameter.'
 -              );
 -      }
 -
        public function needsToken() {
                return 'csrf';
        }
  
 -      public function getExamples() {
 +      protected function getExamplesMessages() {
                return array(
 -                      'api.php?action=import&interwikisource=meta&interwikipage=Help:ParserFunctions&' .
 +                      'action=import&interwikisource=meta&interwikipage=Help:ParserFunctions&' .
                                'namespace=100&fullhistory=&token=123ABC'
 -                              => 'Import [[meta:Help:Parserfunctions]] to namespace 100 with full history',
 +                              => 'apihelp-import-example-import',
                );
        }
  
@@@ -157,7 -157,7 +157,7 @@@ class SpecialImport extends SpecialPag
                                array( 'importfailed', $source->getWikiText() )
                        );
                } else {
-                       $importer = new WikiImporter( $source->value );
+                       $importer = new WikiImporter( $source->value, $this->getConfig() );
                        if ( !is_null( $this->namespace ) ) {
                                $importer->setTargetNamespace( $this->namespace );
                        }
                                        Xml::label( $this->msg( 'import-comment' )->text(), 'mw-import-comment' ) .
                                        "</td>
                                        <td class='mw-input'>" .
 -                                      Xml::input( 'log-comment', 50, 
 +                                      Xml::input( 'log-comment', 50,
                                                ( $this->sourceName == 'upload' ? $this->logcomment : '' ),
                                                array( 'id' => 'mw-import-comment', 'type' => 'text' ) ) . ' ' .
                                        "</td>