You are here

function piwik_cron in Piwik Web Analytics 8

Same name and namespace in other branches
  1. 5 piwik.module \piwik_cron()
  2. 6.2 piwik.module \piwik_cron()
  3. 6 piwik.module \piwik_cron()
  4. 7.2 piwik.module \piwik_cron()
  5. 7 piwik.module \piwik_cron()

Implements hook_cron().

File

./piwik.module, line 437
Drupal Module: Piwik.

Code

function piwik_cron() {
  $config = \Drupal::config('piwik.settings');

  // Regenerate the piwik.js every day.
  if (REQUEST_TIME - \Drupal::state()
    ->get('piwik.last_cache') >= 86400 && $config
    ->get('cache')) {
    _piwik_cache($config
      ->get('url_http') . 'piwik.js', TRUE);
    \Drupal::state()
      ->set('piwik.last_cache', REQUEST_TIME);
  }
}