You are here

function feeds_cron in Feeds 8.2

Same name and namespace in other branches
  1. 8.3 feeds.module \feeds_cron()
  2. 6 feeds.module \feeds_cron()
  3. 7.2 feeds.module \feeds_cron()
  4. 7 feeds.module \feeds_cron()

Implements hook_cron().

Related topics

File

./feeds.module, line 53
Feeds - basic API functions and hook implementations.

Code

function feeds_cron() {
  if ($importers = feeds_reschedule()) {
    if ($importers === TRUE) {
      $sources = db_query("SELECT feed_nid, id FROM {feeds_source}");
    }
    else {
      $sources = db_query("SELECT feed_nid, id FROM {feeds_source} WHERE id IN (:ids)", array(
        ':ids' => $importers,
      ));
    }
    foreach ($sources as $source) {
      feeds_source($source->id, $source->feed_nid)
        ->schedule();
    }
    feeds_reschedule(FALSE);
  }

  // Expire old log entries.
  db_delete('feeds_log')
    ->condition('request_time', REQUEST_TIME - 604800, '<')
    ->execute();
}