m7v
3/28/2014 - 12:54 AM

Hook_cron

Hook_cron

/**
 * Implements hook_cron().
 */
function spaint_cache_cron() {
  // Set interval for run cron. Default value is 1 day.
  $interval = variable_get('spaint_cache_cron_interval', 86400);
  if (time() >= variable_get('spaint_cache_cron_next_execution', 0)) {
    spaint_cache_set_data_about_user_tracks();
    watchdog('success', t('Cache set for user\'s count tracks is successful'));
    spaint_cache_set_data_about_user_votes();
    watchdog('success', t('Cache set for user\'s votes is successful'));
    spaint_cache_set_data_about_tracks_votes();
    watchdog('success', t('Cache set for track\'s votes is successful'));

    // Set interval for the next run cron.
    variable_set('spaint_cache_cron_execution', time() + $interval);
  }
}