Faster unique form sort

git-svn-id: file:///home/svn/framework3/trunk@10532 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2010-10-03 03:34:58 +00:00
parent 555f6840fa
commit 6a06a95f2f
1 changed files with 7 additions and 7 deletions

View File

@ -65,13 +65,13 @@ class Workspace < ActiveRecord::Base
web_sites.map{|w| w.web_vulns}.flatten
end
def web_unique_forms
cache = {}
web_forms.each do |form|
ckey = [ form.web_site.id, form.path, form.method, form.query].join("|")
cache[ckey] = form
end
cache.values
def web_unique_forms(addrs=nil)
xhosts = addrs ? hosts.select{|host| addrs.include?(host.address) } : hosts
xhosts.map { |host|
host.web_sites.map{|site|
site.web_forms.find(:all, :select => 'DISTINCT web_site_id, path, method, query')
}
}.flatten
end
end