Merge "Import.php: Use Config instead of globals"
[lhc/web/wiklou.git] / includes / api / ApiImport.php
index 25ce89b..a134074 100644 (file)
@@ -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'] );
                }
@@ -99,10 +99,6 @@ class ApiImport extends ApiBase {
 
        public function getAllowedParams() {
                return array(
-                       'token' => array(
-                               ApiBase::PARAM_TYPE => 'string',
-                               ApiBase::PARAM_REQUIRED => true
-                       ),
                        'summary' => null,
                        'xml' => array(
                                ApiBase::PARAM_TYPE => 'upload',
@@ -120,41 +116,15 @@ class ApiImport extends ApiBase {
                );
        }
 
-       public function getParamDescription() {
-               return array(
-                       'token' => 'Import token obtained through prop=info',
-                       '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 true;
-       }
-
-       public function getTokenSalt() {
-               return '';
+               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',
                );
        }