X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialImport.php;h=ab5d4d7238524754fa0e1cd87bbb8d611beb22b7;hb=6f7e982df6479e27c3b17f2deda8404ef55f50e6;hp=9ce52ef0130d5a4eb566135726c08cb26b93eedf;hpb=3090dea5b555983d770dc252b02528752d6cfc7b;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialImport.php b/includes/specials/SpecialImport.php index 9ce52ef013..ab5d4d7238 100644 --- a/includes/specials/SpecialImport.php +++ b/includes/specials/SpecialImport.php @@ -43,6 +43,8 @@ class SpecialImport extends SpecialPage { private $includeTemplates = false; private $pageLinkDepth; private $importSources; + private $assignKnownUsers; + private $usernamePrefix; public function __construct() { parent::__construct( 'Import', 'import' ); @@ -110,6 +112,7 @@ class SpecialImport extends SpecialPage { $isUpload = false; $request = $this->getRequest(); $this->sourceName = $request->getVal( "source" ); + $this->assignKnownUsers = $request->getCheck( 'assignKnownUsers' ); $this->logcomment = $request->getText( 'log-comment' ); $this->pageLinkDepth = $this->getConfig()->get( 'ExportMaxLinkDepth' ) == 0 @@ -130,6 +133,7 @@ class SpecialImport extends SpecialPage { $source = Status::newFatal( 'import-token-mismatch' ); } elseif ( $this->sourceName === 'upload' ) { $isUpload = true; + $this->usernamePrefix = $this->fullInterwikiPrefix = $request->getVal( 'usernamePrefix' ); if ( $user->isAllowed( 'importupload' ) ) { $source = ImportStreamSource::newFromUpload( "xmlimport" ); } else { @@ -169,6 +173,10 @@ class SpecialImport extends SpecialPage { $source = Status::newFatal( "importunknownsource" ); } + if ( (string)$this->fullInterwikiPrefix === '' ) { + $source->fatal( 'importnoprefix' ); + } + $out = $this->getOutput(); if ( !$source->isGood() ) { $out->addWikiText( "

\n" . @@ -192,6 +200,7 @@ class SpecialImport extends SpecialPage { return; } } + $importer->setUsernamePrefix( $this->fullInterwikiPrefix, $this->assignKnownUsers ); $out->addWikiMsg( "importstart" ); @@ -336,6 +345,28 @@ class SpecialImport extends SpecialPage { Html::input( 'xmlimport', '', 'file', [ 'id' => 'xmlimport' ] ) . ' ' . " + + " . + Xml::label( $this->msg( 'import-upload-username-prefix' )->text(), + 'mw-import-usernamePrefix' ) . + " + " . + Xml::input( 'usernamePrefix', 50, + $this->usernamePrefix, + [ 'id' => 'usernamePrefix', 'type' => 'text' ] ) . ' ' . + " + + + + " . + Xml::checkLabel( + $this->msg( 'import-assign-known-users' )->text(), + 'assignKnownUsers', + 'assignKnownUsers', + $this->assignKnownUsers + ) . + " + " . Xml::label( $this->msg( 'import-comment' )->text(), 'mw-import-comment' ) . @@ -489,6 +520,17 @@ class SpecialImport extends SpecialPage { ) . " + + + " . + Xml::checkLabel( + $this->msg( 'import-assign-known-users' )->text(), + 'assignKnownUsers', + 'assignKnownUsers', + $this->assignKnownUsers + ) . + " + $importDepth " .