fixes #1520
This commit is contained in:
18
script/fixes/027_fix_banned_artists.rb
Normal file
18
script/fixes/027_fix_banned_artists.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'config', 'environment'))
|
||||
|
||||
ActiveRecord::Base.connection.execute("set statement_timeout = 0")
|
||||
|
||||
CurrentUser.user = User.admins.first
|
||||
CurrentUser.ip_addr = "127.0.0.1"
|
||||
|
||||
CurrentUser.without_safe_mode do
|
||||
Artist.where(:is_banned => true).find_each do |artist|
|
||||
Post.tag_match(artist.name).where(:is_banned => true, :is_deleted => true).find_each do |post|
|
||||
unless post.post_flags.any?
|
||||
post.undelete!
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user