$isUpload = false;
if ( isset( $params['interwikisource'] ) ) {
if ( !$user->isAllowed( 'import' ) ) {
- $this->dieUsageMsg( 'cantimport' );
+ $this->dieWithError( 'apierror-cantimport' );
}
if ( !isset( $params['interwikipage'] ) ) {
- $this->dieUsageMsg( [ 'missingparam', 'interwikipage' ] );
+ $this->dieWithError( [ 'apierror-missingparam', 'interwikipage' ] );
}
$source = ImportStreamSource::newFromInterwiki(
$params['interwikisource'],
} else {
$isUpload = true;
if ( !$user->isAllowed( 'importupload' ) ) {
- $this->dieUsageMsg( 'cantimport-upload' );
+ $this->dieWithError( 'apierror-cantimport-upload' );
}
$source = ImportStreamSource::newFromUpload( 'xml' );
}
try {
$importer->doImport();
} catch ( Exception $e ) {
- $this->dieUsageMsg( [ 'import-unknownerror', $e->getMessage() ] );
+ $this->dieWithError( [ 'apierror-import-unknownerror', wfEscapeWikiText( $e->getMessage() ) ] );
}
$resultData = $reporter->getData();
* @param array $pageInfo
* @return void
*/
- function reportPage( $title, $origTitle, $revisionCount, $successCount, $pageInfo ) {
+ public function reportPage( $title, $origTitle, $revisionCount, $successCount, $pageInfo ) {
// Add a result entry
$r = [];
parent::reportPage( $title, $origTitle, $revisionCount, $successCount, $pageInfo );
}
- function getData() {
+ public function getData() {
return $this->mResultArr;
}
}