merging latest master
[lhc/web/wiklou.git] / includes / specials / SpecialMovepage.php
index 6b817d2..3ece917 100644 (file)
@@ -246,6 +246,14 @@ class MovePageForm extends UnlistedSpecialPage {
                // Byte limit (not string length limit) for wpReason and wpNewTitleMain
                // is enforced in the mediawiki.special.movePage module
 
+               $immovableNamespaces = array();
+
+               foreach ( array_keys( $this->getLanguage()->getNamespaces() ) as $nsId ) {
+                       if ( !MWNamespace::isMovable( $nsId ) ) {
+                               $immovableNamespaces[] = $nsId;
+                       }
+               }
+
                $out->addHTML(
                         Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->getTitle()->getLocalURL( 'action=submit' ), 'id' => 'movepage' ) ) .
                         Xml::openElement( 'fieldset' ) .
@@ -265,7 +273,10 @@ class MovePageForm extends UnlistedSpecialPage {
                                "</td>
                                <td class='mw-input'>" .
                                        Html::namespaceSelector(
-                                               array( 'selected' => $newTitle->getNamespace() ),
+                                               array(
+                                                       'selected' => $newTitle->getNamespace(),
+                                                       'exclude' => $immovableNamespaces
+                                               ),
                                                array( 'name' => 'wpNewTitleNs', 'id' => 'wpNewTitleNs' )
                                        ) .
                                        Xml::input( 'wpNewTitleMain', 60, $wgContLang->recodeForEdit( $newTitle->getText() ), array(
@@ -347,7 +358,7 @@ class MovePageForm extends UnlistedSpecialPage {
                }
 
                $watchChecked = $user->isLoggedIn() && ($this->watch || $user->getBoolOption( 'watchmoves' )
-                       || $this->oldTitle->userIsWatching());
+                       || $user->isWatched( $this->oldTitle ) );
                # Don't allow watching if user is not logged in
                if( $user->isLoggedIn() ) {
                        $out->addHTML( "
@@ -429,8 +440,9 @@ class MovePageForm extends UnlistedSpecialPage {
 
                        $error = ''; // passed by ref
                        $page = WikiPage::factory( $nt );
-                       if ( !$page->doDeleteArticle( $reason, false, 0, true, $error, $user ) ) {
-                               $this->showForm( array( array( 'cannotdelete', wfEscapeWikiText( $nt->getPrefixedText() ) ) ) );
+                       $deleteStatus = $page->doDeleteArticleReal( $reason, false, 0, true, $error, $user );
+                       if ( !$deleteStatus->isGood() ) {
+                               $this->showForm( $deleteStatus->getErrorsArray() );
                                return;
                        }
                }
@@ -617,8 +629,9 @@ class MovePageForm extends UnlistedSpecialPage {
        }
 
        function showLogFragment( $title ) {
+               $moveLogPage = new LogPage( 'move' );
                $out = $this->getOutput();
-               $out->addHTML( Xml::element( 'h2', null, LogPage::logName( 'move' ) ) );
+               $out->addHTML( Xml::element( 'h2', null, $moveLogPage->getName()->text() ) );
                LogEventsList::showLogExtract( $out, 'move', $title );
        }