This commit is contained in:
Toks
2013-07-31 19:57:15 -04:00
2 changed files with 20 additions and 16 deletions

View File

@@ -127,6 +127,7 @@ class TagAlias < ActiveRecord::Base
def update_posts def update_posts
CurrentUser.without_safe_mode do CurrentUser.without_safe_mode do
Post.without_timeout do
Post.raw_tag_match(antecedent_name).find_each do |post| Post.raw_tag_match(antecedent_name).find_each do |post|
escaped_antecedent_name = Regexp.escape(antecedent_name) escaped_antecedent_name = Regexp.escape(antecedent_name)
fixed_tags = post.tag_string.sub(/(?:\A| )#{escaped_antecedent_name}(?:\Z| )/, " #{consequent_name} ").strip fixed_tags = post.tag_string.sub(/(?:\A| )#{escaped_antecedent_name}(?:\Z| )/, " #{consequent_name} ").strip
@@ -141,6 +142,7 @@ class TagAlias < ActiveRecord::Base
consequent_tag.fix_post_count if consequent_tag consequent_tag.fix_post_count if consequent_tag
end end
end end
end
def rename_wiki_and_artist def rename_wiki_and_artist
antecedent_wiki = WikiPage.titled(antecedent_name).first antecedent_wiki = WikiPage.titled(antecedent_name).first

View File

@@ -127,6 +127,7 @@ class TagImplication < ActiveRecord::Base
def update_posts def update_posts
CurrentUser.without_safe_mode do CurrentUser.without_safe_mode do
Post.without_timeout do
Post.raw_tag_match(antecedent_name).find_each do |post| Post.raw_tag_match(antecedent_name).find_each do |post|
fixed_tags = "#{post.tag_string} #{descendant_names}".strip fixed_tags = "#{post.tag_string} #{descendant_names}".strip
CurrentUser.scoped(creator, creator_ip_addr) do CurrentUser.scoped(creator, creator_ip_addr) do
@@ -137,6 +138,7 @@ class TagImplication < ActiveRecord::Base
end end
end end
end end
end
def normalize_names def normalize_names
self.antecedent_name = antecedent_name.downcase.tr(" ", "_") self.antecedent_name = antecedent_name.downcase.tr(" ", "_")