function announcements_feed_cron
Same name in other branches
- 10 core/modules/announcements_feed/announcements_feed.module \announcements_feed_cron()
- 7.x modules/announcements_feed/announcements_feed.module \announcements_feed_cron()
Implements hook_cron().
File
-
core/
modules/ announcements_feed/ announcements_feed.module, line 114
Code
function announcements_feed_cron() {
$config = \Drupal::config('announcements_feed.settings');
$interval = $config->get('cron_interval');
$last_check = \Drupal::state()->get('announcements_feed.last_fetch', 0);
$time = \Drupal::time()->getRequestTime();
if ($time - $last_check > $interval) {
\Drupal::service('announcements_feed.fetcher')->fetch(TRUE);
\Drupal::state()->set('announcements_feed.last_fetch', $time);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.