summaryrefslogtreecommitdiff
path: root/includes/api/ApiImport.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/api/ApiImport.php')
-rw-r--r--includes/api/ApiImport.php35
1 files changed, 7 insertions, 28 deletions
diff --git a/includes/api/ApiImport.php b/includes/api/ApiImport.php
index b11348e5..2e87d22d 100644
--- a/includes/api/ApiImport.php
+++ b/includes/api/ApiImport.php
@@ -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'] );
}
@@ -79,13 +79,13 @@ class ApiImport extends ApiBase {
try {
$importer->doImport();
- } catch ( MWException $e ) {
+ } catch ( Exception $e ) {
$this->dieUsageMsg( array( 'import-unknownerror', $e->getMessage() ) );
}
$resultData = $reporter->getData();
$result = $this->getResult();
- $result->setIndexedTagName( $resultData, 'page' );
+ ApiResult::setIndexedTagName( $resultData, 'page' );
$result->addValue( null, $this->getModuleName(), $resultData );
}
@@ -116,36 +116,15 @@ class ApiImport extends ApiBase {
);
}
- 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',
);
}
@@ -176,7 +155,7 @@ class ApiImportReporter extends ImportReporter {
if ( $title === null ) {
# Invalid or non-importable title
$r['title'] = $pageInfo['title'];
- $r['invalid'] = '';
+ $r['invalid'] = true;
} else {
ApiQueryBase::addTitleInfo( $r, $title );
$r['revisions'] = intval( $successCount );