API: Allow redirecting a page to itself using action=edit
[lhc/web/wiklou.git] / includes / api / ApiEditPage.php
index f2bb273..80589c3 100644 (file)
@@ -253,7 +253,8 @@ class ApiEditPage extends ApiBase {
                        'model' => $contentHandler->getModelID(),
                        'wpEditToken' => $params['token'],
                        'wpIgnoreBlankSummary' => '',
-                       'wpIgnoreBlankArticle' => true
+                       'wpIgnoreBlankArticle' => true,
+                       'wpIgnoreSelfRedirect' => true,
                );
 
                if ( !is_null( $params['summary'] ) ) {
@@ -445,6 +446,9 @@ class ApiEditPage extends ApiBase {
                        case EditPage::AS_NO_CREATE_PERMISSION:
                                $this->dieUsageMsg( 'nocreate-loggedin' );
 
+                       case EditPage::AS_NO_CHANGE_CONTENT_MODEL:
+                               $this->dieUsageMsg( 'cantchangecontentmodel' );
+
                        case EditPage::AS_BLANK_ARTICLE:
                                $this->dieUsageMsg( 'blankpage' );
 
@@ -565,7 +569,7 @@ class ApiEditPage extends ApiBase {
                return 'csrf';
        }
 
-       public function getExamplesMessages() {
+       protected function getExamplesMessages() {
                return array(
                        'action=edit&title=Test&summary=test%20summary&' .
                                'text=article%20content&basetimestamp=2007-08-24T12:34:54Z&token=123ABC'