X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialImport.php;h=428556f33d3e3b4fd340bc44e0b44b88fce10e7b;hb=520b167979260edf2cee41842e526ec985c37f92;hp=f21c20651b39bf75d9402e01663279e515b640dc;hpb=3e49b37b689a58d9eb475eb0a4ae2d2aa8f5300a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialImport.php b/includes/specials/SpecialImport.php index f21c20651b..428556f33d 100644 --- a/includes/specials/SpecialImport.php +++ b/includes/specials/SpecialImport.php @@ -135,18 +135,19 @@ class SpecialImport extends SpecialPage { } $user = $this->getUser(); + $permissionManager = MediaWikiServices::getInstance()->getPermissionManager(); if ( !$user->matchEditToken( $request->getVal( 'editToken' ) ) ) { $source = Status::newFatal( 'import-token-mismatch' ); } elseif ( $this->sourceName === 'upload' ) { $isUpload = true; $this->usernamePrefix = $this->fullInterwikiPrefix = $request->getVal( 'usernamePrefix' ); - if ( $user->isAllowed( 'importupload' ) ) { + if ( $permissionManager->userHasRight( $user, 'importupload' ) ) { $source = ImportStreamSource::newFromUpload( "xmlimport" ); } else { throw new PermissionsError( 'importupload' ); } } elseif ( $this->sourceName === 'interwiki' ) { - if ( !$user->isAllowed( 'import' ) ) { + if ( !$permissionManager->userHasRight( $user, 'import' ) ) { throw new PermissionsError( 'import' ); } $this->interwiki = $this->fullInterwikiPrefix = $request->getVal( 'interwiki' ); @@ -186,7 +187,8 @@ class SpecialImport extends SpecialPage { $out = $this->getOutput(); if ( !$source->isGood() ) { $out->wrapWikiTextAsInterface( 'error', - $this->msg( 'importfailed', $source->getWikiText() )->plain() + $this->msg( 'importfailed', $source->getWikiText( false, false, $this->getLanguage() ) ) + ->plain() ); } else { $importer = new WikiImporter( $source->value, $this->getConfig() ); @@ -199,7 +201,7 @@ class SpecialImport extends SpecialPage { "
\n$1\n
", [ 'import-options-wrong', - $statusRootPage->getWikiText(), + $statusRootPage->getWikiText( false, false, $this->getLanguage() ), count( $statusRootPage->getErrorsArray() ) ] ); @@ -238,7 +240,7 @@ class SpecialImport extends SpecialPage { # Zero revisions $out->wrapWikiMsg( "
\n$1\n
", - [ 'importfailed', $result->getWikiText() ] + [ 'importfailed', $result->getWikiText( false, false, $this->getLanguage() ) ] ); } else { # Success! @@ -325,10 +327,11 @@ class SpecialImport extends SpecialPage { private function showForm() { $action = $this->getPageTitle()->getLocalURL( [ 'action' => 'submit' ] ); $user = $this->getUser(); + $permissionManager = MediaWikiServices::getInstance()->getPermissionManager(); $out = $this->getOutput(); $this->addHelpLink( 'https://meta.wikimedia.org/wiki/Special:MyLanguage/Help:Import', true ); - if ( $user->isAllowed( 'importupload' ) ) { + if ( $permissionManager->userHasRight( $user, 'importupload' ) ) { $mappingSelection = $this->getMappingFormPart( 'upload' ); $out->addHTML( Xml::fieldset( $this->msg( 'import-upload' )->text() ) . @@ -401,7 +404,7 @@ class SpecialImport extends SpecialPage { $out->addWikiMsg( 'importnosources' ); } - if ( $user->isAllowed( 'import' ) && !empty( $this->importSources ) ) { + if ( $permissionManager->userHasRight( $user, 'import' ) && !empty( $this->importSources ) ) { # Show input field for import depth only if $wgExportMaxLinkDepth > 0 $importDepth = ''; if ( $this->getConfig()->get( 'ExportMaxLinkDepth' ) > 0 ) {