fix for metatag post counts
This commit is contained in:
@@ -570,7 +570,7 @@ class Post < ActiveRecord::Base
|
|||||||
def get_count_from_cache(tags)
|
def get_count_from_cache(tags)
|
||||||
count = Cache.get(count_cache_key(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)
|
count = select_value_sql("SELECT post_count FROM tags WHERE name = ?", tags.to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
class Tag < ActiveRecord::Base
|
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
|
attr_accessible :category
|
||||||
after_save :update_category_cache
|
after_save :update_category_cache
|
||||||
has_one :wiki_page, :foreign_key => "name", :primary_key => "title"
|
has_one :wiki_page, :foreign_key => "name", :primary_key => "title"
|
||||||
@@ -223,7 +224,7 @@ class Tag < ActiveRecord::Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
scan_query(query).each do |token|
|
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
|
case $1
|
||||||
when "-user"
|
when "-user"
|
||||||
q[:uploader_id_neg] ||= []
|
q[:uploader_id_neg] ||= []
|
||||||
|
|||||||
Reference in New Issue
Block a user