You are here

public function FeedsSource::scheduleExpire in Feeds 8.2

Schedule background expire tasks.

1 call to FeedsSource::scheduleExpire()
FeedsSource::schedule in lib/Drupal/feeds/FeedsSource.php
Schedule all periodic tasks for this source.

File

lib/Drupal/feeds/FeedsSource.php, line 194
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.

Namespace

Drupal\feeds

Code

public function scheduleExpire() {

  // Schedule as soon as possible if a batch is active.
  $period = $this
    ->progressExpiring() === FEEDS_BATCH_COMPLETE ? 3600 : 0;
  $job = array(
    'type' => $this->id,
    'id' => $this->feed_nid,
    'period' => $period,
    'periodic' => TRUE,
  );
  if ($this->importer->processor
    ->expiryTime() == FEEDS_EXPIRE_NEVER) {
    JobScheduler::get('feeds_source_expire')
      ->remove($job);
  }
  else {
    JobScheduler::get('feeds_source_expire')
      ->set($job);
  }
}