Merge "Use Diffusion for default Git Viewer"
[lhc/web/wiklou.git] / includes / specials / SpecialMovepage.php
index 339c1d9..f49d730 100644 (file)
@@ -127,7 +127,7 @@ class MovePageForm extends UnlistedSpecialPage {
                ) {
                        $this->doSubmit();
                } else {
-                       $this->showForm( array() );
+                       $this->showForm( [] );
                }
        }
 
@@ -192,10 +192,10 @@ class MovePageForm extends UnlistedSpecialPage {
                ) {
                        $out->wrapWikiMsg(
                                "<div class='warningbox'>\n$1\n</div>\n",
-                               array( 'delete_and_move_text', $newTitle->getPrefixedText() )
+                               [ 'delete_and_move_text', $newTitle->getPrefixedText() ]
                        );
                        $deleteAndMove = true;
-                       $err = array();
+                       $err = [];
                }
 
                if ( count( $err ) == 1 && isset( $err[0][0] ) && $err[0][0] == 'file-exists-sharedrepo'
@@ -203,13 +203,13 @@ class MovePageForm extends UnlistedSpecialPage {
                ) {
                        $out->wrapWikiMsg(
                                "<div class='warningbox'>\n$1\n</div>\n",
-                               array(
+                               [
                                        'move-over-sharedrepo',
                                        $newTitle->getPrefixedText()
-                               )
+                               ]
                        );
                        $moveOverShared = true;
-                       $err = array();
+                       $err = [];
                }
 
                $oldTalk = $this->oldTitle->getTalkPage();
@@ -228,10 +228,10 @@ class MovePageForm extends UnlistedSpecialPage {
                $dbr = wfGetDB( DB_SLAVE );
                if ( $this->getConfig()->get( 'FixDoubleRedirects' ) ) {
                        $hasRedirects = $dbr->selectField( 'redirect', '1',
-                               array(
+                               [
                                        'rd_namespace' => $this->oldTitle->getNamespace(),
                                        'rd_title' => $this->oldTitle->getDBkey(),
-                               ), __METHOD__ );
+                               ], __METHOD__ );
                } else {
                        $hasRedirects = false;
                }
@@ -251,7 +251,7 @@ class MovePageForm extends UnlistedSpecialPage {
                                        $out->addWikiMsgArray( $errMsgName, $errMsg );
                                }
                        } else {
-                               $errStr = array();
+                               $errStr = [];
 
                                foreach ( $err as $errMsg ) {
                                        if ( $errMsg[0] == 'hookaborted' ) {
@@ -284,7 +284,7 @@ class MovePageForm extends UnlistedSpecialPage {
                                'protect',
                                $this->oldTitle,
                                '',
-                               array( 'lim' => 1 )
+                               [ 'lim' => 1 ]
                        );
                        $out->addHTML( "</div>\n" );
                }
@@ -292,7 +292,7 @@ class MovePageForm extends UnlistedSpecialPage {
                // Byte limit (not string length limit) for wpReason and wpNewTitleMain
                // is enforced in the mediawiki.special.movePage module
 
-               $immovableNamespaces = array();
+               $immovableNamespaces = [];
                foreach ( array_keys( $this->getLanguage()->getNamespaces() ) as $nsId ) {
                        if ( !MWNamespace::isMovable( $nsId ) ) {
                                $immovableNamespaces[] = $nsId;
@@ -302,60 +302,60 @@ class MovePageForm extends UnlistedSpecialPage {
                $handler = ContentHandler::getForTitle( $this->oldTitle );
 
                $out->enableOOUI();
-               $fields = array();
+               $fields = [];
 
                $fields[] = new OOUI\FieldLayout(
-                       new MediaWiki\Widget\ComplexTitleInputWidget( array(
+                       new MediaWiki\Widget\ComplexTitleInputWidget( [
                                'id' => 'wpNewTitle',
-                               'namespace' => array(
+                               'namespace' => [
                                        'id' => 'wpNewTitleNs',
                                        'name' => 'wpNewTitleNs',
                                        'value' => $newTitle->getNamespace(),
                                        'exclude' => $immovableNamespaces,
-                               ),
-                               'title' => array(
+                               ],
+                               'title' => [
                                        'id' => 'wpNewTitleMain',
                                        'name' => 'wpNewTitleMain',
                                        'value' => $wgContLang->recodeForEdit( $newTitle->getText() ),
                                        // Inappropriate, since we're expecting the user to input a non-existent page's title
                                        'suggestions' => false,
-                               ),
+                               ],
                                'infusable' => true,
-                       ) ),
-                       array(
+                       ] ),
+                       [
                                'label' => $this->msg( 'newtitle' )->text(),
                                'align' => 'top',
-                       )
+                       ]
                );
 
                $fields[] = new OOUI\FieldLayout(
-                       new OOUI\TextInputWidget( array(
+                       new OOUI\TextInputWidget( [
                                'name' => 'wpReason',
                                'id' => 'wpReason',
                                'maxLength' => 200,
                                'infusable' => true,
                                'value' => $this->reason,
-                       ) ),
-                       array(
+                       ] ),
+                       [
                                'label' => $this->msg( 'movereason' )->text(),
                                'align' => 'top',
-                       )
+                       ]
                );
 
                if ( $considerTalk ) {
                        $fields[] = new OOUI\FieldLayout(
-                               new OOUI\CheckboxInputWidget( array(
+                               new OOUI\CheckboxInputWidget( [
                                        'name' => 'wpMovetalk',
                                        'id' => 'wpMovetalk',
                                        'value' => '1',
                                        'selected' => $this->moveTalk,
-                               ) ),
-                               array(
+                               ] ),
+                               [
                                        'label' => $this->msg( 'movetalk' )->text(),
                                        'help' => new OOUI\HtmlSnippet( $this->msg( 'movepagetalktext' )->parseAsBlock() ),
                                        'align' => 'inline',
                                        'infusable' => true,
-                               )
+                               ]
                        );
                }
 
@@ -368,47 +368,47 @@ class MovePageForm extends UnlistedSpecialPage {
                                $isDisabled = true;
                        }
                        $fields[] = new OOUI\FieldLayout(
-                               new OOUI\CheckboxInputWidget( array(
+                               new OOUI\CheckboxInputWidget( [
                                        'name' => 'wpLeaveRedirect',
                                        'id' => 'wpLeaveRedirect',
                                        'value' => '1',
                                        'selected' => $isChecked,
                                        'disabled' => $isDisabled,
-                               ) ),
-                               array(
+                               ] ),
+                               [
                                        'label' => $this->msg( 'move-leave-redirect' )->text(),
                                        'align' => 'inline',
-                               )
+                               ]
                        );
                }
 
                if ( $hasRedirects ) {
                        $fields[] = new OOUI\FieldLayout(
-                               new OOUI\CheckboxInputWidget( array(
+                               new OOUI\CheckboxInputWidget( [
                                        'name' => 'wpFixRedirects',
                                        'id' => 'wpFixRedirects',
                                        'value' => '1',
                                        'selected' => $this->fixRedirects,
-                               ) ),
-                               array(
+                               ] ),
+                               [
                                        'label' => $this->msg( 'fix-double-redirects' )->text(),
                                        'align' => 'inline',
-                               )
+                               ]
                        );
                }
 
                if ( $canMoveSubpage ) {
                        $maximumMovedPages = $this->getConfig()->get( 'MaximumMovedPages' );
                        $fields[] = new OOUI\FieldLayout(
-                               new OOUI\CheckboxInputWidget( array(
+                               new OOUI\CheckboxInputWidget( [
                                        'name' => 'wpMovesubpages',
                                        'id' => 'wpMovesubpages',
                                        'value' => '1',
                                        # Don't check the box if we only have talk subpages to
                                        # move and we aren't moving the talk page.
                                        'selected' => $this->moveSubpages && ( $this->oldTitle->hasSubpages() || $this->moveTalk ),
-                               ) ),
-                               array(
+                               ] ),
+                               [
                                        'label' => new OOUI\HtmlSnippet(
                                                $this->msg(
                                                        ( $this->oldTitle->hasSubpages()
@@ -417,7 +417,7 @@ class MovePageForm extends UnlistedSpecialPage {
                                                )->numParams( $maximumMovedPages )->params( $maximumMovedPages )->parse()
                                        ),
                                        'align' => 'inline',
-                               )
+                               ]
                        );
                }
 
@@ -426,16 +426,16 @@ class MovePageForm extends UnlistedSpecialPage {
                        $watchChecked = $user->isLoggedIn() && ( $this->watch || $user->getBoolOption( 'watchmoves' )
                                || $user->isWatched( $this->oldTitle ) );
                        $fields[] = new OOUI\FieldLayout(
-                               new OOUI\CheckboxInputWidget( array(
+                               new OOUI\CheckboxInputWidget( [
                                        'name' => 'wpWatch',
                                        'id' => 'watch', # ew
                                        'value' => '1',
                                        'selected' => $watchChecked,
-                               ) ),
-                               array(
+                               ] ),
+                               [
                                        'label' => $this->msg( 'move-watch' )->text(),
                                        'align' => 'inline',
-                               )
+                               ]
                        );
                }
 
@@ -446,42 +446,42 @@ class MovePageForm extends UnlistedSpecialPage {
 
                if ( $deleteAndMove ) {
                        $fields[] = new OOUI\FieldLayout(
-                               new OOUI\CheckboxInputWidget( array(
+                               new OOUI\CheckboxInputWidget( [
                                        'name' => 'wpDeleteAndMove',
                                        'id' => 'wpDeleteAndMove',
                                        'value' => '1',
-                               ) ),
-                               array(
+                               ] ),
+                               [
                                        'label' => $this->msg( 'delete_and_move_confirm' )->text(),
                                        'align' => 'inline',
-                               )
+                               ]
                        );
                }
 
                $fields[] = new OOUI\FieldLayout(
-                       new OOUI\ButtonInputWidget( array(
+                       new OOUI\ButtonInputWidget( [
                                'name' => 'wpMove',
                                'value' => $this->msg( 'movepagebtn' )->text(),
                                'label' => $this->msg( 'movepagebtn' )->text(),
-                               'flags' => array( 'constructive', 'primary' ),
+                               'flags' => [ 'constructive', 'primary' ],
                                'type' => 'submit',
-                       ) ),
-                       array(
+                       ] ),
+                       [
                                'align' => 'top',
-                       )
+                       ]
                );
 
-               $fieldset = new OOUI\FieldsetLayout( array(
+               $fieldset = new OOUI\FieldsetLayout( [
                        'label' => $this->msg( 'move-page-legend' )->text(),
                        'id' => 'mw-movepage-table',
                        'items' => $fields,
-               ) );
+               ] );
 
-               $form = new OOUI\FormLayout( array(
+               $form = new OOUI\FormLayout( [
                        'method' => 'post',
                        'action' => $this->getPageTitle()->getLocalURL( 'action=submit' ),
                        'id' => 'movepage',
-               ) );
+               ] );
                $form->appendContent(
                        $fieldset,
                        new OOUI\HtmlSnippet(
@@ -492,13 +492,13 @@ class MovePageForm extends UnlistedSpecialPage {
                );
 
                $out->addHTML(
-                       new OOUI\PanelLayout( array(
-                               'classes' => array( 'movepage-wrapper' ),
+                       new OOUI\PanelLayout( [
+                               'classes' => [ 'movepage-wrapper' ],
                                'expanded' => false,
                                'padded' => true,
                                'framed' => true,
                                'content' => $form,
-                       ) )
+                       ] )
                );
 
                $this->showLogFragment( $this->oldTitle );
@@ -517,7 +517,7 @@ class MovePageForm extends UnlistedSpecialPage {
 
                # don't allow moving to pages with # in
                if ( !$nt || $nt->hasFragment() ) {
-                       $this->showForm( array( array( 'badtitletext' ) ) );
+                       $this->showForm( [ [ 'badtitletext' ] ] );
 
                        return;
                }
@@ -528,7 +528,7 @@ class MovePageForm extends UnlistedSpecialPage {
                        && !RepoGroup::singleton()->getLocalRepo()->findFile( $nt )
                        && wfFindFile( $nt )
                ) {
-                       $this->showForm( array( array( 'file-exists-sharedrepo' ) ) );
+                       $this->showForm( [ [ 'file-exists-sharedrepo' ] ] );
 
                        return;
                }
@@ -604,13 +604,13 @@ class MovePageForm extends UnlistedSpecialPage {
                $oldLink = Linker::link(
                        $ot,
                        null,
-                       array( 'id' => 'movepage-oldlink' ),
-                       array( 'redirect' => 'no' )
+                       [ 'id' => 'movepage-oldlink' ],
+                       [ 'redirect' => 'no' ]
                );
                $newLink = Linker::linkKnown(
                        $nt,
                        null,
-                       array( 'id' => 'movepage-newlink' )
+                       [ 'id' => 'movepage-newlink' ]
                );
                $oldText = $ot->getPrefixedText();
                $newText = $nt->getPrefixedText();
@@ -630,7 +630,7 @@ class MovePageForm extends UnlistedSpecialPage {
                        $newLink )->params( $oldText, $newText )->parseAsBlock() );
                $out->addWikiMsg( $msgName );
 
-               Hooks::run( 'SpecialMovepageAfterMove', array( &$this, &$ot, &$nt ) );
+               Hooks::run( 'SpecialMovepageAfterMove', [ &$this, &$ot, &$nt ] );
 
                # Now we move extra pages we've been asked to move: subpages and talk
                # pages.  First, if the old page or the new page is a talk page, we
@@ -662,11 +662,11 @@ class MovePageForm extends UnlistedSpecialPage {
                                        && MWNamespace::hasSubpages( $nt->getTalkPage()->getNamespace() )
                        )
                ) ) {
-                       $conds = array(
+                       $conds = [
                                'page_title' . $dbr->buildLike( $ot->getDBkey() . '/', $dbr->anyString() )
                                        . ' OR page_title = ' . $dbr->addQuotes( $ot->getDBkey() )
-                       );
-                       $conds['page_namespace'] = array();
+                       ];
+                       $conds['page_namespace'] = [];
                        if ( MWNamespace::hasSubpages( $nt->getNamespace() ) ) {
                                $conds['page_namespace'][] = $ot->getNamespace();
                        }
@@ -676,27 +676,27 @@ class MovePageForm extends UnlistedSpecialPage {
                                $conds['page_namespace'][] = $ot->getTalkPage()->getNamespace();
                        }
                } elseif ( $this->moveTalk ) {
-                       $conds = array(
+                       $conds = [
                                'page_namespace' => $ot->getTalkPage()->getNamespace(),
                                'page_title' => $ot->getDBkey()
-                       );
+                       ];
                } else {
                        # Skip the query
                        $conds = null;
                }
 
-               $extraPages = array();
+               $extraPages = [];
                if ( !is_null( $conds ) ) {
                        $extraPages = TitleArray::newFromResult(
                                $dbr->select( 'page',
-                                       array( 'page_id', 'page_namespace', 'page_title' ),
+                                       [ 'page_id', 'page_namespace', 'page_title' ],
                                        $conds,
                                        __METHOD__
                                )
                        );
                }
 
-               $extraOutput = array();
+               $extraOutput = [];
                $count = 1;
                foreach ( $extraPages as $oldSubpage ) {
                        if ( $ot->equals( $oldSubpage ) || $nt->equals( $oldSubpage ) ) {
@@ -743,8 +743,8 @@ class MovePageForm extends UnlistedSpecialPage {
                                        $oldLink = Linker::link(
                                                $oldSubpage,
                                                null,
-                                               array(),
-                                               array( 'redirect' => 'no' )
+                                               [],
+                                               [ 'redirect' => 'no' ]
                                        );
 
                                        $newLink = Linker::linkKnown( $newSubpage );
@@ -767,7 +767,7 @@ class MovePageForm extends UnlistedSpecialPage {
                        }
                }
 
-               if ( $extraOutput !== array() ) {
+               if ( $extraOutput !== [] ) {
                        $out->addHTML( "<ul>\n<li>" . implode( "</li>\n<li>", $extraOutput ) . "</li>\n</ul>" );
                }
 
@@ -792,7 +792,7 @@ class MovePageForm extends UnlistedSpecialPage {
                $count = $subpages instanceof TitleArray ? $subpages->count() : 0;
 
                $out = $this->getOutput();
-               $out->wrapWikiMsg( '== $1 ==', array( 'movesubpage', $count ) );
+               $out->wrapWikiMsg( '== $1 ==', [ 'movesubpage', $count ] );
 
                # No subpages.
                if ( $count == 0 ) {