From 0db46cb706b1f92726077b6e45e995bf85d3e95d Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 9 Oct 2006 02:15:12 +0000 Subject: [PATCH] * (bug 7510) Update article counts etc on undelete --- RELEASE-NOTES | 1 + includes/Article.php | 16 ++++++++++++++++ includes/SpecialUndelete.php | 14 ++++---------- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index c2288692dc..9984a2f5bb 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -275,6 +275,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Made messages used in Special:Preferences either plain text or wikitext (toggles) * Replaced {{SERVER}}{{localurl:xxx}} with {{fullurl:xxx}} in localisation files * Fix regression in Special:Watchlist text header +* (bug 7510) Update article counts etc on undelete == Languages updated == diff --git a/includes/Article.php b/includes/Article.php index 5f81730074..8c07b06c51 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -2161,6 +2161,22 @@ class Article { wfProfileOut( __METHOD__ ); } + + /** + * Perform article updates on a special page creation. + * + * @param Revision $rev + * + * @fixme This is a shitty interface function. Kill it and replace the + * other shitty functions like editUpdates and such so it's not needed + * anymore. + */ + function createUpdates( $rev ) { + $this->mGoodAdjustment = $this->isCountable( $rev->getText() ); + $this->mTotalAdjustment = 1; + $this->editUpdates( $rev->getText(), $rev->getComment(), + $rev->isMinor(), wfTimestamp(), $rev->getId(), true ); + } /** * Generate the navigation links when browsing through an article revisions diff --git a/includes/SpecialUndelete.php b/includes/SpecialUndelete.php index 1db80e52c6..8e0291ec87 100644 --- a/includes/SpecialUndelete.php +++ b/includes/SpecialUndelete.php @@ -350,17 +350,11 @@ class PageArchive { if( $revision ) { # FIXME: Update latest if newer as well... if( $newid ) { - # FIXME: update article count if changed... + // Attach the latest revision to the page... $article->updateRevisionOn( $dbw, $revision, $previousRevId ); - - # Finally, clean up the link tables - $options = new ParserOptions; - $parserOutput = $wgParser->parse( $revision->getText(), $this->title, $options, - true, true, $newRevId ); - $u = new LinksUpdate( $this->title, $parserOutput ); - $u->doUpdate(); - - #TODO: SearchUpdate, etc. + + // Update site stats, link tables, etc + $article->createUpdates( $revision ); } if( $newid ) { -- 2.20.1