/usr/share/pyshared/MoinMoin/macro/Hits.py is in python-moinmoin 1.9.3-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | # -*- coding: iso-8859-1 -*-
"""
MoinMoin - Hits Macro
This macro is used to show the cumulative hits of the wikipage where the Macro is called from.
Optionally you could count how much this page or all pages were changed or viewed.
<<Hits([all=(0,1)],[event_type=(VIEWPAGE,SAVEPAGE)>>
all: if set to 1/True/yes then cumulative hits over all wiki pages is returned.
Default is 0/False/no.
filter: if set to SAVEPAGE then the saved pages are counted. Default is VIEWPAGE.
@copyright: 2004-2008 MoinMoin:ReimarBauer,
2005 BenjaminVrolijk
@license: GNU GPL, see COPYING for details.
"""
Dependencies = ['time'] # do not cache
from MoinMoin.stats import hitcounts
def macro_Hits(macro, all=False, event_type=(u'VIEWPAGE', u'SAVEPAGE')):
request = macro.request
pagename = macro.formatter.page.page_name
if all:
cache_days, cache_views, cache_edits = hitcounts.get_data(pagename, request, filterpage=None)
else:
cache_days, cache_views, cache_edits = hitcounts.get_data(pagename, request, filterpage=pagename)
if event_type == u'VIEWPAGE':
return u'%d' % sum(cache_views)
else:
return u'%d' % sum(cache_edits)
|