diff options
author | Udo Walter | 2017-01-17 14:24:41 +0100 |
---|---|---|
committer | Udo Walter | 2017-01-17 14:24:41 +0100 |
commit | 6e9d2635c9fe69923a4c30cb99ab6938bfbffe27 (patch) | |
tree | 66e24f6207169ae8dc6a6b572efc78db959e464e /modules-available/statistics_reporting/hooks/cron.inc.php | |
parent | [statistics_reporting] added vm name anonymization (diff) | |
download | slx-admin-6e9d2635c9fe69923a4c30cb99ab6938bfbffe27.tar.gz slx-admin-6e9d2635c9fe69923a4c30cb99ab6938bfbffe27.tar.xz slx-admin-6e9d2635c9fe69923a4c30cb99ab6938bfbffe27.zip |
[statistics_reporting] improved anonymization
Diffstat (limited to 'modules-available/statistics_reporting/hooks/cron.inc.php')
-rw-r--r-- | modules-available/statistics_reporting/hooks/cron.inc.php | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/modules-available/statistics_reporting/hooks/cron.inc.php b/modules-available/statistics_reporting/hooks/cron.inc.php index 9b32bc96..bd427e64 100644 --- a/modules-available/statistics_reporting/hooks/cron.inc.php +++ b/modules-available/statistics_reporting/hooks/cron.inc.php @@ -9,8 +9,9 @@ if ($nextReporting < $time && $allowReport) { Property::set("nextReporting", strtotime("Sunday 23:59:59")); - GetData::$from = strtotime("Monday last week"); - GetData::$to = strtotime("Sunday last week 23:59:59"); + GetData::$from = strtotime("last sunday - 6 days"); + GetData::$to = strtotime("last sunday 23:59:59"); + GetData::$salt = bin2hex(random_bytes(20)); $data = array_merge(GetData::total(true), array('perLocation' => array(), 'perClient' => array(), 'perUser' => array(), 'perVM' => array())); $data['perLocation'] = GetData::perLocation(true); @@ -21,15 +22,11 @@ if ($nextReporting < $time && $allowReport) { $statisticsReport = json_encode($data); - $url = CONFIG_REPORTING_URL; + $params = array("action" => "statistics", "data" => $statisticsReport); - $curl = curl_init($url); - curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); - curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-type: application/json")); - curl_setopt($curl, CURLOPT_POST, true); - curl_setopt($curl, CURLOPT_POSTFIELDS, $statisticsReport); + Download::asStringPost(CONFIG_REPORTING_URL, $params, 300, $code); - $json_response = curl_exec($curl); - - curl_close($curl); + if ($code != 200) { + EventLog::warning("Statistics Reporting: ".$code); + } } |