1.20.x telemetry.module | telemetry_cron() |
Implements hook_cron().
File
- modules/
telemetry/ telemetry.module, line 102 - Collects usage information to help improve Backdrop CMS.
Code
function telemetry_cron() {
$last_run = state_get('telemetry_cron');
$interval = 86400; // One day in seconds.
if (REQUEST_TIME - $last_run > $interval) {
$telemetry_data = telemetry_get_data();
$destination_url = config_get('telemetry.settings', 'destination');
$response = backdrop_http_request($destination_url, array(
'method' => 'POST',
'data' => backdrop_json_encode($telemetry_data),
'headers' => array(
'Content-Type' => 'application/json',
'X-Site-Key' => _telemetry_site_key(),
),
));
}
}