$source = ImportStreamSource::newFromUpload( 'xml' );
}
if ( !$source->isOK() ) {
- $this->dieUsageMsg( $source->getErrorsArray() );
+ $this->dieStatus( $source );
}
$importer = new WikiImporter( $source->value );
}
if ( isset( $params['rootpage'] ) ) {
$statusRootPage = $importer->setTargetRootPage( $params['rootpage'] );
- if( !$statusRootPage->isGood() ) {
- $this->dieUsageMsg( $statusRootPage->getErrorsArray() );
+ if ( !$statusRootPage->isGood() ) {
+ $this->dieStatus( $statusRootPage );
}
}
$reporter = new ApiImportReporter(
public function getAllowedParams() {
global $wgImportSources;
+
return array(
'token' => array(
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => true
),
'summary' => null,
- 'xml' => null,
+ 'xml' => array(
+ ApiBase::PARAM_TYPE => 'upload',
+ ),
'interwikisource' => array(
ApiBase::PARAM_TYPE => $wgImportSources
),
public function getExamples() {
return array(
- 'api.php?action=import&interwikisource=meta&interwikipage=Help:ParserFunctions&namespace=100&fullhistory=&token=123ABC'
+ 'api.php?action=import&interwikisource=meta&interwikipage=Help:ParserFunctions&' .
+ 'namespace=100&fullhistory=&token=123ABC'
=> 'Import [[meta:Help:Parserfunctions]] to namespace 100 with full history',
);
}