From c43b92ece5ae037a804a539d2a50c10bd4ce02c1 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Tue, 20 Jun 2006 14:03:58 +0000 Subject: [PATCH] Update site_stats.ss_users after deleting unused accounts, to keep the internal statistics tables consistent --- maintenance/removeUnusedAccounts.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/maintenance/removeUnusedAccounts.php b/maintenance/removeUnusedAccounts.php index 17ea09fc30..33b9a0c1ba 100644 --- a/maintenance/removeUnusedAccounts.php +++ b/maintenance/removeUnusedAccounts.php @@ -44,9 +44,11 @@ echo( "...found {$count}.\n" ); if( $count > 0 && isset( $options['delete'] ) ) { echo( "\nDeleting inactive accounts..." ); $dbw =& wfGetDB( DB_MASTER ); - #$set = implode( ',', $del ); $dbw->delete( 'user', array( 'user_id' => $del ), $fname ); echo( "done.\n" ); + # Update the site_stats.ss_users field + $users = $dbw->selectField( 'user', 'COUNT(*)', array(), $fname ); + $dbw->update( 'site_stats', array( 'ss_users' => $users ), array( 'ss_row_id' => 1 ), $fname ); } else { if( $count > 0 ) echo( "\nRun the script again with --delete to remove them from the database.\n" ); -- 2.20.1