X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialImport.php;h=fe1dd985d7bc44dbeddd81bfb66635816da9c0d0;hb=771d4b49bc9e99cf7f7b28eced8773a2da5f85cd;hp=0574dbc11588ca2655cd2cf0ca9eb2d707d976fc;hpb=fd8e761b19cb0ff6a01e4e43f00e1f2bb6b28afd;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialImport.php b/includes/specials/SpecialImport.php index 0574dbc115..fe1dd985d7 100644 --- a/includes/specials/SpecialImport.php +++ b/includes/specials/SpecialImport.php @@ -72,7 +72,7 @@ class SpecialImport extends SpecialPage { $this->getOutput()->addModules( 'mediawiki.special.import' ); $this->importSources = $this->getConfig()->get( 'ImportSources' ); - Hooks::run( 'ImportSources', array( &$this->importSources ) ); + Hooks::run( 'ImportSources', [ &$this->importSources ] ); $user = $this->getUser(); if ( !$user->isAllowedAny( 'import', 'importupload' ) ) { @@ -85,11 +85,11 @@ class SpecialImport extends SpecialPage { $errors = wfMergeErrorArrays( $this->getPageTitle()->getUserPermissionsErrors( 'import', $user, true, - array( 'ns-specialprotected', 'badaccess-group0', 'badaccess-groups' ) + [ 'ns-specialprotected', 'badaccess-group0', 'badaccess-groups' ] ), $this->getPageTitle()->getUserPermissionsErrors( 'importupload', $user, true, - array( 'ns-specialprotected', 'badaccess-group0', 'badaccess-groups' ) + [ 'ns-specialprotected', 'badaccess-group0', 'badaccess-groups' ] ) ); @@ -176,7 +176,7 @@ class SpecialImport extends SpecialPage { if ( !$source->isGood() ) { $out->wrapWikiMsg( "

\n$1\n

", - array( 'importfailed', $source->getWikiText() ) + [ 'importfailed', $source->getWikiText() ] ); } else { $importer = new WikiImporter( $source->value, $this->getConfig() ); @@ -187,11 +187,11 @@ class SpecialImport extends SpecialPage { if ( !$statusRootPage->isGood() ) { $out->wrapWikiMsg( "

\n$1\n

", - array( + [ 'import-options-wrong', $statusRootPage->getWikiText(), count( $statusRootPage->getErrorsArray() ) - ) + ] ); return; @@ -221,13 +221,13 @@ class SpecialImport extends SpecialPage { # No source or XML parse error $out->wrapWikiMsg( "

\n$1\n

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

\n$1\n

", - array( 'importfailed', $result->getWikiText() ) + [ 'importfailed', $result->getWikiText() ] ); } else { # Success! @@ -271,16 +271,16 @@ class SpecialImport extends SpecialPage { !is_null( $defaultNamespace ) ) ) . ' ' . Html::namespaceSelector( - array( + [ 'selected' => ( $isSameSourceAsBefore ? $this->namespace : ( $defaultNamespace || '' ) ), - ), array( + ], [ 'name' => "namespace", // mw-import-namespace-interwiki, mw-import-namespace-upload 'id' => "mw-import-namespace-$sourceName", 'class' => 'namespaceselector', - ) + ] ) . " @@ -298,20 +298,20 @@ class SpecialImport extends SpecialPage { ) . ' ' . Xml::input( 'rootpage', 50, ( $isSameSourceAsBefore ? $this->rootpage : '' ), - array( + [ // Should be "mw-import-rootpage-...", but we keep this inaccurate // ID for legacy reasons // mw-interwiki-rootpage-interwiki, mw-interwiki-rootpage-upload 'id' => "mw-interwiki-rootpage-$sourceName", 'type' => 'text' - ) + ] ) . ' ' . " "; } private function showForm() { - $action = $this->getPageTitle()->getLocalURL( array( 'action' => 'submit' ) ); + $action = $this->getPageTitle()->getLocalURL( [ 'action' => 'submit' ] ); $user = $this->getUser(); $out = $this->getOutput(); $this->addHelpLink( '//meta.wikimedia.org/wiki/Special:MyLanguage/Help:Import', true ); @@ -322,23 +322,23 @@ class SpecialImport extends SpecialPage { Xml::fieldset( $this->msg( 'import-upload' )->text() ) . Xml::openElement( 'form', - array( + [ 'enctype' => 'multipart/form-data', 'method' => 'post', 'action' => $action, 'id' => 'mw-import-upload-form' - ) + ] ) . $this->msg( 'importtext' )->parseAsBlock() . Html::hidden( 'action', 'submit' ) . Html::hidden( 'source', 'upload' ) . - Xml::openElement( 'table', array( 'id' => 'mw-import-table-upload' ) ) . + Xml::openElement( 'table', [ 'id' => 'mw-import-table-upload' ] ) . " " . Xml::label( $this->msg( 'import-upload-filename' )->text(), 'xmlimport' ) . " " . - Html::input( 'xmlimport', '', 'file', array( 'id' => 'xmlimport' ) ) . ' ' . + Html::input( 'xmlimport', '', 'file', [ 'id' => 'xmlimport' ] ) . ' ' . " @@ -348,7 +348,7 @@ class SpecialImport extends SpecialPage { " . Xml::input( 'log-comment', 50, ( $this->sourceName === 'upload' ? $this->logcomment : '' ), - array( 'id' => 'mw-import-comment', 'type' => 'text' ) ) . ' ' . + [ 'id' => 'mw-import-comment', 'type' => 'text' ] ) . ' ' . " $mappingSelection @@ -388,17 +388,17 @@ class SpecialImport extends SpecialPage { Xml::fieldset( $this->msg( 'importinterwiki' )->text() ) . Xml::openElement( 'form', - array( + [ 'method' => 'post', 'action' => $action, 'id' => 'mw-import-interwiki-form' - ) + ] ) . $this->msg( 'import-interwiki-text' )->parseAsBlock() . Html::hidden( 'action', 'submit' ) . Html::hidden( 'source', 'interwiki' ) . Html::hidden( 'editToken', $user->getEditToken() ) . - Xml::openElement( 'table', array( 'id' => 'mw-import-table-interwiki' ) ) . + Xml::openElement( 'table', [ 'id' => 'mw-import-table-interwiki' ] ) . " " . Xml::label( $this->msg( 'import-interwiki-sourcewiki' )->text(), 'interwiki' ) . @@ -406,7 +406,7 @@ class SpecialImport extends SpecialPage { " . Xml::openElement( 'select', - array( 'name' => 'interwiki', 'id' => 'interwiki' ) + [ 'name' => 'interwiki', 'id' => 'interwiki' ] ) ); @@ -418,9 +418,9 @@ class SpecialImport extends SpecialPage { $needSubprojectField = true; } - $attribs = array( + $attribs = [ 'value' => $key, - ); + ]; if ( is_array( $value ) ) { $attribs['data-subprojects'] = implode( ' ', $value ); } @@ -438,11 +438,11 @@ class SpecialImport extends SpecialPage { $out->addHTML( Xml::openElement( 'select', - array( 'name' => 'subproject', 'id' => 'subproject' ) + [ 'name' => 'subproject', 'id' => 'subproject' ] ) ); - $subprojectsToAdd = array(); + $subprojectsToAdd = []; foreach ( $this->importSources as $key => $value ) { if ( is_array( $value ) ) { $subprojectsToAdd = array_merge( $subprojectsToAdd, $value ); @@ -467,7 +467,7 @@ class SpecialImport extends SpecialPage { Xml::label( $this->msg( 'import-interwiki-sourcepage' )->text(), 'frompage' ) . " " . - Xml::input( 'frompage', 50, $this->frompage, array( 'id' => 'frompage' ) ) . + Xml::input( 'frompage', 50, $this->frompage, [ 'id' => 'frompage' ] ) . " @@ -502,7 +502,7 @@ class SpecialImport extends SpecialPage { " . Xml::input( 'log-comment', 50, ( $this->sourceName === 'interwiki' ? $this->logcomment : '' ), - array( 'id' => 'mw-interwiki-comment', 'type' => 'text' ) ) . ' ' . + [ 'id' => 'mw-interwiki-comment', 'type' => 'text' ] ) . ' ' . " $mappingSelection @@ -546,10 +546,10 @@ class ImportReporter extends ContextSource { */ function __construct( $importer, $upload, $interwiki, $reason = false ) { $this->mOriginalPageOutCallback = - $importer->setPageOutCallback( array( $this, 'reportPage' ) ); + $importer->setPageOutCallback( [ $this, 'reportPage' ] ); $this->mOriginalLogCallback = - $importer->setLogItemCallback( array( $this, 'reportLogItem' ) ); - $importer->setNoticeCallback( array( $this, 'reportNotice' ) ); + $importer->setLogItemCallback( [ $this, 'reportLogItem' ] ); + $importer->setNoticeCallback( [ $this, 'reportNotice' ] ); $this->mPageCount = 0; $this->mIsUpload = $upload; $this->mInterwiki = $interwiki; @@ -562,7 +562,7 @@ class ImportReporter extends ContextSource { function reportNotice( $msg, array $params ) { $this->getOutput()->addHTML( - Html::element( 'li', array(), $this->msg( $msg, $params )->text() ) + Html::element( 'li', [], $this->msg( $msg, $params )->text() ) ); } @@ -581,7 +581,7 @@ class ImportReporter extends ContextSource { * @param array $pageInfo * @return void */ - function reportPage( $title, $foreignTitle, $revisionCount, + public function reportPage( $title, $foreignTitle, $revisionCount, $successCount, $pageInfo ) { $args = func_get_args(); call_user_func_array( $this->mOriginalPageOutCallback, $args ); @@ -600,7 +600,7 @@ class ImportReporter extends ContextSource { "\n" ); - $logParams = array( '4:number:count' => $successCount ); + $logParams = [ '4:number:count' => $successCount ]; if ( $this->mIsUpload ) { $detail = $this->msg( 'import-logentry-upload-detail' )->numParams( $successCount )->inContentLanguage()->text(); @@ -608,7 +608,7 @@ class ImportReporter extends ContextSource { } else { $pageTitle = $foreignTitle->getFullText(); $fullInterwikiPrefix = $this->mInterwiki; - Hooks::run( 'ImportLogInterwikiLink', array( &$fullInterwikiPrefix, &$pageTitle ) ); + Hooks::run( 'ImportLogInterwikiLink', [ &$fullInterwikiPrefix, &$pageTitle ] ); $interwikiTitleStr = $fullInterwikiPrefix . ':' . $pageTitle; $interwiki = '[[:' . $interwikiTitleStr . ']]'; @@ -648,7 +648,7 @@ class ImportReporter extends ContextSource { $page->updateRevisionOn( $dbw, $nullRevision ); Hooks::run( 'NewRevisionFromEditComplete', - array( $page, $nullRevision, $latest, $this->getUser() ) + [ $page, $nullRevision, $latest, $this->getUser() ] ); } } else {