Index: trunk/phase3/includes/Article.php |
— | — | @@ -1977,6 +1977,7 @@ |
1978 | 1978 | * @deprecated use Article::doEdit() |
1979 | 1979 | */ |
1980 | 1980 | function updateArticle( $text, $summary, $minor, $watchthis, $forceBot = false, $sectionanchor = '' ) { |
| 1981 | + wfDeprecated( __METHOD__ ); |
1981 | 1982 | $flags = EDIT_UPDATE | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY | |
1982 | 1983 | ( $minor ? EDIT_MINOR : 0 ) | |
1983 | 1984 | ( $forceBot ? EDIT_FORCE_BOT : 0 ); |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -905,6 +905,8 @@ |
906 | 906 | |
907 | 907 | $isComment = ( $this->section == 'new' ); |
908 | 908 | |
| 909 | + # FIXME: paste contents from Article::insertNewArticle here and |
| 910 | + # actually handle errors it may return |
909 | 911 | $this->mArticle->insertNewArticle( $this->textbox1, $this->summary, |
910 | 912 | $this->minoredit, $this->watchthis, false, $isComment, $bot ); |
911 | 913 | |
— | — | @@ -1051,14 +1053,20 @@ |
1052 | 1054 | return self::AS_MAX_ARTICLE_SIZE_EXCEEDED; |
1053 | 1055 | } |
1054 | 1056 | |
1055 | | - # update the article here |
1056 | | - if ( $this->mArticle->updateArticle( $text, $this->summary, $this->minoredit, |
1057 | | - $this->watchthis, $bot, $sectionanchor ) ) |
| 1057 | + // Update the article here |
| 1058 | + $flags = EDIT_UPDATE | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY | |
| 1059 | + ( $this->minoredit ? EDIT_MINOR : 0 ) | |
| 1060 | + ( $bot ? EDIT_FORCE_BOT : 0 ); |
| 1061 | + $status = $this->mArticle->doEdit( $text, $this->summary, $flags, |
| 1062 | + false, null, $this->watchthis, false, $sectionanchor, true ); |
| 1063 | + |
| 1064 | + if ( $status->isOK() ) |
1058 | 1065 | { |
1059 | 1066 | wfProfileOut( __METHOD__ ); |
1060 | 1067 | return self::AS_SUCCESS_UPDATE; |
1061 | 1068 | } else { |
1062 | 1069 | $this->isConflict = true; |
| 1070 | + $result = $status->getErrorsArray(); |
1063 | 1071 | } |
1064 | 1072 | wfProfileOut( __METHOD__ ); |
1065 | 1073 | return self::AS_END; |
Index: trunk/phase3/includes/api/ApiEditPage.php |
— | — | @@ -327,12 +327,13 @@ |
328 | 328 | |
329 | 329 | case EditPage::AS_END: |
330 | 330 | // This usually means some kind of race condition |
331 | | - // or DB weirdness occurred. Fall through to throw an unknown |
332 | | - // error. |
333 | | - |
334 | | - // This needs fixing higher up, as Article::doEdit should be |
335 | | - // used rather than Article::updateArticle, so that specific |
336 | | - // error conditions can be returned |
| 331 | + // or DB weirdness occurred. |
| 332 | + if ( is_array( $result ) && count( $result ) > 0 ) { |
| 333 | + $this->dieUsageMsg( array( 'unknownerror', $result[0][0] ) ); |
| 334 | + } |
| 335 | + |
| 336 | + // Unknown error, but no specific error message |
| 337 | + // Fall through |
337 | 338 | default: |
338 | 339 | $this->dieUsageMsg( array( 'unknownerror', $retval ) ); |
339 | 340 | } |