X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialImport.php;h=839a9bc487f988a3b42ebd221ca5f662c91eadd4;hb=04d1aa3033f40a38d721f7f0e88b5bac440d2869;hp=3ef64f881f3d2bf11d6e2d48eb49b3fd1b5671ec;hpb=4e021bb8d4741d5af0f02942fe3c33a19e7fabca;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialImport.php b/includes/specials/SpecialImport.php index 3ef64f881f..c3aec83c18 100644 --- a/includes/specials/SpecialImport.php +++ b/includes/specials/SpecialImport.php @@ -24,6 +24,8 @@ * @ingroup SpecialPage */ +use MediaWiki\Permissions\PermissionManager; + /** * MediaWiki page data importer * @@ -83,11 +85,11 @@ class SpecialImport extends SpecialPage { # getUserPermissionsErrors() might actually be used for, hence the 'ns-specialprotected' $errors = wfMergeErrorArrays( $this->getPageTitle()->getUserPermissionsErrors( - 'import', $user, true, + 'import', $user, PermissionManager::RIGOR_FULL, [ 'ns-specialprotected', 'badaccess-group0', 'badaccess-groups' ] ), $this->getPageTitle()->getUserPermissionsErrors( - 'importupload', $user, true, + 'importupload', $user, PermissionManager::RIGOR_FULL, [ 'ns-specialprotected', 'badaccess-group0', 'badaccess-groups' ] ) ); @@ -179,8 +181,9 @@ class SpecialImport extends SpecialPage { $out = $this->getOutput(); if ( !$source->isGood() ) { - $out->addWikiText( "

\n" . - $this->msg( 'importfailed', $source->getWikiText() )->parse() . "\n

" ); + $out->wrapWikiTextAsInterface( 'error', + $this->msg( 'importfailed', $source->getWikiText() )->plain() + ); } else { $importer = new WikiImporter( $source->value, $this->getConfig() ); if ( !is_null( $this->namespace ) ) { @@ -189,7 +192,7 @@ class SpecialImport extends SpecialPage { $statusRootPage = $importer->setTargetRootPage( $this->rootpage ); if ( !$statusRootPage->isGood() ) { $out->wrapWikiMsg( - "

\n$1\n

", + "
\n$1\n
", [ 'import-options-wrong', $statusRootPage->getWikiText(), @@ -224,13 +227,13 @@ class SpecialImport extends SpecialPage { if ( $exception ) { # No source or XML parse error $out->wrapWikiMsg( - "

\n$1\n

", + "
\n$1\n
", [ 'importfailed', $exception->getMessage() ] ); } elseif ( !$result->isGood() ) { # Zero revisions $out->wrapWikiMsg( - "

\n$1\n

", + "
\n$1\n
", [ 'importfailed', $result->getWikiText() ] ); } else { @@ -279,6 +282,7 @@ class SpecialImport extends SpecialPage { 'selected' => ( $isSameSourceAsBefore ? $this->namespace : ( $defaultNamespace || '' ) ), + 'in-user-lang' => true, ], [ 'name' => "namespace", // mw-import-namespace-interwiki, mw-import-namespace-upload @@ -318,7 +322,7 @@ class SpecialImport extends SpecialPage { $action = $this->getPageTitle()->getLocalURL( [ 'action' => 'submit' ] ); $user = $this->getUser(); $out = $this->getOutput(); - $this->addHelpLink( '//meta.wikimedia.org/wiki/Special:MyLanguage/Help:Import', true ); + $this->addHelpLink( 'https://meta.wikimedia.org/wiki/Special:MyLanguage/Help:Import', true ); if ( $user->isAllowed( 'importupload' ) ) { $mappingSelection = $this->getMappingFormPart( 'upload' ); @@ -389,10 +393,8 @@ class SpecialImport extends SpecialPage { Xml::closeElement( 'form' ) . Xml::closeElement( 'fieldset' ) ); - } else { - if ( empty( $this->importSources ) ) { - $out->addWikiMsg( 'importnosources' ); - } + } elseif ( empty( $this->importSources ) ) { + $out->addWikiMsg( 'importnosources' ); } if ( $user->isAllowed( 'import' ) && !empty( $this->importSources ) ) {