fix for metatag post counts

This commit is contained in:
albert
2013-02-19 12:57:41 -05:00
parent a63816f78c
commit dbb0808eaf
2 changed files with 3 additions and 2 deletions

View File

@@ -570,7 +570,7 @@ class Post < ActiveRecord::Base
def get_count_from_cache(tags)
count = Cache.get(count_cache_key(tags))
if count.nil?
if count.nil? && tags.to_s !~ /^(?:#{Tag::METATAGS}):/
count = select_value_sql("SELECT post_count FROM tags WHERE name = ?", tags.to_s)
end

View File

@@ -1,4 +1,5 @@
class Tag < ActiveRecord::Base
METATAGS = "-user|user|-approver|approver|-pool|pool|-fav|fav|sub|md5|-rating|rating|width|height|mpixels|score|filesize|source|id|date|order|status|tagcount|gentags|arttags|chartags|copytags|parent"
attr_accessible :category
after_save :update_category_cache
has_one :wiki_page, :foreign_key => "name", :primary_key => "title"
@@ -223,7 +224,7 @@ class Tag < ActiveRecord::Base
}
scan_query(query).each do |token|
if token =~ /\A(-user|user|-approver|approver|-pool|pool|-fav|fav|sub|md5|-rating|rating|width|height|mpixels|score|filesize|source|id|date|order|status|tagcount|gentags|arttags|chartags|copytags|parent):(.+)\Z/
if token =~ /\A(#{METATAGS}):(.+)\Z/
case $1
when "-user"
q[:uploader_id_neg] ||= []