aaron@svn.wikimedia.org wrote:
Added: trunk/phase3/maintenance/archives/patch-ss_active_users.sql
--- trunk/phase3/maintenance/archives/patch-ss_active_users.sql (rev 0) +++ trunk/phase3/maintenance/archives/patch-ss_active_users.sql 2008-08-31 19:29:37 UTC (rev 40279) @@ -0,0 +1,6 @@ +-- More statistics, for version 1.14
+ALTER TABLE /*$wgDBprefix*/site_stats ADD ss_active_users bigint default '-1'; +SELECT @activeusers := COUNT( DISTINCT rc_user_text ) FROM /*$wgDBprefix*/recentchanges +WHERE rc_user != 0 AND rc_bot = 0 AND rc_log_type != 'newusers'; +UPDATE /*$wgDBprefix*/site_stats SET ss_active_users=@activeusers;
User variables are not replication-safe, and should be avoided. It's better to use a custom function in updaters.inc, and a schema-only patch. Yes, I know I used a user variable too, back in 2006 for ss_images, but I was young and naive.
-- Tim Starling