Merge "Replace Pakaran with Punjabi"
[lhc/web/wiklou.git] / includes / api / ApiMove.php
index 3f54fee..c18036c 100644 (file)
@@ -38,7 +38,7 @@ class ApiMove extends ApiBase {
 
                if ( isset( $params['from'] ) ) {
                        $fromTitle = Title::newFromText( $params['from'] );
-                       if ( !$fromTitle ) {
+                       if ( !$fromTitle || $fromTitle->isExternal() ) {
                                $this->dieUsageMsg( array( 'invalidtitle', $params['from'] ) );
                        }
                } elseif ( isset( $params['fromid'] ) ) {
@@ -54,7 +54,7 @@ class ApiMove extends ApiBase {
                $fromTalk = $fromTitle->getTalkPage();
 
                $toTitle = Title::newFromText( $params['to'] );
-               if ( !$toTitle ) {
+               if ( !$toTitle || $toTitle->isExternal() ) {
                        $this->dieUsageMsg( array( 'invalidtitle', $params['to'] ) );
                }
                $toTalk = $toTitle->getTalkPage();
@@ -88,7 +88,7 @@ class ApiMove extends ApiBase {
                        $r['redirectcreated'] = '';
                }
 
-               if( $toTitleExists ) {
+               if ( $toTitleExists ) {
                        $r['moveoverredirect'] = '';
                }
 
@@ -99,7 +99,7 @@ class ApiMove extends ApiBase {
                        if ( $retval === true ) {
                                $r['talkfrom'] = $fromTalk->getPrefixedText();
                                $r['talkto'] = $toTalk->getPrefixedText();
-                               if( $toTalkExists ) {
+                               if ( $toTalkExists ) {
                                        $r['talkmoveoverredirect'] = '';
                                }
                        } else {
@@ -291,7 +291,7 @@ class ApiMove extends ApiBase {
 
        public function getExamples() {
                return array(
-                       'api.php?action=move&from=Exampel&to=Example&token=123ABC&reason=Misspelled%20title&movetalk=&noredirect='
+                       'api.php?action=move&from=Badtitle&to=Goodtitle&token=123ABC&reason=Misspelled%20title&movetalk=&noredirect='
                );
        }