You are here

function easychart_cron in Easychart 8.3

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

Implements hook_cron().

File

./easychart.module, line 30
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 state..
  $interval = \Drupal::config('easychart.settings')
    ->get('url_update_frequency');
  $next_execution = \Drupal::state()
    ->get('easychart_cron_next_execution', 0);
  if (!empty($interval) && REQUEST_TIME >= $next_execution) {
    EasychartUpdate::updateCSVFromUrl();
    \Drupal::state()
      ->set('easychart_cron_next_execution', REQUEST_TIME + $interval);
  }
}