You are here

function easychart_cron in Easychart 7.3

Same name and namespace in other branches
  1. 8.3 easychart.module \easychart_cron()

Implements hook_cron().

File

./easychart.module, line 462
Easychart module file.

Code

function easychart_cron() {

  // We don't want to act every time cron runs (which could be every
  // minute) so keep a time for the next run in a variable.
  $interval = variable_get('easychart_url_update_frequency', 60 * 60 * 1);
  if (!empty($interval) && REQUEST_TIME >= variable_get('easychart_cron_next_execution', 0)) {

    // Update the data from Easychart fields that use an external url.
    module_load_include('inc', 'easychart', 'easychart.helpers');
    _easychart_update_csv_from_url();

    // Set the next execution time.
    variable_set('easychart_cron_next_execution', REQUEST_TIME + $interval);
  }
}