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!
|
ForumSubscription.process_all!
|
||||||
TagAlias.update_cached_post_counts_for_all
|
TagAlias.update_cached_post_counts_for_all
|
||||||
PostDisapproval.dmail_messages!
|
PostDisapproval.dmail_messages!
|
||||||
|
Tag.clean_up_negative_post_counts!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -57,6 +57,12 @@ class Tag < ActiveRecord::Base
|
|||||||
Tag.where(:name => tag_names).update_all("post_count = post_count - 1")
|
Tag.where(:name => tag_names).update_all("post_count = post_count - 1")
|
||||||
Post.expire_cache_for_all(tag_names)
|
Post.expire_cache_for_all(tag_names)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def clean_up_negative_post_counts!
|
||||||
|
Tag.where("post_count < 0").find_each do |tag|
|
||||||
|
tag.fix_post_count
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def real_post_count
|
def real_post_count
|
||||||
|
|||||||
Reference in New Issue
Block a user