Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorJohn Kelly <wablam@gmail.com>2014-09-17 01:22:19 +0400
committerJohn Kelly <wablam@gmail.com>2014-09-17 01:22:19 +0400
commitd9ab93fe9874bb023bdda101f5c4a4f4426ef172 (patch)
treeed71cb5961e9640a3d03697fbbc7d06873f875ad /misc
parentd0b552798f4f770dc58c963c6b780a381b7bafe4 (diff)
Add the ability to override the default download extensions.
Diffstat (limited to 'misc')
-rwxr-xr-xmisc/log-analytics/import_logs.py11
-rw-r--r--misc/log-analytics/tests/tests.py1
2 files changed, 11 insertions, 1 deletions
diff --git a/misc/log-analytics/import_logs.py b/misc/log-analytics/import_logs.py
index a339605acc..09d8b4e969 100755
--- a/misc/log-analytics/import_logs.py
+++ b/misc/log-analytics/import_logs.py
@@ -481,6 +481,10 @@ class Configuration(object):
'--enable-testmode', dest='enable_testmode', default=False, action='store_true',
help="If set, it will try to get the token_auth from the piwik_tests directory"
)
+ option_parser.add_option(
+ '--download-extensions', dest='download_extensions', default=None,
+ help="If set (format: pdf,doc,...), this list will be used to determine what file extensions should be tracked as a download, otherwise the default list will be used."
+ )
return option_parser
def _parse_args(self, option_parser):
@@ -550,6 +554,11 @@ class Configuration(object):
if self.options.recorders < 1:
self.options.recorders = 1
+ if self.options.download_extensions:
+ self.options.download_extensions = set(self.options.download_extensions.split(','))
+ else:
+ self.options.download_extensions = DOWNLOAD_EXTENSIONS
+
def __init__(self):
self._parse_args(self._create_parser())
@@ -1373,7 +1382,7 @@ class Parser(object):
return True
def check_download(self, hit):
- if hit.extension in DOWNLOAD_EXTENSIONS:
+ if hit.extension in config.options.download_extensions:
stats.count_lines_downloads.increment()
hit.is_download = True
return True
diff --git a/misc/log-analytics/tests/tests.py b/misc/log-analytics/tests/tests.py
index 163c100d3a..37af5eee8f 100644
--- a/misc/log-analytics/tests/tests.py
+++ b/misc/log-analytics/tests/tests.py
@@ -63,6 +63,7 @@ class Options(object):
force_lowercase_path = False
included_paths = []
enable_http_errors = False
+ download_extensions = 'doc,pdf'
class Config(object):
"""Mock configuration."""