From 8628ce8310bd6cc9f02d825c1485f9ee2a87453e Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sat, 14 Aug 2004 20:09:47 +0000 Subject: [PATCH] Fix sourceforge bug #850012 : Page move doesn't update article count It works on my local wiki unfortunatly I have neither memcached nor squid so the code might need some tweaking. --- includes/SpecialMovepage.php | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/includes/SpecialMovepage.php b/includes/SpecialMovepage.php index 1db3b345aa..bbb2de9de0 100644 --- a/includes/SpecialMovepage.php +++ b/includes/SpecialMovepage.php @@ -110,6 +110,8 @@ class MovePageForm { # Variables beginning with 'o' for old article 'n' for new article + # Attempt to move the article + $ot = Title::newFromText( $this->oldTitle ); $nt = Title::newFromText( $this->newTitle ); @@ -119,13 +121,27 @@ class MovePageForm { return; } + # Update counters if the article got moved in or out of NS_MAIN namespace + $ons = $ot->getNamespace(); + $nns = $nt->getNamespace(); + + # moved out of article namespace ? + if ( $ons == NS_MAIN and $nns != NS_MAIN ) { + $u = new SiteStatsUpdate( 0, 1, -1); # not viewed, edited, removing + } + # moved in article namespace ? + elseif ( $ons != NS_MAIN and $nns == NS_MAIN ) { + $u = new SiteStatsUpdate( 0, 1, +1 ); # not viewed, edited, adding + } + + # save it for later update + array_push( $wgDeferredUpdateList, $u ); + unset($u); + # Move talk page if # (1) the checkbox says to, # (2) the namespaces are not themselves talk namespaces, and of course # (3) it exists. - - $ons = $ot->getNamespace(); - $nns = $nt->getNamespace(); if ( ( $wgRequest->getVal('wpMovetalk') == 1 ) && ( ! Namespace::isTalk( $ons ) ) && -- 2.20.1