addresses #2171: daily maintenance task to clean up negative post count tags
This commit is contained in:
@@ -15,5 +15,6 @@ class DailyMaintenance
|
||||
ForumSubscription.process_all!
|
||||
TagAlias.update_cached_post_counts_for_all
|
||||
PostDisapproval.dmail_messages!
|
||||
Tag.clean_up_negative_post_counts!
|
||||
end
|
||||
end
|
||||
|
||||
@@ -57,6 +57,12 @@ class Tag < ActiveRecord::Base
|
||||
Tag.where(:name => tag_names).update_all("post_count = post_count - 1")
|
||||
Post.expire_cache_for_all(tag_names)
|
||||
end
|
||||
|
||||
def clean_up_negative_post_counts!
|
||||
Tag.where("post_count < 0").find_each do |tag|
|
||||
tag.fix_post_count
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def real_post_count
|
||||
|
||||
Reference in New Issue
Block a user