);
$this->addOption( 'image-base-path', 'Import files from a specified path', false, true );
$this->addOption( 'skip-to', 'Start from nth page by skipping first n-1 pages', false, true );
+ $this->addOption( 'username-interwiki', 'Use interwiki usernames with this prefix', false, true );
+ $this->addOption( 'no-local-users',
+ 'Treat all usernames as interwiki. ' .
+ 'The default is to assign edits to local users where they exist.',
+ false, false
+ );
$this->addArg( 'file', 'Dump file to import [else use stdin]', false );
}
/**
* @param Title|Revision $obj
+ * @throws MWException
* @return bool
*/
private function skippedNamespace( $obj ) {
if ( $this->hasOption( 'no-updates' ) ) {
$importer->setNoUpdates( true );
}
+ if ( $this->hasOption( 'username-prefix' ) ) {
+ $importer->setUsernamePrefix(
+ $this->getOption( 'username-prefix' ),
+ !$this->hasOption( 'no-local-users' )
+ );
+ }
if ( $this->hasOption( 'rootpage' ) ) {
$statusRootPage = $importer->setTargetRootPage( $this->getOption( 'rootpage' ) );
if ( !$statusRootPage->isGood() ) {
$this->pageCount = $nthPage - 1;
}
$importer->setPageCallback( [ $this, 'reportPage' ] );
+ $importer->setNoticeCallback( function ( $msg, $params ) {
+ echo wfMessage( $msg, $params )->text() . "\n";
+ } );
$this->importCallback = $importer->setRevisionCallback(
[ $this, 'handleRevision' ] );
$this->uploadCallback = $importer->setUploadCallback(