(bug 18891) Deprecated Article::insertNewArticle still used in core
authorMatěj Grabovský <mgrabovsky@users.mediawiki.org>
Sat, 26 Jun 2010 13:25:08 +0000 (13:25 +0000)
committerMatěj Grabovský <mgrabovsky@users.mediawiki.org>
Sat, 26 Jun 2010 13:25:08 +0000 (13:25 +0000)
docs/hooks.txt
includes/Article.php
includes/EditPage.php
includes/Title.php
maintenance/addwiki.php
maintenance/parserTests.inc

index 8dba827..7c33018 100644 (file)
@@ -653,7 +653,7 @@ pages
 $editPage: EditPage    object
 
 'EditPage::attemptSave': called before an article is
-saved, that is before insertNewArticle() is called
+saved, that is before Article::doEdit() is called
 $editpage_Obj: the current EditPage object
 
 'EditPage::importFormData': allow extensions to read additional data
index 862a81b..02729db 100644 (file)
@@ -1965,6 +1965,7 @@ class Article {
         * it. Nevertheless, use Article::doEdit() instead.
         */
        function insertNewArticle( $text, $summary, $isminor, $watchthis, $suppressRC = false, $comment = false, $bot = false ) {
+               wfDeprecated( __METHOD__ );
                $flags = EDIT_NEW | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY |
                        ( $isminor ? EDIT_MINOR : 0 ) |
                        ( $suppressRC ? EDIT_SUPPRESS_RC : 0 ) |
index 33f5f50..985da11 100644 (file)
@@ -905,10 +905,11 @@ class EditPage {
 
                        $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 );
+                       $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,
+                               false, null, $this->watchthis, $isComment, '', true );
 
                        wfProfileOut( __METHOD__ );
                        return self::AS_SUCCESS_NEW_ARTICLE;
index e096eb8..d20bc24 100644 (file)
@@ -2345,10 +2345,6 @@ class Title {
         * This clears some fields in this object, and clears any associated
         * keys in the "bad links" section of the link cache.
         *
-        * - This is called from Article::insertNewArticle() to allow
-        * loading of the new page_id. It's also called from
-        * Article::doDeleteArticle()
-        *
         * @param $newid \type{\int} the new Article ID
         */
        public function resetArticleID( $newid ) {
index 5d71575..7d251d8 100644 (file)
@@ -130,7 +130,8 @@ class AddWiki extends Maintenance {
                $wgArticle = new Article( $wgTitle );
                $ucsite = ucfirst( $site );
 
-               $wgArticle->insertNewArticle( $this->getFirstArticle( $ucsite, $name ), '', false, false );
+               $wgArticle->doEdit( $this->getFirstArticle( $ucsite, $name ), '', EDIT_NEW | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY,
+                       false, null, false, false, '', true );
 
                $this->output( "Adding to dblists\n" );
 
index 4248f4d..be26617 100644 (file)
@@ -1040,7 +1040,8 @@ class ParserTest {
                }
 
                $art = new Article( $title );
-               $art->insertNewArticle( $text, '', false, false );
+               $art->doEdit( $text, '', EDIT_NEW | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY,
+                       false, null, false, false, '', true );
 
                $this->teardownGlobals();
        }