bad count for Active Users, query compares to a NULL field and fails for many users
Closed, ResolvedPublic

Description

The active user count is done in SiteStats.php, the query is

$activeUsers = $dbr->selectField( 'recentchanges', 'COUNT( DISTINCT rc_user_text )',
        array( 'rc_user != 0', 'rc_bot' => 0, "rc_log_type != 'newusers'" ),
        __METHOD__ );

I saw that it showed 6 users, and I could count more than that myself in RC, so I went to the toolserver to check it out.

mysql> select rc_user_text, rc_title, rc_log_type, rc_user, rc_bot from recentchanges where rc_title='πορτραίτο';

FrancostasπορτραίτοNULL8010

there you can see that rc_log_type = NULL

mysql> select DISTINCT rc_user_text from recentchanges where rc_user != 0 and rc_bot=0 and rc_log_type != 'newusers';
Francostas is not in the list, only 6 users are returned

mysql> select DISTINCT rc_user_text from recentchanges where rc_user != 0 and rc_bot=0;
this does return his name.

this is because...
mysql> select NULL != 'newuser';

NULL

Maybe the rc_log_type should be an empty string?


Version: unspecified
Severity: enhancement
URL: http://el.wiktionary.org/wiki/Ειδικό:Statistics

bzimport added a subscriber: Unknown Object (MLST).
bzimport set Reference to bz15682.
ArielGlenn created this task.Via LegacySep 21 2008, 10:50 PM
aaron added a comment.Via ConduitSep 21 2008, 10:57 PM

Query fixed for this in r41137

Add Comment