From 2243393251abe8cf50c73bf6686257a56a381c06 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Mon, 16 May 2011 17:41:58 +0000 Subject: [PATCH] Only increment the page count if the page has been created; also simplified a bit the code --- includes/specials/SpecialUndelete.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/includes/specials/SpecialUndelete.php b/includes/specials/SpecialUndelete.php index 3795e7d681..237fcc53a9 100644 --- a/includes/specials/SpecialUndelete.php +++ b/includes/specials/SpecialUndelete.php @@ -526,18 +526,21 @@ class PageArchive { return 0; } + $created = (bool)$newid; + // Attach the latest revision to the page... $wasnew = $article->updateIfNewerOn( $dbw, $revision, $previousRevId ); - if ( $newid || $wasnew ) { + if ( $created || $wasnew ) { // Update site stats, link tables, etc - $article->createUpdates( $revision ); + $article->editUpdates( $revision->getText(), $revision->getComment(), + $revision->isMinor(), wfTimestamp(), $revision->getId(), true, null, $created ); } - if( $newid ) { - wfRunHooks( 'ArticleUndelete', array( &$this->title, true, $comment ) ); + wfRunHooks( 'ArticleUndelete', array( &$this->title, $created, $comment ) ); + + if( $created ) { Article::onArticleCreate( $this->title ); } else { - wfRunHooks( 'ArticleUndelete', array( &$this->title, false, $comment ) ); Article::onArticleEdit( $this->title ); } -- 2.20.1