From beb7b8fe3b274c93b261a94798a01b1397b9df3a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mat=C4=9Bj=20Grabovsk=C3=BD?= Date: Sat, 26 Jun 2010 13:25:08 +0000 Subject: [PATCH] (bug 18891) Deprecated Article::insertNewArticle still used in core --- docs/hooks.txt | 2 +- includes/Article.php | 1 + includes/EditPage.php | 9 +++++---- includes/Title.php | 4 ---- maintenance/addwiki.php | 3 ++- maintenance/parserTests.inc | 3 ++- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/hooks.txt b/docs/hooks.txt index 8dba8272a3..7c33018372 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -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 diff --git a/includes/Article.php b/includes/Article.php index 862a81bf30..02729dbb07 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -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 ) | diff --git a/includes/EditPage.php b/includes/EditPage.php index 33f5f50b88..985da119be 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -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; diff --git a/includes/Title.php b/includes/Title.php index e096eb8e39..d20bc24ada 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -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 ) { diff --git a/maintenance/addwiki.php b/maintenance/addwiki.php index 5d71575a28..7d251d8bc1 100644 --- a/maintenance/addwiki.php +++ b/maintenance/addwiki.php @@ -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" ); diff --git a/maintenance/parserTests.inc b/maintenance/parserTests.inc index 4248f4d4d8..be266175ff 100644 --- a/maintenance/parserTests.inc +++ b/maintenance/parserTests.inc @@ -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(); } -- 2.20.1