bug fixes
This commit is contained in:
@@ -10,6 +10,7 @@ class TagAliasCorrectionsController < ApplicationController
|
|||||||
|
|
||||||
if params[:commit] == "Fix"
|
if params[:commit] == "Fix"
|
||||||
@correction.fix!
|
@correction.fix!
|
||||||
|
flash[:notice] = "The fix has been queued and will be processed"
|
||||||
end
|
end
|
||||||
|
|
||||||
redirect_to tag_alias_correction_path(:id => params[:tag_alias_id])
|
redirect_to tag_alias_correction_path(:id => params[:tag_alias_id])
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ class AnonymousUser
|
|||||||
0
|
0
|
||||||
end
|
end
|
||||||
|
|
||||||
%w(member banned privileged platinum contributor janitor moderator admin).each do |name|
|
%w(member banned privileged builder platinum contributor janitor moderator admin).each do |name|
|
||||||
define_method("is_#{name}?") do
|
define_method("is_#{name}?") do
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -46,13 +46,13 @@ class TagAliasCorrection
|
|||||||
end
|
end
|
||||||
|
|
||||||
def clear_cache
|
def clear_cache
|
||||||
tag_alias.clear_cache
|
tag_alias.clear_all_cache
|
||||||
end
|
end
|
||||||
|
|
||||||
def fix!
|
def fix!
|
||||||
clear_cache
|
clear_cache
|
||||||
tag_alias.update_cache
|
tag_alias.update_cache
|
||||||
tag_alias.update_posts
|
tag_alias.delay.update_posts
|
||||||
tag_alias.antecedent_tag.fix_post_count if tag_alias.antecedent_tag
|
tag_alias.antecedent_tag.fix_post_count if tag_alias.antecedent_tag
|
||||||
tag_alias.consequent_tag.fix_post_count if tag_alias.consequent_tag
|
tag_alias.consequent_tag.fix_post_count if tag_alias.consequent_tag
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -97,11 +97,11 @@ class TagAlias < ActiveRecord::Base
|
|||||||
|
|
||||||
def clear_all_cache
|
def clear_all_cache
|
||||||
Danbooru.config.all_server_hosts.each do |host|
|
Danbooru.config.all_server_hosts.each do |host|
|
||||||
delay(:queue => host).clear_cache(host)
|
delay(:queue => host).clear_cache
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def clear_cache(host = Socket.gethostname)
|
def clear_cache
|
||||||
Cache.delete("ta:#{Cache.sanitize(antecedent_name)}")
|
Cache.delete("ta:#{Cache.sanitize(antecedent_name)}")
|
||||||
Cache.delete("ta:#{Cache.sanitize(consequent_name)}")
|
Cache.delete("ta:#{Cache.sanitize(consequent_name)}")
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
<h1>Tag Alias Correction: <%= @correction.antecedent_name %> -> <%= @correction.consequent_name %></h1>
|
<h1>Tag Alias Correction: <%= @correction.antecedent_name %> -> <%= @correction.consequent_name %></h1>
|
||||||
|
|
||||||
<p>Because tag aliases are cached in memory, they may go out of sync. This action will clear out the cache and fix and lingering posts.</p>
|
<p>Because tag aliases are cached in memory, they may go out of sync. This action will clear out the cache and fix any lingering posts.</p>
|
||||||
|
|
||||||
<% @correction.each_server do |correction| %>
|
<% @correction.each_server do |server| %>
|
||||||
<div style="margin-bottom: 1em;">
|
<div style="margin-bottom: 1em;">
|
||||||
<h2>Server: <%= Socket.gethostname %></h2>
|
<h2>Server: <%= server.hostname %></h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li><strong><%= @correction.antecedent_name %></strong> aliased to <strong><%= @correction.statistics_hash["antecedent_cache"] %></strong> in cache</li>
|
<li><strong><%= server.antecedent_name %></strong> aliased to <strong><%= server.statistics_hash["antecedent_cache"] %></strong> in cache</li>
|
||||||
<li><strong><%= @correction.consequent_name %></strong> aliased to <strong><%= @correction.statistics_hash["consequent_cache"] %></strong> in cache</li>
|
<li><strong><%= server.consequent_name %></strong> aliased to <strong><%= server.statistics_hash["consequent_cache"] %></strong> in cache</li>
|
||||||
<li><strong><%= @correction.antecedent_name %></strong> count is <%= @correction.statistics_hash["antecedent_count"] %></li>
|
<li><strong><%= server.antecedent_name %></strong> count is <%= server.statistics_hash["antecedent_count"] %></li>
|
||||||
<li><strong><%= @correction.consequent_name %></strong> count is <%= @correction.statistics_hash["consequent_count"] %></li>
|
<li><strong><%= server.consequent_name %></strong> count is <%= server.statistics_hash["consequent_count"] %></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
Reference in New Issue
Block a user