Page MenuHomePhabricator

initStats does not refresh active_users count (with patch)
Closed, ResolvedPublic

Description

Author: ppiotr

Description:
site_stats.ss_active_users count is refreshed on each visit to special:statistics page (modulo wgMiserMode switch) - to make it more up to date than the rest of stats (which are refreshed via maintenance/initStats script), presumably. But it is not refreshed by initStats script itself what is strange and what bites sites with premanent/frequent wgMiserMode states.

Patch:

Index: maintenance/initStats.inc

  • maintenance/initStats.inc (revision 9043)

+++ maintenance/initStats.inc (working copy)
@@ -20,8 +20,13 @@

wfOut( "{$pages}\nCounting number of users..." );
 
$users = $dbr->selectField( 'user', 'COUNT(*)', '', __METHOD__ );
  • wfOut( "{$users}\nCounting number of admins..." );

+ wfOut( "{$users}\nCounting number of active users..." );

+ $active_users = $dbr->selectField( 'recentchanges', 'COUNT( DISTINCT rc_user_text )',
+ array( 'rc_user != 0', 'rc_bot' => 0, "rc_log_type != 'newusers' OR rc_log_type IS NULL" ),
+ METHOD );
+ wfOut( "{$active_users}\nCounting number of admins..." );
+

$admin = $dbr->selectField( 'user_groups', 'COUNT(*)', array( 'ug_group' => 'sysop' ), __METHOD__ );
wfOut( "{$admin}\nCounting number of images..." );

@@ -41,6 +46,7 @@

'ss_good_articles' => $good,
'ss_total_pages' => $pages,
'ss_users' => $users,

+ 'ss_active_users' => $active_users,

                                'ss_admins' => $admin,
                                'ss_images' => $image );
$conds = array( 'ss_row_id' => 1 );

Version: unspecified
Severity: enhancement

Details

Reference
bz18930

Related Objects

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:39 PM
bzimport set Reference to bz18930.
bzimport added a subscriber: Unknown Object (MLST).

Should probably call SiteStats::cacheUpdate here rather than duplicating the code.

demon added a comment.Jun 28 2009, 3:33 PM

Fix committed to branch in r52513

demon added a comment.Aug 2 2009, 7:36 PM

Fixed in trunk in r54225.

demon added a comment.Aug 7 2009, 12:10 PM
  • Bug 20105 has been marked as a duplicate of this bug. ***