diff options
author | Matthieu Napoli <matthieu@mnapoli.fr> | 2014-11-27 03:56:56 +0300 |
---|---|---|
committer | Matthieu Napoli <matthieu@mnapoli.fr> | 2014-11-27 03:56:56 +0300 |
commit | 0c80a9be897972650d3e176943c0c63fcddcd6ca (patch) | |
tree | 7115929216c7969ff167cb5deb17777bb02aa7f2 /misc | |
parent | 9ea42bb907d9ddbb1ca7e0868e34b3a46de1973e (diff) | |
parent | 7bab10fc9dd46037e39e5cbb3dcca2b420528051 (diff) |
Merge branch 'di-config' into tmp-path
Conflicts:
tests/PHPUnit/Integration/LogTest.php
Diffstat (limited to 'misc')
-rwxr-xr-x | misc/log-analytics/import_logs.py | 13 | ||||
-rw-r--r-- | misc/others/api_rest_call.php | 4 | ||||
-rwxr-xr-x | misc/others/geoipUpdateRows.php | 4 |
3 files changed, 16 insertions, 5 deletions
diff --git a/misc/log-analytics/import_logs.py b/misc/log-analytics/import_logs.py index 90a7f4f709..6674e2f2fa 100755 --- a/misc/log-analytics/import_logs.py +++ b/misc/log-analytics/import_logs.py @@ -1162,7 +1162,7 @@ class Recorder(object): # We have to do this so visits from the same IP will be added in the right order. hits_by_client = [[] for r in cls.recorders] for hit in all_hits: - hits_by_client[abs(hash(hit.ip)) % len(cls.recorders)].append(hit) + hits_by_client[hit.get_visitor_id_hash() % len(cls.recorders)].append(hit) for i, recorder in enumerate(cls.recorders): recorder.queue.put(hits_by_client[i]) @@ -1351,6 +1351,17 @@ class Hit(object): if config.options.force_lowercase_path: self.full_path = self.full_path.lower() + def get_visitor_id_hash(self): + visitor_id = self.ip + + if config.options.replay_tracking: + for param_name_to_use in ['uid', 'cid', '_id', 'cip']: + if param_name_to_use in self.args: + visitor_id = self.args[param_name_to_use] + break + + return abs(hash(visitor_id)) + class Parser(object): """ The Parser parses the lines in a specified file and inserts them into diff --git a/misc/others/api_rest_call.php b/misc/others/api_rest_call.php index c85d5c193e..67c3f9e4ba 100644 --- a/misc/others/api_rest_call.php +++ b/misc/others/api_rest_call.php @@ -20,11 +20,11 @@ if (!$content) { print("Error, content fetched = " . $fetched); } -print("<h1>Keywords for the last month</h1>"); +print("<h1>Keywords for the last month</h1>\n"); foreach ($content as $row) { $keyword = htmlspecialchars(html_entity_decode(urldecode($row['label']), ENT_QUOTES), ENT_QUOTES); $hits = $row['nb_visits']; - print("<b>$keyword</b> ($hits hits)<br>"); + print("<b>$keyword</b> ($hits hits)<br>\n"); } diff --git a/misc/others/geoipUpdateRows.php b/misc/others/geoipUpdateRows.php index 5f36ed5e7d..09ae69d3d4 100755 --- a/misc/others/geoipUpdateRows.php +++ b/misc/others/geoipUpdateRows.php @@ -10,7 +10,7 @@ use Piwik\Plugins\UserCountry\LocationProvider\GeoIp\Php; require_once './cli-script-bootstrap.php'; -ini_set("memory_limit", "512M"); +@ini_set("memory_limit", "512M"); $query = "SELECT count(*) FROM " . Common::prefixTable('log_visit'); $count = Db::fetchOne($query); @@ -87,7 +87,7 @@ if (!Common::isPhpCliMode()) { function geoipUpdateError($message) { Log::error($message); - Common::sendHeader('HTTP/1.1 500 Internal Server Error', $replace = true, $responseCode = 500); + Common::sendResponseCode(500); exit; } |