From: Alexandre Emsenhuber Date: Mon, 16 May 2011 17:41:58 +0000 (+0000) Subject: Only increment the page count if the page has been created; also simplified a bit... X-Git-Tag: 1.31.0-rc.0~30125 X-Git-Url: https://git.cyclocoop.org/%7B%7B%20url_for%28?a=commitdiff_plain;h=2243393251abe8cf50c73bf6686257a56a381c06;p=lhc%2Fweb%2Fwiklou.git Only increment the page count if the page has been created; also simplified a bit the code --- 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 ); }