SpecialMovepage: Don't change button text when moving over existing page
[lhc/web/wiklou.git] / includes / specials / SpecialMovepage.php
index e88aa1a..e9fb75b 100644 (file)
@@ -146,6 +146,25 @@ class MovePageForm extends UnlistedSpecialPage {
                $out->addModuleStyles( 'mediawiki.special.movePage.styles' );
                $this->addHelpLink( 'Help:Moving a page' );
 
+               if ( $this->oldTitle->getNamespace() == NS_USER && !$this->oldTitle->isSubpage() ) {
+                       $out->wrapWikiMsg(
+                               "<div class=\"error mw-moveuserpage-warning\">\n$1\n</div>",
+                               'moveuserpage-warning'
+                       );
+               } elseif ( $this->oldTitle->getNamespace() == NS_CATEGORY ) {
+                       $out->wrapWikiMsg(
+                               "<div class=\"error mw-movecategorypage-warning\">\n$1\n</div>",
+                               'movecategorypage-warning'
+                       );
+               }
+
+               $out->addWikiMsg( $this->getConfig()->get( 'FixDoubleRedirects' ) ?
+                       'movepagetext' :
+                       'movepagetext-noredirectfixer'
+               );
+               $submitVar = 'wpMove';
+               $confirm = false;
+
                $newTitle = $this->newTitle;
 
                if ( !$newTitle ) {
@@ -168,30 +187,9 @@ class MovePageForm extends UnlistedSpecialPage {
                        && $newTitle->quickUserCan( 'delete', $user )
                ) {
                        $out->addWikiMsg( 'delete_and_move_text', $newTitle->getPrefixedText() );
-                       $movepagebtn = $this->msg( 'delete_and_move' )->text();
                        $submitVar = 'wpDeleteAndMove';
                        $confirm = true;
                        $err = array();
-               } else {
-                       if ( $this->oldTitle->getNamespace() == NS_USER && !$this->oldTitle->isSubpage() ) {
-                               $out->wrapWikiMsg(
-                                       "<div class=\"error mw-moveuserpage-warning\">\n$1\n</div>",
-                                       'moveuserpage-warning'
-                               );
-                       } elseif ( $this->oldTitle->getNamespace() == NS_CATEGORY ) {
-                               $out->wrapWikiMsg(
-                                       "<div class=\"error mw-movecategorypage-warning\">\n$1\n</div>",
-                                       'movecategorypage-warning'
-                               );
-                       }
-
-                       $out->addWikiMsg( $this->getConfig()->get( 'FixDoubleRedirects' ) ?
-                               'movepagetext' :
-                               'movepagetext-noredirectfixer'
-                       );
-                       $movepagebtn = $this->msg( 'movepagebtn' )->text();
-                       $submitVar = 'wpMove';
-                       $confirm = false;
                }
 
                if ( count( $err ) == 1 && isset( $err[0][0] ) && $err[0][0] == 'file-exists-sharedrepo'
@@ -446,8 +444,8 @@ class MovePageForm extends UnlistedSpecialPage {
                $fields[] = new OOUI\FieldLayout(
                        new OOUI\ButtonInputWidget( array(
                                'name' => $submitVar,
-                               'value' => $movepagebtn,
-                               'label' => $movepagebtn,
+                               'value' => $this->msg( 'movepagebtn' )->text(),
+                               'label' => $this->msg( 'movepagebtn' )->text(),
                                'flags' => array( 'constructive', 'primary' ),
                                'type' => 'submit',
                        ) ),
@@ -632,9 +630,6 @@ class MovePageForm extends UnlistedSpecialPage {
                 * than a more direct method, but this is not a highly performance-cri-
                 * tical code path and readable code is more important here.
                 *
-                * Note: this query works nicely on MySQL 5, but the optimizer in MySQL
-                * 4 might get confused.  If so, consider rewriting as a UNION.
-                *
                 * If the target namespace doesn't allow subpages, moving with subpages
                 * would mean that you couldn't move them back in one operation, which
                 * is bad.