$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' ) ) {
$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' ]
)
);
if ( !$source->isGood() ) {
$out->wrapWikiMsg(
"<p class=\"error\">\n$1\n</p>",
- array( 'importfailed', $source->getWikiText() )
+ [ 'importfailed', $source->getWikiText() ]
);
} else {
$importer = new WikiImporter( $source->value, $this->getConfig() );
if ( !$statusRootPage->isGood() ) {
$out->wrapWikiMsg(
"<p class=\"error\">\n$1\n</p>",
- array(
+ [
'import-options-wrong',
$statusRootPage->getWikiText(),
count( $statusRootPage->getErrorsArray() )
- )
+ ]
);
return;
# No source or XML parse error
$out->wrapWikiMsg(
"<p class=\"error\">\n$1\n</p>",
- array( 'importfailed', $exception->getMessage() )
+ [ 'importfailed', $exception->getMessage() ]
);
} elseif ( !$result->isGood() ) {
# Zero revisions
$out->wrapWikiMsg(
"<p class=\"error\">\n$1\n</p>",
- array( 'importfailed', $result->getWikiText() )
+ [ 'importfailed', $result->getWikiText() ]
);
} else {
# Success!
!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',
- )
+ ]
) .
"</td>
</tr>
) . ' ' .
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'
- )
+ ]
) . ' ' .
"</td>
</tr>";
}
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 );
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' ] ) .
"<tr>
<td class='mw-label'>" .
Xml::label( $this->msg( 'import-upload-filename' )->text(), 'xmlimport' ) .
"</td>
<td class='mw-input'>" .
- Html::input( 'xmlimport', '', 'file', array( 'id' => 'xmlimport' ) ) . ' ' .
+ Html::input( 'xmlimport', '', 'file', [ 'id' => 'xmlimport' ] ) . ' ' .
"</td>
</tr>
<tr>
<td class='mw-input'>" .
Xml::input( 'log-comment', 50,
( $this->sourceName === 'upload' ? $this->logcomment : '' ),
- array( 'id' => 'mw-import-comment', 'type' => 'text' ) ) . ' ' .
+ [ 'id' => 'mw-import-comment', 'type' => 'text' ] ) . ' ' .
"</td>
</tr>
$mappingSelection
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' ] ) .
"<tr>
<td class='mw-label'>" .
Xml::label( $this->msg( 'import-interwiki-sourcewiki' )->text(), 'interwiki' ) .
<td class='mw-input'>" .
Xml::openElement(
'select',
- array( 'name' => 'interwiki', 'id' => 'interwiki' )
+ [ 'name' => 'interwiki', 'id' => 'interwiki' ]
)
);
$needSubprojectField = true;
}
- $attribs = array(
+ $attribs = [
'value' => $key,
- );
+ ];
if ( is_array( $value ) ) {
$attribs['data-subprojects'] = implode( ' ', $value );
}
$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 );
Xml::label( $this->msg( 'import-interwiki-sourcepage' )->text(), 'frompage' ) .
"</td>
<td class='mw-input'>" .
- Xml::input( 'frompage', 50, $this->frompage, array( 'id' => 'frompage' ) ) .
+ Xml::input( 'frompage', 50, $this->frompage, [ 'id' => 'frompage' ] ) .
"</td>
</tr>
<tr>
<td class='mw-input'>" .
Xml::input( 'log-comment', 50,
( $this->sourceName === 'interwiki' ? $this->logcomment : '' ),
- array( 'id' => 'mw-interwiki-comment', 'type' => 'text' ) ) . ' ' .
+ [ 'id' => 'mw-interwiki-comment', 'type' => 'text' ] ) . ' ' .
"</td>
</tr>
$mappingSelection
*/
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;
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() )
);
}
* @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 );
$this->mPageCount++;
if ( $successCount > 0 ) {
+ // <bdi> prevents jumbling of the versions count
+ // in RTL wikis in case the page title is LTR
$this->getOutput()->addHTML(
"<li>" . Linker::linkKnown( $title ) . " " .
+ "<bdi>" .
$this->msg( 'import-revision-count' )->numParams( $successCount )->escaped() .
+ "</bdi>" .
"</li>\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();
} else {
$pageTitle = $foreignTitle->getFullText();
$fullInterwikiPrefix = $this->mInterwiki;
- Hooks::run( 'ImportLogInterwikiLink', array( &$fullInterwikiPrefix, &$pageTitle ) );
+ Hooks::run( 'ImportLogInterwikiLink', [ &$fullInterwikiPrefix, &$pageTitle ] );
$interwikiTitleStr = $fullInterwikiPrefix . ':' . $pageTitle;
$interwiki = '[[:' . $interwikiTitleStr . ']]';
$page->updateRevisionOn( $dbw, $nullRevision );
Hooks::run(
'NewRevisionFromEditComplete',
- array( $page, $nullRevision, $latest, $this->getUser() )
+ [ $page, $nullRevision, $latest, $this->getUser() ]
);
}
} else {