Feeds : display last access date for merged feed parsers
This commit is contained in:
parent
3a8c667fdc
commit
9c57ad3ece
|
@ -88,7 +88,10 @@ class IWLADisplayFeeds(IPlugin):
|
||||||
address += ' *'
|
address += ' *'
|
||||||
pages = super_hit['not_viewed_pages'][0] + super_hit['viewed_pages'][0]
|
pages = super_hit['not_viewed_pages'][0] + super_hit['viewed_pages'][0]
|
||||||
hits = super_hit['not_viewed_hits'][0] + super_hit['viewed_hits'][0]
|
hits = super_hit['not_viewed_hits'][0] + super_hit['viewed_hits'][0]
|
||||||
table.appendRow([address, pages, hits, time.asctime(super_hit['last_access'])])
|
last_access = super_hit.get('feed_parser_last_access', None)
|
||||||
|
if not last_access:
|
||||||
|
last_access = super_hit['last_access']
|
||||||
|
table.appendRow([address, pages, hits, time.asctime(last_access)])
|
||||||
page.appendBlock(table)
|
page.appendBlock(table)
|
||||||
note = DisplayHTMLRaw(self.iwla, ('<small>*%s</small>' % (self.iwla._(u'Merged feeds parsers'))))
|
note = DisplayHTMLRaw(self.iwla, ('<small>*%s</small>' % (self.iwla._(u'Merged feeds parsers'))))
|
||||||
page.appendBlock(note)
|
page.appendBlock(note)
|
||||||
|
|
|
@ -30,6 +30,9 @@ Find feeds parsers (first hit in feeds conf value and no viewed pages if it's a
|
||||||
If merge_feeds_parsers is set to True, merge feeds parsers with the same user agent
|
If merge_feeds_parsers is set to True, merge feeds parsers with the same user agent
|
||||||
as it must be the same person with a different IP address.
|
as it must be the same person with a different IP address.
|
||||||
|
|
||||||
|
Warning : When merge_feeds_parsers is activated, last access display date is the more
|
||||||
|
recent date of all merged parsers found
|
||||||
|
|
||||||
Plugin requirements :
|
Plugin requirements :
|
||||||
None
|
None
|
||||||
|
|
||||||
|
@ -101,22 +104,24 @@ class IWLAPostAnalysisFeeds(IPlugin):
|
||||||
if self.merged_feeds.get(key, None) is None:
|
if self.merged_feeds.get(key, None) is None:
|
||||||
# Merged
|
# Merged
|
||||||
self.merged_feeds[key] = hit
|
self.merged_feeds[key] = hit
|
||||||
else:
|
elif hit['remote_ip'] != self.merged_feeds[key]['remote_ip']:
|
||||||
# Next time
|
# Next time
|
||||||
# Current must be ignored
|
# Current must be ignored
|
||||||
hit['feed_parser'] = self.NOT_A_FEED_PARSER
|
hit['feed_parser'] = self.NOT_A_FEED_PARSER
|
||||||
|
last_access = hit['last_access']
|
||||||
# Previous matched hit must be set as merged
|
# Previous matched hit must be set as merged
|
||||||
isFeedParser = self.MERGED_FEED_PARSER
|
isFeedParser = self.MERGED_FEED_PARSER
|
||||||
hit = self.merged_feeds[key]
|
hit = self.merged_feeds[key]
|
||||||
|
if hit['last_access'] < last_access:
|
||||||
|
hit['feed_parser_last_access'] = last_access
|
||||||
|
else:
|
||||||
|
hit['feed_parser_last_access'] = hit['last_access']
|
||||||
hit['feed_parser'] = isFeedParser
|
hit['feed_parser'] = isFeedParser
|
||||||
|
|
||||||
def mergeFeedsParsers(self, isFeedParser, hit):
|
def mergeFeedsParsers(self, isFeedParser, hit):
|
||||||
if isFeedParser:
|
if isFeedParser:
|
||||||
# One hit only match
|
|
||||||
if True or (hit['viewed_hits'][0] + hit['not_viewed_hits'][0]) == 1:
|
|
||||||
for r in self.merge_feeds_parsers_list:
|
for r in self.merge_feeds_parsers_list:
|
||||||
if r.match(hit['remote_addr']) or r.match(hit['remote_ip']):
|
if r.match(hit['remote_addr']) or r.match(hit['remote_ip']):
|
||||||
#print('hit match %s' % (hit['remote_addr']))
|
|
||||||
self._appendToMergeCache(isFeedParser, r, hit)
|
self._appendToMergeCache(isFeedParser, r, hit)
|
||||||
return
|
return
|
||||||
#print("No match for %s : %d" % (hit['remote_addr'], hit['viewed_hits'][0] + hit['not_viewed_hits'][0]))
|
#print("No match for %s : %d" % (hit['remote_addr'], hit['viewed_hits'][0] + hit['not_viewed_hits'][0]))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user