Track account level while tracking active users.

        Patch by pauamma. 

diffs (52 lines):

diff -r 93d4ae733207 -r e740280188dc bin/upgrading/update-db-general.pl
--- a/bin/upgrading/update-db-general.pl        Mon Oct 26 03:56:27 2009 +0000
+++ b/bin/upgrading/update-db-general.pl        Mon Oct 26 04:42:18 2009 +0000
@@ -1518,12 +1518,18 @@ post_create("comminterests",
             });
 
 # tracking where users are active
+# accountlevel is the account level at time of activity
+# (may be NULL for transition period or long-term inactive
+# accounts that were active earlier - but not all inactive accounts will be in
+# there, so we won't be looking here for their account levels anyway, so this
+# shouldn't be a problem)
 register_tablecreate("clustertrack2", <<'EOC'); # clustered
 CREATE TABLE clustertrack2 (
     userid INT UNSIGNED NOT NULL,
     PRIMARY KEY (userid),
     timeactive INT UNSIGNED NOT NULL,
     clusterid SMALLINT UNSIGNED,
+    accountlevel SMALLINT UNSIGNED,
 
     INDEX (timeactive, clusterid)
 )
@@ -3818,6 +3824,12 @@ EOF
         set_dbnote( "logkwsum_fix_filtered_counts", 1 );
     }
 
+    unless ( column_type( 'clustertrack2', 'accountlevel' ) ) {
+        do_alter( 'clustertrack2',
+                  q{ALTER TABLE clustertrack2 ADD COLUMN accountlevel SMALLINT 
UNSIGNED AFTER clusterid} );
+    }
+
+
 });
 
 
diff -r 93d4ae733207 -r e740280188dc cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm        Mon Oct 26 03:56:27 2009 +0000
+++ b/cgi-bin/LJ/User.pm        Mon Oct 26 04:42:18 2009 +0000
@@ -5946,9 +5946,10 @@ sub mark_user_active {
 
         return 0 unless $u->writer;
         my $active = time();
-        $u->do("REPLACE INTO clustertrack2 SET ".
-               "userid=?, timeactive=?, clusterid=?", undef,
-               $uid, $active, $u->clusterid) or return 0;
+        $u->do( "REPLACE INTO clustertrack2 SET ".
+                "userid=?, timeactive=?, clusterid=?, accountlevel=?", undef,
+                $uid, $active, $u->clusterid, 
DW::Pay::get_current_account_status( $uid ) ) or return 0;
+
         my $memkey = [$u->userid, "timeactive:" . $u->userid];
         LJ::MemCache::set($memkey, $active, 86400);
     }
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog

Reply via email to