Follow-up r68606, per comments:
authorMatěj Grabovský <mgrabovsky@users.mediawiki.org>
Sat, 26 Jun 2010 19:52:52 +0000 (19:52 +0000)
committerMatěj Grabovský <mgrabovsky@users.mediawiki.org>
Sat, 26 Jun 2010 19:52:52 +0000 (19:52 +0000)
* Made proper use of Article::doEdit's return value (hopefully)

includes/Article.php
includes/EditPage.php

index 02729db..b1855ca 100644 (file)
@@ -1961,8 +1961,7 @@ class Article {
        }
 
        /**
-        * This function is not deprecated until somebody fixes the core not to use
-        * it. Nevertheless, use Article::doEdit() instead.
+        * @deprecated use Article::doEdit()
         */
        function insertNewArticle( $text, $summary, $isminor, $watchthis, $suppressRC = false, $comment = false, $bot = false ) {
                wfDeprecated( __METHOD__ );
index 985da11..d619e1a 100644 (file)
@@ -908,11 +908,17 @@ class EditPage {
                        $flags = EDIT_NEW | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY |
                                ( $this->minoredit ? EDIT_MINOR : 0 ) |
                                ( $bot ? EDIT_FORCE_BOT : 0 );
-                       $this->mArticle->doEdit( $this->textbox1, $this->summary, $flags,
+                       $status = $this->mArticle->doEdit( $this->textbox1, $this->summary, $flags,
                                false, null, $this->watchthis, $isComment, '', true );
 
+                       if ( $status->isOK() ) {
+                               wfProfileOut( __METHOD__ );
+                               return self::AS_SUCCESS_NEW_ARTICLE;
+                       } else {
+                               $result = $status->getErrorsArray();
+                       }
                        wfProfileOut( __METHOD__ );
-                       return self::AS_SUCCESS_NEW_ARTICLE;
+                       return self::AS_END;
                }
 
                # Article exists. Check for edit conflict.