You are here

public function FeedsSource::schedule in Feeds 7

Same name and namespace in other branches
  1. 6 includes/FeedsSource.inc \FeedsSource::schedule()
  2. 7.2 includes/FeedsSource.inc \FeedsSource::schedule()

Schedule this source.

File

includes/FeedsSource.inc, line 199
Definition of FeedsSourceInterface and FeedsSource class.

Class

FeedsSource
This class encapsulates a source of a feed. It stores where the feed can be found and how to import it.

Code

public function schedule() {

  // Check whether any fetcher is overriding the import period.
  $period = $this->importer->config['import_period'];
  $fetcher_period = $this->importer->fetcher
    ->importPeriod($this);
  if (is_numeric($fetcher_period)) {
    $period = $fetcher_period;
  }
  $job = array(
    'callback' => 'feeds_source_import',
    'type' => $this->id,
    'id' => $this->feed_nid,
    // Schedule as soon as possible if a batch is active.
    'period' => $this->batch ? 0 : $period,
    'periodic' => TRUE,
  );
  if ($job['period'] != FEEDS_SCHEDULE_NEVER) {
    job_scheduler()
      ->set($job);
  }
  else {
    job_scheduler()
      ->remove($job);
  }
}