diff options
Diffstat (limited to 'modules-available/statistics_reporting/hooks')
-rw-r--r-- | modules-available/statistics_reporting/hooks/cron.inc.php | 23 | ||||
-rw-r--r-- | modules-available/statistics_reporting/hooks/main-warning.inc.php | 5 |
2 files changed, 28 insertions, 0 deletions
diff --git a/modules-available/statistics_reporting/hooks/cron.inc.php b/modules-available/statistics_reporting/hooks/cron.inc.php new file mode 100644 index 00000000..a48f74c2 --- /dev/null +++ b/modules-available/statistics_reporting/hooks/cron.inc.php @@ -0,0 +1,23 @@ +<?php + +if (RemoteReport::isReportingEnabled()) { + $nextReporting = RemoteReport::getReportingTimestamp(); + + // It's time to generate a new report + if ($nextReporting <= time()) { + RemoteReport::writeNextReportingTimestamp(); + + $from = strtotime("-7 days", $nextReporting); + $to = $nextReporting; + + $statisticsReport = json_encode(RemoteReport::generateReport($from, $to)); + + $params = array("action" => "statistics", "data" => $statisticsReport); + + $result = Download::asStringPost(CONFIG_REPORTING_URL, $params, 30, $code); + + if ($code != 200) { + EventLog::warning("Statistics Reporting failed: " . $code, $result); + } + } +}
\ No newline at end of file diff --git a/modules-available/statistics_reporting/hooks/main-warning.inc.php b/modules-available/statistics_reporting/hooks/main-warning.inc.php new file mode 100644 index 00000000..33381c9f --- /dev/null +++ b/modules-available/statistics_reporting/hooks/main-warning.inc.php @@ -0,0 +1,5 @@ +<?php + +if (!RemoteReport::isReportingEnabled()) { + Message::addInfo('statistics_reporting.remote-report-disabled', true); +} |