]> scripts.mit.edu Git - autoinstalls/mediawiki.git/blobdiff - maintenance/nukePage.inc
MediaWiki 1.14.0
[autoinstalls/mediawiki.git] / maintenance / nukePage.inc
index 804651b13d12203741c55215f7f6d4b03346a4e6..a19c6df6f43918391be1ec394ff88ecdd54ebc1d 100644 (file)
@@ -3,7 +3,8 @@
 /**
  * Support functions for the nukeArticle script
  *
- * @addtogroup Maintenance
+ * @file
+ * @ingroup Maintenance
  * @author Rob Church <robchur@gmail.com>
  */
 
@@ -24,6 +25,7 @@ function NukePage( $name, $delete = false ) {
        if( $title ) {
                $id   = $title->getArticleID();
                $real = $title->getPrefixedText();
+               $isGoodArticle = $title->isContentPage();
                echo( "found \"$real\" with ID $id.\n" );
                
                # Get corresponding revisions
@@ -55,6 +57,16 @@ function NukePage( $name, $delete = false ) {
                        PurgeRedundantText( true );
                }
                
+               # Update stats as appropriate
+               if ( $delete ) {
+                       echo( "Updating site stats..." );
+                       $ga = $isGoodArticle ? -1 : 0; // if it was good, decrement that too
+                       $stats = new SiteStatsUpdate( 0, -$count, $ga, -1 );
+                       $stats->doUpdate();
+                       echo( "done.\n" );
+               }
+               
+               
        } else {
                echo( "not found in database.\n" );
                $dbw->commit();
@@ -73,14 +85,6 @@ function DeleteRevisions( $ids ) {
        $dbw->query( "DELETE FROM $tbl_rev WHERE rev_id IN ( $set )" );
        
        $dbw->commit(); 
-
-       #TODO: see if this is a "good" page, to decrement that as well.
-       $pages = $dbw->selectField('site_stats', 'ss_total_pages');
-       $pages--;
-       $dbw->update( 'site_stats', 
-                     array('ss_total_pages' => $pages ), 
-                     array( 'ss_row_id' => 1),
-                     __METHOD__ );
        
 }