Add conf_requires.
Load plugins in order
This commit is contained in:
@@ -10,6 +10,7 @@ class IWLAPostAnalysisReferers(IPlugin):
|
||||
def __init__(self, iwla):
|
||||
super(IWLAPostAnalysisReferers, self).__init__(iwla)
|
||||
self.API_VERSION = 1
|
||||
self.conf_requires = ['domain_name']
|
||||
|
||||
def _getSearchEngine(self, hashid):
|
||||
for (k, e) in self.search_engines.items():
|
||||
@@ -22,7 +23,7 @@ class IWLAPostAnalysisReferers(IPlugin):
|
||||
domain_name = self.iwla.getConfValue('domain_name', '')
|
||||
|
||||
if not domain_name:
|
||||
print 'domain_name required in conf'
|
||||
print 'domain_name must not be empty !'
|
||||
return False
|
||||
|
||||
self.own_domain_re = re.compile(r'.*%s.*' % (domain_name))
|
||||
|
||||
@@ -4,12 +4,15 @@ from iwla import IWLA
|
||||
from iplugin import IPlugin
|
||||
|
||||
class IWLAPostAnalysisReverseDNS(IPlugin):
|
||||
DEFAULT_DNS_TIMEOUT = 0.5
|
||||
|
||||
def __init__(self, iwla):
|
||||
super(IWLAPostAnalysisReverseDNS, self).__init__(iwla)
|
||||
self.API_VERSION = 1
|
||||
|
||||
def load(self):
|
||||
timeout = self.iwla.getConfValue('reverse_dns_timeout', 0.5)
|
||||
timeout = self.iwla.getConfValue('reverse_dns_timeout',
|
||||
IWLAPostAnalysisReverseDNS.DEFAULT_DNS_TIMEOUT)
|
||||
socket.setdefaulttimeout(timeout)
|
||||
return True
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ class IWLAPreAnalysisPageToHit(IPlugin):
|
||||
def __init__(self, iwla):
|
||||
super(IWLAPreAnalysisPageToHit, self).__init__(iwla)
|
||||
self.API_VERSION = 1
|
||||
self.conf_requires = ['viewed_http_codes']
|
||||
|
||||
def load(self):
|
||||
# Remove logo from indefero
|
||||
@@ -21,7 +22,8 @@ class IWLAPreAnalysisPageToHit(IPlugin):
|
||||
|
||||
def hook(self):
|
||||
hits = self.iwla.getCurrentVisists()
|
||||
viewed_http_codes = self.iwla.getConfValue('viewed_http_codes', [200, 304])
|
||||
viewed_http_codes = self.iwla.getConfValue('viewed_http_codes')
|
||||
|
||||
for (k, super_hit) in hits.items():
|
||||
if super_hit['robot']: continue
|
||||
|
||||
@@ -31,6 +33,7 @@ class IWLAPreAnalysisPageToHit(IPlugin):
|
||||
uri = request['extract_request']['extract_uri']
|
||||
for regexp in self.regexps:
|
||||
if regexp.match(uri):
|
||||
#print '%s is an hit' % uri
|
||||
request['is_page'] = False
|
||||
super_hit['viewed_pages'] -= 1
|
||||
super_hit['viewed_hits'] += 1
|
||||
|
||||
Reference in New Issue
Block a user