Added fix script to update the correct tagcount for all posts

This commit is contained in:
BrokenEagle
2017-11-14 15:18:08 -08:00
parent 5f39a8b4b2
commit e312ae3d92
2 changed files with 27 additions and 5 deletions

View File

@@ -0,0 +1,20 @@
#!/usr/bin/env ruby
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'config', 'environment'))
CurrentUser.user = User.system
CurrentUser.ip_addr = "127.0.0.1"
Post.without_timeout do
Post.where("updated_at > ? ", Date.parse("2017-11-12")).find_each do |post|
Post.fix_post_counts(post)
end
end
Tag.without_timeout do
Tag.where(category: Tag.categories.meta).find_each do |tag|
Post.raw_tag_match(tag.name).where("true").find_each do |post|
Post.fix_post_counts(post)
end
end
end