Merge "Make errors from ArticleSave hooks propagate to the interface"
[lhc/web/wiklou.git] / includes / api / ApiEditPage.php
index b45f351..0b7ac41 100644 (file)
@@ -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 );
        }
@@ -371,9 +367,7 @@ class ApiEditPage extends ApiBase {
                return array_merge( parent::getPossibleErrors(),
                        $this->getTitleOrPageIdErrorMessage(),
                        array(
-                               array( 'nosuchpageid', 'pageid' ),
                                array( 'missingtext' ),
-                               array( 'invalidtitle', 'title' ),
                                array( 'createonly-exists' ),
                                array( 'nocreate-missing' ),
                                array( 'nosuchrevid', 'undo' ),