From 731a67944c38b75a0b1a99c9193870a44df980b3 Mon Sep 17 00:00:00 2001 From: albert Date: Tue, 9 Apr 2013 15:14:24 -0400 Subject: [PATCH] fix for #1239 --- config/danbooru_default_config.rb | 2 +- script/fixes/012.rb | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/config/danbooru_default_config.rb b/config/danbooru_default_config.rb index 2a9027456..540cb94f7 100644 --- a/config/danbooru_default_config.rb +++ b/config/danbooru_default_config.rb @@ -4,7 +4,7 @@ module Danbooru class Configuration # The version of this Danbooru. def version - "2.2.1" + "2.2.3" end # The name of this Danbooru. diff --git a/script/fixes/012.rb b/script/fixes/012.rb index 9d6d00f2b..64f479eb2 100644 --- a/script/fixes/012.rb +++ b/script/fixes/012.rb @@ -5,9 +5,19 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'config', ActiveRecord::Base.connection.execute("set statement_timeout = 0") Post.where("is_deleted = true").find_each do |post| - parent_id = ActiveRecord::Base.connection.select_value("select parent_id from post_versions where post_id = #{post.id} and parent_id is not null order by updated_at desc limit 1") + parent_id = ActiveRecord::Base.connection.select_value("select parent_id from post_versions where post_id = #{post.id} order by updated_at desc limit 1") if parent_id post.update_column(:parent_id, parent_id) ActiveRecord::Base.connection.execute("update posts set has_children = true where id = #{parent_id}") end end + +Post.raw_tag_match("transparent_background").find_each do |post| + upload = Upload.new + upload.file_ext = post.file_ext + upload.image_width = post.image_width + upload.image_height = post.image_height + upload.md5 = post.md5 + upload.generate_resizes(post.file_path) + post.distribute_files +end