From 26be011bf4038712b7c65c62637073228229f835 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Fri, 7 Mar 2014 18:10:40 -0800 Subject: [PATCH] fixes #1520 --- script/fixes/027_fix_banned_artists.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 script/fixes/027_fix_banned_artists.rb diff --git a/script/fixes/027_fix_banned_artists.rb b/script/fixes/027_fix_banned_artists.rb new file mode 100644 index 000000000..f7d3363fd --- /dev/null +++ b/script/fixes/027_fix_banned_artists.rb @@ -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