Merge "escape HTML elements in docblock with double quotes"
[lhc/web/wiklou.git] / includes / api / ApiEditPage.php
index 11f4757..ff0e0a8 100644 (file)
@@ -4,7 +4,7 @@
  *
  * Created on August 16, 2007
  *
- * Copyright © 2007 Iker Labarga <Firstname><Lastname>@gmail.com
+ * Copyright © 2007 Iker Labarga "<Firstname><Lastname>@gmail.com"
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -48,7 +48,8 @@ class ApiEditPage extends ApiBase {
                        $this->dieUsageMsg( 'missingtext' );
                }
 
-               $titleObj = $this->getTitleOrPageId( $params );
+               $pageObj = $this->getTitleOrPageId( $params );
+               $titleObj = $pageObj->getTitle();
                if ( $titleObj->isExternal() ) {
                        $this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) );
                }
@@ -339,16 +340,11 @@ class ApiEditPage extends ApiBase {
                                $this->dieUsageMsg( 'summaryrequired' );
 
                        case EditPage::AS_END:
+                       default:
                                // $status came from WikiPage::doEdit()
                                $errors = $status->getErrorsArray();
                                $this->dieUsageMsg( $errors[0] ); // TODO: Add new errors to message map
                                break;
-                       default:
-                               if ( is_string( $status->value ) && strlen( $status->value ) ) {
-                                       $this->dieUsage( "An unknown return value was returned by Editpage. The code returned was \"{$status->value}\"" , $status->value );
-                               } else {
-                                       $this->dieUsageMsg( array( 'unknownerror', $status->value ) );
-                               }
                }
                $apiResult->addValue( null, $this->getModuleName(), $r );
        }
@@ -498,6 +494,41 @@ class ApiEditPage extends ApiBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'new' => 'boolean',
+                               'result' => array(
+                                       ApiBase::PROP_TYPE => array(
+                                               'Success',
+                                               'Failure'
+                                       ),
+                               ),
+                               'pageid' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'title' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'nochange' => 'boolean',
+                               'oldrevid' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'newrevid' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'newtimestamp' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       )
+               );
+       }
+
        public function needsToken() {
                return true;
        }