* @deprecated use Article::doEdit()
*/
function updateArticle( $text, $summary, $minor, $watchthis, $forceBot = false, $sectionanchor = '' ) {
+ wfDeprecated( __METHOD__ );
$flags = EDIT_UPDATE | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY |
( $minor ? EDIT_MINOR : 0 ) |
( $forceBot ? EDIT_FORCE_BOT : 0 );
$isComment = ( $this->section == 'new' );
+ # FIXME: paste contents from Article::insertNewArticle here and
+ # actually handle errors it may return
$this->mArticle->insertNewArticle( $this->textbox1, $this->summary,
$this->minoredit, $this->watchthis, false, $isComment, $bot );
return self::AS_MAX_ARTICLE_SIZE_EXCEEDED;
}
- # update the article here
- if ( $this->mArticle->updateArticle( $text, $this->summary, $this->minoredit,
- $this->watchthis, $bot, $sectionanchor ) )
+ // Update the article here
+ $flags = EDIT_UPDATE | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY |
+ ( $this->minoredit ? EDIT_MINOR : 0 ) |
+ ( $bot ? EDIT_FORCE_BOT : 0 );
+ $status = $this->mArticle->doEdit( $text, $this->summary, $flags,
+ false, null, $this->watchthis, false, $sectionanchor, true );
+
+ if ( $status->isOK() )
{
wfProfileOut( __METHOD__ );
return self::AS_SUCCESS_UPDATE;
} else {
$this->isConflict = true;
+ $result = $status->getErrorsArray();
}
wfProfileOut( __METHOD__ );
return self::AS_END;
case EditPage::AS_END:
// This usually means some kind of race condition
- // or DB weirdness occurred. Fall through to throw an unknown
- // error.
-
- // This needs fixing higher up, as Article::doEdit should be
- // used rather than Article::updateArticle, so that specific
- // error conditions can be returned
+ // or DB weirdness occurred.
+ if ( is_array( $result ) && count( $result ) > 0 ) {
+ $this->dieUsageMsg( array( 'unknownerror', $result[0][0] ) );
+ }
+
+ // Unknown error, but no specific error message
+ // Fall through
default:
$this->dieUsageMsg( array( 'unknownerror', $retval ) );
}