summaryrefslogtreecommitdiff
path: root/lib/Multi/Maintenance.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2019-12-19 15:18:41 +0100
committerYorhel <git@yorhel.nl>2019-12-19 15:18:44 +0100
commit87b1d640145d31dfb3c05ec947c8e796854c04cf (patch)
tree025c2336c0db73d07572552e61c1af28255fef84 /lib/Multi/Maintenance.pm
parente6f20ed931640c1b889ed0d514f4f3adad874c43 (diff)
ulist: Update user list with vnlist/votes/wishlist stats
This adds the users.c_vns and c_wish columns and a function to update the cache. Unlike my previous cache update approaches, I did not use SQL triggers here, as that seemed more complex and less efficient than updating the cache manually. That's not to say that I'm happy with the current approach, but meh... The cache update function is not automatically run for all users, but that could be added to Multi::Maintenance if it turns out that the cached values will not be updated properly in some cases.
Diffstat (limited to 'lib/Multi/Maintenance.pm')
-rw-r--r--lib/Multi/Maintenance.pm27
1 files changed, 0 insertions, 27 deletions
diff --git a/lib/Multi/Maintenance.pm b/lib/Multi/Maintenance.pm
index 846abcd0..abed87a6 100644
--- a/lib/Multi/Maintenance.pm
+++ b/lib/Multi/Maintenance.pm
@@ -204,30 +204,3 @@ sub vnsearch_update { # id, res, time
1;
-
-__END__
-
-# Shouldn't really be necessary, except c_changes could be slightly off when
-# hiding/unhiding DB items.
-# This query takes almost two hours to complete and tends to bring the entire
-# site down with it, so it's been disabled for now. Can be performed in
-# ranges though.
-UPDATE users SET
- c_votes = COALESCE(
- (SELECT COUNT(vid)
- FROM votes
- WHERE uid = users.id
- GROUP BY uid
- ), 0),
- c_changes = COALESCE(
- (SELECT COUNT(id)
- FROM changes
- WHERE requester = users.id
- GROUP BY requester
- ), 0),
- c_tags = COALESCE(
- (SELECT COUNT(tag)
- FROM tags_vn
- WHERE uid = users.id
- GROUP BY uid
- ), 0)