Update site_stats.ss_users after deleting unused accounts, to keep the internal stati...
authorRob Church <robchurch@users.mediawiki.org>
Tue, 20 Jun 2006 14:03:58 +0000 (14:03 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Tue, 20 Jun 2006 14:03:58 +0000 (14:03 +0000)
maintenance/removeUnusedAccounts.php

index 17ea09f..33b9a0c 100644 (file)
@@ -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" );